1 AS_INIT[]dnl -*- shell-script -*-
2 m4_divert_push([HEADER-COPYRIGHT])dnl
4 # make-builder -- create PSPP build scripts
6 # Copyright (C) 1992, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2003,
7 # 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
10 # This program is free software: you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation, either version 3 of the License, or
13 # (at your option) any later version.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 m4_divert_pop([HEADER-COPYRIGHT])dnl back to BODY
27 Usage: $0 [OPTION]... REPOSITORY BRANCH
28 where REPO and BRANCH are a Git repository and branch to clone.
31 -h, --help Print this usage message and exit
32 -b, --build=NUMBER Set build number (default: next available)
33 -o, --output=DIRECTORY Set build directory (default: build\$BUILDNR)
34 -f, --force Overwrite files in existing directory
36 Report bugs to <bug-gnu-pspp@gnu.org>.
37 GNU PSPP: <http://www.gnu.org/software/pspp/>.
38 General help using GNU software: <http://www.gnu.org/gethelp/>."]
41 make-builder (@PACKAGE_NAME@) @VERSION@
42 Copyright (C) 2010 Free Software Foundation, Inc.
43 License GPLv3+/Autoconf: GNU GPL version 3 or later
44 <http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html>
45 This is free software: you are free to change and redistribute it.
46 There is NO WARRANTY, to the extent permitted by law.
48 Written by Ben Pfaff."]
51 Try \`$as_me --help' for more information."
54 m4_bpatsubst([AS_ERROR([option `$[1]' requires an argument$as_nl$help])],
56 # restore font-lock: '
64 while test $# -gt 0 ; do
65 option=[`expr "x$1" : 'x\(--[^=]*\)' \| \
67 optarg=[`expr "x$1" : 'x--[^=]*=\(.*\)' \| \
71 echo "$version" ; exit ;;
73 AS_ECHO(["$usage"]); exit ;;
77 autom4te_options="$autom4te_options $1"; shift ;;
83 test $# = 1 && eval "$exit_missing_arg"
91 test $# = 1 && eval "$exit_missing_arg"
98 -- ) # Stop option processing
100 - ) # Use stdin as input.
104 AS_ERROR([invalid option `$[1]'$as_nl$help]) ;; #`
110 # Find the input file.
117 AS_ERROR([invalid number of arguments$as_nl$help]) ;;
120 # Choose build number.
121 if test "x$buildnr" = x; then
124 if ln $[1].$$ $[1].lock; then
136 until lock_file build_number; do
140 if test -e buildnr; then
141 buildnr=`cat buildnr`
145 echo `expr $buildnr + 1` > buildnr
150 # Check that build number is a number.
151 if expr "X$buildnr" : '[X[0-9][0-9]*$]' >/dev/null; then
155 AS_ERROR([invalid build number `$buildnr'$as_nl$help]) #`
158 # Ensure that git repository exists.
159 GIT_DIR=$PWD/repo.git
164 git fetch $repository +$branch:refs/builds/$buildnr/pspp
166 # Get PSPP commit number.
167 pspp_commit=`git rev-parse refs/builds/$buildnr/pspp`
169 # Get gnulib commit number.
171 git show refs/builds/$buildnr/pspp:README.Git | \
172 sed -n 's/^[[ ]]*commit \([[0-9a-fA-F]]\{8,\}\)$/\1/p' | \
175 # Fetch Gnulib source.
176 if git rev-parse --verify --quiet $gnulib_commit^0 > /dev/null; then
179 # We don't have the right commit yet, update Gnulib.
180 git fetch git://git.sv.gnu.org/gnulib.git +refs/heads/*:refs/remotes/gnulib/*
182 git update-ref refs/builds/$buildnr/gnulib $gnulib_commit
184 # Choose and create output directory.
185 test -z "$outdir" && outdir=build$buildnr
186 if test -e "$outdir" && test $overwrite = false; then
188 AS_ERROR([$outdir exists and --force not specified$as_nl$help])
190 AS_MKDIR_P([$outdir])
192 # Make source tarballs.
193 git archive --format=tar --prefix=pspp-$pspp_commit/ $pspp_commit \
194 | gzip > $outdir/pspp-$pspp_commit.tar.gz
195 git archive --format=tar --prefix=gnulib-$gnulib_commit/ $gnulib_commit \
196 | gzip > $outdir/gnulib-$gnulib_commit.tar.gz
198 # Make build scripts.
199 sed < dist-pspp.in > "$outdir/dist-pspp" "
200 s,[@]PSPP_COMMIT[@],$pspp_commit,g
201 s,[@]GNULIB_COMMIT[@],$gnulib_commit,g
202 s,[@]BRANCH[@],$branch,g
203 s,[@]CONFIGUREFLAGS[@],,g
205 chmod +x "$outdir/dist-pspp"
208 cp gendocs.sh gendocs_template gendocs_template_min "$outdir/"