]>
Commit | Line | Data |
---|---|---|
757b3ba5 ER |
1 | #!/bin/sh |
2 | # Usage: | |
3 | # ./get-source.sh | |
4 | # Author: Elan Ruusamäe <glen@pld-linux.org> | |
4623c72a ER |
5 | # |
6 | # To see release notes, see this page: | |
7 | # https://developers.google.com/speed/docs/mod_pagespeed/release_notes | |
757b3ba5 | 8 | |
5bdfa704 | 9 | package=modpagespeed |
757b3ba5 | 10 | baseurl=http://modpagespeed.googlecode.com/svn |
40de8a4b | 11 | # leave empty to use latest tag, or "trunk" for trunk |
ef0f87bf | 12 | version= |
757b3ba5 | 13 | spec=apache-mod_pagespeed.spec |
17e08f85 | 14 | force=0 |
757b3ba5 | 15 | |
92bbc644 ER |
16 | # There are directories we want to strip, but that are unnecessarily required by the build-system |
17 | # So we drop everything but the gyp/gypi files | |
18 | almost_strip_dirs() { | |
19 | for dir in "$@"; do | |
20 | find $dir -depth -mindepth 1 '!' '(' -name '*.gyp' -o -name '*.gypi' ')' -print -delete || : | |
21 | done | |
22 | } | |
23 | ||
757b3ba5 ER |
24 | # abort on errors |
25 | set -e | |
757b3ba5 ER |
26 | # work in package dir |
27 | dir=$(dirname "$0") | |
28 | cd "$dir" | |
29 | ||
17e08f85 ER |
30 | if [[ "$1" = *force ]]; then |
31 | force=1 | |
32 | shift | |
33 | fi | |
34 | ||
40de8a4b ER |
35 | if [ "$1" ]; then |
36 | version=$1 | |
37 | fi | |
38 | ||
39 | if [ -z "$version" ]; then | |
40 | echo "Looking for latest version..." | |
365e19f8 | 41 | version=$(svn ls $baseurl/tags/ | grep '^[0-9]' | sort -V | tail -n1) |
ef0f87bf | 42 | version=${version%/} |
40de8a4b ER |
43 | fi |
44 | ||
45 | if [ "$version" = "trunk" ]; then | |
46 | echo "Using trunk" | |
757b3ba5 | 47 | svnurl=$baseurl/trunk/src |
5bdfa704 | 48 | version=$(date +%Y%m%d) |
40de8a4b ER |
49 | else |
50 | echo "Version: $version" | |
51 | svnurl=$baseurl/tags/$version/src | |
757b3ba5 ER |
52 | fi |
53 | ||
5bdfa704 ER |
54 | release_dir=$package-$version |
55 | tarball=$release_dir.tar.xz | |
56 | ||
17e08f85 | 57 | if [ -f $tarball -a $force != 1 ]; then |
a8c42333 ER |
58 | echo "Tarball $tarball already exists" |
59 | exit 0 | |
60 | fi | |
61 | ||
ef0f87bf ER |
62 | # gclient needs python 2.6 |
63 | if python -c "import sys; sys.exit(sys.version[:3] > '2.6')"; then | |
64 | echo >&2 "Need python >= 2.6 for gclient" | |
65 | exit 1 | |
66 | fi | |
67 | ||
fbe26cab ER |
68 | gclient=$(which gclient 2>/dev/null) |
69 | if [ -z "$gclient" ]; then | |
70 | # http://www.chromium.org/developers/how-tos/install-depot-tools | |
71 | test -d depot_tools || { | |
72 | # could also checkout: | |
73 | # svn co http://src.chromium.org/svn/trunk/tools/depot_tools | |
74 | wget -c https://src.chromium.org/svn/trunk/tools/depot_tools.zip | |
75 | unzip -qq depot_tools.zip | |
76 | chmod a+x depot_tools/gclient depot_tools/update_depot_tools | |
77 | } | |
78 | gclient=$topdir/depot_tools/gclient | |
79 | fi | |
757b3ba5 | 80 | |
17e08f85 | 81 | topdir=${PWD:-($pwd)} |
fbe26cab | 82 | gclientfile=$topdir/gclient.conf |
5bdfa704 ER |
83 | install -d $package |
84 | cd $package | |
757b3ba5 | 85 | |
fbe26cab | 86 | if [ ! -f $gclientfile ]; then |
7c93b354 | 87 | # create initial config that can be later modified |
fbe26cab | 88 | $gclient config $svnurl --gclientfile=$gclientfile |
17e08f85 ER |
89 | fi |
90 | ||
fbe26cab | 91 | cp -p $gclientfile .gclient |
7c93b354 | 92 | |
17e08f85 ER |
93 | # emulate gclient config, preserving our deps |
94 | sed -i -re '/"url"/ s,"http[^"]+","'$svnurl'",' .gclient | |
95 | ||
fbe26cab | 96 | $gclient sync --nohooks -v |
757b3ba5 | 97 | |
92bbc644 ER |
98 | cd src |
99 | ||
100 | # clean sources, but preserve .gyp, .gypi | |
101 | almost_strip_dirs \ | |
102 | third_party/apr/ \ | |
103 | third_party/httpd/ \ | |
104 | third_party/httpd24/ \ | |
105 | third_party/instaweb/ \ | |
106 | third_party/openssl/ \ | |
107 | ||
5eafce75 ER |
108 | # some more unneeded files for build |
109 | rm -r third_party/chromium/src/net | |
110 | rm -r third_party/chromium/src/chrome | |
111 | rm -r net/instaweb/rewriter/testdata | |
112 | ||
113 | # build/linux and third_party/chromium/src/build/linux are same dirs, the latter is not usedc | |
114 | #rm -r third_party/chromium/src/build/linux | |
115 | #third_party/chromium/src/build/linux | |
116 | ||
757b3ba5 | 117 | # Populate the LASTCHANGE file template as we will not include VCS info in tarball |
92bbc644 ER |
118 | ./build/lastchange.sh . -o LASTCHANGE.in |
119 | ||
120 | cd ../.. | |
757b3ba5 | 121 | |
563e8b85 ER |
122 | XZ_OPT=-e9 \ |
123 | tar --transform="s:^$package/src:$release_dir:" \ | |
124 | -caf $tarball --exclude-vcs $package/src | |
5bdfa704 | 125 | |
757b3ba5 ER |
126 | ../md5 $spec |
127 | ../dropin $tarball & |