4 # Author: Elan Ruusamäe <glen@pld-linux.org>
6 # To see release notes, see this page:
7 # https://developers.google.com/speed/docs/mod_pagespeed/release_notes
8 # Bulding from source notes:
9 # https://developers.google.com/speed/pagespeed/module/build_mod_pagespeed_from_source
12 repo_url=https://github.com/pagespeed/mod_pagespeed.git
13 # leave empty to use latest tag, or "trunk" for trunk
14 # specific version, "latest-stable" or "master" (bleeding edge version)
16 spec=apache-mod_pagespeed.spec
17 # depth to clone, do not use this as ./build/lastchange.sh uses 'git rev-list --all --count' to count revision
24 dir=$(readlink -f $(dirname "$0"))
27 if [[ "$1" = *force ]]; then
36 export GIT_DIR=$package/src/.git
38 # refs to fetch: master and latest-stable
39 refs="refs/heads/master:refs/remotes/origin/master refs/heads/latest-stable:refs/remotes/origin/latest-stable"
41 if [ ! -d $GIT_DIR ]; then
45 git remote add origin $repo_url
46 git fetch ${depth:+--depth $depth} origin $refs
48 git fetch origin $refs
55 version=$(git describe --tags)
56 echo "Version: $version"
58 release_dir=$package-$version
59 tarball=$dir/$release_dir.tar.xz
61 if [ -f $tarball -a $force != 1 ]; then
62 echo "Tarball $tarball already exists"
66 # gclient needs python 2.6
67 if python -c "import sys; sys.exit(sys.version[:3] > '2.6')"; then
68 echo >&2 "Need python >= 2.6 for gclient"
72 gclient=$(which gclient 2>/dev/null)
73 if [ -z "$gclient" ]; then
74 # http://www.chromium.org/developers/how-tos/install-depot-tools
75 test -d depot_tools || {
76 # could also checkout:
77 # svn co http://src.chromium.org/svn/trunk/tools/depot_tools
78 wget -c https://src.chromium.org/svn/trunk/tools/depot_tools.zip
79 unzip -qq depot_tools.zip
80 chmod a+x depot_tools/gclient depot_tools/update_depot_tools
82 gclient=$dir/depot_tools/gclient
85 gclientfile=$dir/gclient.conf
88 if [ ! -f $gclientfile ]; then
89 # create initial config that can be later modified
90 $gclient config $repo_url --gclientfile=$gclientfile --unmanaged --name=src
93 cp -p $gclientfile .gclient
95 # emulate gclient config, preserving our deps
96 sed -i -re '/"url"/ s,"http[^"]+","'$repo_url'",' .gclient
98 $gclient sync --nohooks -v
101 cp -al src $release_dir
104 sh -x $dir/clean-source.sh
106 # Populate the LASTCHANGE file template as we will not include VCS info in tarball
107 ./build/lastchange.sh . -o LASTCHANGE.in
112 tar -caf $tarball --exclude-vcs $release_dir