]>
Commit | Line | Data |
---|---|---|
d93816c7 ER |
1 | #!/bin/sh |
2 | # Make snapshot of nacl-binutils | |
3 | # Author: Elan Ruusamäe <glen@pld-linux.org> | |
d93816c7 ER |
4 | set -e |
5 | ||
6 | # Generated from git | |
7 | # git clone http://git.chromium.org/native_client/nacl-binutils.git | |
8 | # (Checkout ID taken from chromium-17.0.963.46/native_client/tools/REVISIONS) | |
9 | # cd nacl-binutils | |
10 | # git checkout 73acd6f5f2ec5daa6e9be737ade60f03e258602b | |
11 | # cd .. | |
12 | # For binutils version, grep "AM_INIT_AUTOMAKE(bfd, " bfd/configure.in | |
13 | # mv nacl-binutils nacl-binutils-2.20.1-git73acd6f | |
14 | # tar cfj nacl-binutils-2.20.1-git73acd6f.tar.bz2 nacl-binutils-2.20.1-git73acd6f | |
15 | ||
16 | package=nacl-binutils | |
030003ec | 17 | repo_url=https://chromium.googlesource.com/native_client/$package |
28a50822 | 18 | nacl_trunk=http://src.chromium.org/native_client/trunk |
caf4e83b | 19 | omahaproxy_url=http://omahaproxy.appspot.com |
d93816c7 | 20 | specfile=crossnacl-binutils.spec |
d93816c7 | 21 | |
ac24d0f4 | 22 | chrome_channel=${1:-stable} |
53a502ad | 23 | chrome_version=$(curl -s "$omahaproxy_url/all?os=linux&channel=$chrome_channel" | awk -F, 'NR > 1{print $3}') |
928d61cf | 24 | test -n "$chrome_version" |
53a502ad | 25 | chrome_revision=$((echo 'data='; curl -s $omahaproxy_url/revision.json?version=$chrome_version; echo ',print(data.chromium_revision)') | js) |
928d61cf | 26 | test -n "$chrome_revision" |
f148c528 | 27 | chrome_branch=$(IFS=.; set -- $chrome_version; echo $3) |
53a502ad | 28 | test -s DEPS.py || svn cat http://src.chromium.org/chrome/branches/$chrome_branch/src/DEPS@$chrome_revision > DEPS.py |
f148c528 | 29 | nacl_revision=$(awk -F'"' '/nacl_revision.:/{print $4}' DEPS.py) |
928d61cf | 30 | test -n "$nacl_revision" |
f148c528 | 31 | |
e0182383 | 32 | export GIT_DIR=$package.git |
d93816c7 | 33 | |
e0182383 ER |
34 | if [ ! -d $GIT_DIR ]; then |
35 | install -d $GIT_DIR | |
36 | git init --bare | |
c170007c | 37 | git remote add origin $repo_url |
8a75c0d4 | 38 | git fetch --depth 1 origin refs/heads/master:refs/remotes/origin/master |
d93816c7 | 39 | else |
8a75c0d4 | 40 | git fetch origin refs/heads/master:refs/remotes/origin/master |
d93816c7 ER |
41 | fi |
42 | ||
43 | # get src/native_client/tools/REVISIONS directly from svn | |
f148c528 | 44 | test -n "$nacl_revision" |
53a502ad | 45 | test -s NACL_REVISIONS.sh || svn cat $nacl_trunk/src/native_client/tools/REVISIONS@$nacl_revision > NACL_REVISIONS.sh |
d93816c7 ER |
46 | |
47 | if grep -Ev '^(#|(LINUX_HEADERS_FOR_NACL|NACL_(BINUTILS|GCC|GDB|GLIBC|NEWLIB))_COMMIT=[0-9a-f]+$|)' NACL_REVISIONS.sh >&2; then | |
48 | echo >&2 "I refuse to execute grabbed file for security concerns" | |
49 | exit 1 | |
50 | fi | |
51 | . ./NACL_REVISIONS.sh | |
52 | ||
d93816c7 | 53 | githash=$NACL_BINUTILS_COMMIT |
c170007c | 54 | git show $githash:bfd/configure.in > configure.in |
030003ec | 55 | version=$(awk '/AC_INIT/{v=$2; gsub(/[\[\])]*/, "",v);print v}' configure.in) |
00c2a753 ER |
56 | shorthash=$(git rev-parse --short $githash) |
57 | prefix=$package-$version-git$shorthash | |
ec9d8849 | 58 | archive=$prefix.tar.xz |
d93816c7 | 59 | |
ec9d8849 ER |
60 | if [ -f $archive ]; then |
61 | echo "Tarball $archive already exists at $shorthash" | |
c1129c83 | 62 | rm -f NACL_REVISIONS.sh DEPS.py configure.in |
d93816c7 ER |
63 | exit 0 |
64 | fi | |
65 | ||
ec9d8849 | 66 | git -c tar.tar.xz.command="xz -9c" archive $githash --prefix $prefix/ -o $archive |
d93816c7 | 67 | |
ec9d8849 | 68 | ../dropin $archive |
d93816c7 | 69 | |
c170007c | 70 | rm -f NACL_REVISIONS.sh DEPS.py configure.in |