2 # Make snapshot of nacl-binutils
3 # Author: Elan Ruusamäe <glen@pld-linux.org>
7 # git clone http://git.chromium.org/native_client/nacl-newlib.git
8 # (Checkout ID taken from chromium-15.0.874.106/native_client/tools/REVISIONS)
10 # git checkout f5185a5726155efb578d4d0f6537bc15ee5edb7d
12 # For newlib version, grep PACKAGE_VERSION newlib/libm/configure
13 # mv nacl-newlib nacl-newlib-1.18.0-gitf5185a57
14 # tar cfj nacl-newlib-1.18.0-gitf5185a57.tar.bz2 nacl-newlib-1.18.0-gitf5185a57
17 repo_url=http://git.chromium.org/native_client/$package.git
18 nacl_trunk=http://src.chromium.org/native_client/trunk
19 omahaproxy_url=https://omahaproxy.appspot.com
20 specfile=crossnacl-newlib.spec
22 # if you get errors that sha1 hash not found, try increasing depth
23 # fatal: Path 'gcc/BASE-VER' does not exist in 'c69a5b7252d2f073d0f526800e4fca3b63cd1fab'
26 chrome_channel=${1:-stable}
27 chrome_version=$(curl -s "$omahaproxy_url/?os=linux&channel=$chrome_channel" | awk -F, 'NR > 1{print $3}')
28 test -n "$chrome_version"
29 chrome_revision=$(curl -s $omahaproxy_url/revision?version=$chrome_version)
30 test -n "$chrome_revision"
31 chrome_branch=$(IFS=.; set -- $chrome_version; echo $3)
33 test -e DEPS.py || svn cat http://src.chromium.org/chrome/branches/$chrome_branch/src/DEPS@$chrome_revision > DEPS.py
34 nacl_revision=$(awk -F'"' '/nacl_revision.:/{print $4}' DEPS.py)
35 test -n "$nacl_revision"
37 export GIT_DIR=$package/.git
39 if [ ! -d $package ]; then
42 git remote add origin $repo_url
43 git fetch ${depth:+--depth $depth} origin refs/heads/master:refs/remotes/origin/master
45 git fetch origin refs/heads/master:refs/remotes/origin/master
48 # get src/native_client/tools/REVISIONS directly from svn
49 test -n "$nacl_revision"
50 test -e NACL_REVISIONS.sh || svn cat $nacl_trunk/src/native_client/tools/REVISIONS@$nacl_revision > NACL_REVISIONS.sh
52 if grep -Ev '^(#|(LINUX_HEADERS_FOR_NACL|NACL_(BINUTILS|GCC|GDB|GLIBC|NEWLIB))_COMMIT=[0-9a-f]+$|)' NACL_REVISIONS.sh >&2; then
53 echo >&2 "I refuse to execute grabbed file for security concerns"
58 githash=$NACL_NEWLIB_COMMIT
59 git show $githash:newlib/libm/configure > configure
60 version=$(awk -F"'" '/PACKAGE_VERSION=/{print $2}' configure)
61 shorthash=$(git rev-parse --short $githash)
62 prefix=$package-$version-git$shorthash
64 if [ -f $prefix.tar.xz ]; then
65 echo "Tarball $prefix.tar.xz already exists at $shorthash"
67 git archive $githash --prefix $prefix/ > $prefix.tar
70 ../dropin $prefix.tar.xz
73 # We need to copy some missing header files from chromium
74 # mkdir ~/nacl-headers-15.0.874.106
75 # cd chromium-15.0.874.106/native_client/
76 # ./src/trusted/service_runtime/export_header.py src/trusted/service_runtime/include ~/nacl-headers-15.0.874.106/
77 # cd ~/nacl-headers-15.0.874.106
78 # tar cfj ~/nacl-headers-15.0.874.106.tar.bz2 .
81 prefix=$package-$chrome_version
82 if [ -f $prefix.tar.xz ]; then
83 echo "Tarball $prefix.tar.xz already exists"
85 svn co $nacl_trunk/src/native_client/src/trusted/service_runtime@$nacl_revision $package
87 ./export_header.py include ../$prefix
89 tar -cf $prefix.tar --exclude-vcs $prefix
91 ../dropin $prefix.tar.xz
94 # Taken from chromium-15.0.874.106/native_client/tools/newlib-libc-script
95 svn cat $nacl_trunk/src/native_client/tools/newlib-libc-script@$nacl_revision > newlib-libc-script
97 # Taken from chromium-15.0.874.106/native_client/src/untrusted/pthread/pthread.h
98 svn cat $nacl_trunk/src/native_client/src/untrusted/pthread/pthread.h@$nacl_revision > pthread.h
100 rm -f NACL_REVISIONS.sh DEPS.py configure