]> git.pld-linux.org Git - packages/crossnacl-newlib.git/blob - get-source.sh
- pl, use arch*dir macros
[packages/crossnacl-newlib.git] / get-source.sh
1 #!/bin/sh
2 # Make snapshot of nacl-binutils
3 # Author: Elan Ruusamäe <glen@pld-linux.org>
4 set -e
5
6 # Generated from git
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)
9 # cd nacl-newlib
10 # git checkout f5185a5726155efb578d4d0f6537bc15ee5edb7d
11 # cd ..
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
15
16 package=nacl-newlib
17 repo_url=http://git.chromium.org/native_client/$package.git
18 nacl_trunk=http://src.chromium.org/native_client/trunk
19 omahaproxy_url=http://omahaproxy.appspot.com
20 specfile=crossnacl-newlib.spec
21
22 # if you get errors that sha1 hash not found, try increasing depth
23 # fatal: Path 'gcc/BASE-VER' does not exist in 'c69a5b7252d2f073d0f526800e4fca3b63cd1fab'
24 depth=
25
26 chrome_channel=${1:-stable}
27 chrome_version=$(curl -s "$omahaproxy_url/all?os=linux&channel=$chrome_channel" | awk -F, 'NR > 1{print $3}')
28 test -n "$chrome_version"
29 chrome_revision=$((echo 'data='; curl -s $omahaproxy_url/revision.json?version=$chrome_version; echo ',print(data.chromium_revision)') | js)
30 test -n "$chrome_revision"
31 chrome_branch=$(IFS=.; set -- $chrome_version; echo $3)
32 test -s DEPS.py || svn cat http://src.chromium.org/chrome/branches/$chrome_branch/src/DEPS@$chrome_revision > DEPS.py
33 nacl_revision=$(awk -F'"' '/nacl_revision.:/{print $4}' DEPS.py)
34 test -n "$nacl_revision"
35
36 export GIT_DIR=$package.git
37
38 if [ ! -d $GIT_DIR ]; then
39         install -d $GIT_DIR
40         git init --bare
41         git remote add origin $repo_url
42         git fetch ${depth:+--depth $depth} origin refs/heads/master:refs/remotes/origin/master
43 else
44         git fetch origin refs/heads/master:refs/remotes/origin/master
45 fi
46
47 # get src/native_client/tools/REVISIONS directly from svn
48 test -n "$nacl_revision"
49 test -s NACL_REVISIONS.sh || svn cat $nacl_trunk/src/native_client/tools/REVISIONS@$nacl_revision > NACL_REVISIONS.sh
50
51 if grep -Ev '^(#|(LINUX_HEADERS_FOR_NACL|NACL_(BINUTILS|GCC|GDB|GLIBC|NEWLIB))_COMMIT=[0-9a-f]+$|)' NACL_REVISIONS.sh >&2; then
52         echo >&2 "I refuse to execute grabbed file for security concerns"
53         exit 1
54 fi
55 . ./NACL_REVISIONS.sh
56
57 githash=$NACL_NEWLIB_COMMIT
58 git show $githash:newlib/libm/configure > configure
59 version=$(awk -F"'" '/PACKAGE_VERSION=/{print $2}' configure)
60 shorthash=$(git rev-parse --short $githash)
61 prefix=$package-$version-git$shorthash
62 archive=$prefix.tar.xz
63
64 if [ -f $archive ]; then
65         echo "Tarball $archive already exists at $shorthash"
66 else
67         git -c tar.tar.xz.command="xz -9c" archive $githash --prefix $prefix/ -o $archive
68
69         ../dropin $archive
70 fi
71
72 # We need to copy some missing header files from chromium
73 # mkdir ~/nacl-headers-15.0.874.106
74 # cd chromium-15.0.874.106/native_client/
75 # ./src/trusted/service_runtime/export_header.py src/trusted/service_runtime/include ~/nacl-headers-15.0.874.106/
76 # cd ~/nacl-headers-15.0.874.106
77 # tar cfj ~/nacl-headers-15.0.874.106.tar.bz2 .
78
79 package=nacl-headers
80 prefix=$package-$chrome_version
81
82 if [ -f $prefix.tar.xz ]; then
83         echo "Tarball $prefix.tar.xz already exists"
84 else
85         svn co $nacl_trunk/src/native_client/src/trusted/service_runtime@$nacl_revision $package
86         cd $package
87         ./export_header.py include ../$prefix
88         cd ..
89         tar -cf $prefix.tar --exclude-vcs $prefix
90         xz -9 $prefix.tar
91         ../dropin $prefix.tar.xz
92 fi
93
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
96
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
99
100 rm -f NACL_REVISIONS.sh DEPS.py configure
This page took 0.059436 seconds and 3 git commands to generate.