AS_INIT[]dnl -*- shell-script -*- m4_divert_push([HEADER-COPYRIGHT])dnl # @configure_input@ # make-builder -- create PSPP build scripts # Copyright (C) 1992, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2003, # 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, # Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . m4_divert_pop([HEADER-COPYRIGHT])dnl back to BODY AS_ME_PREPARE[]dnl usage=["\ Usage: $0 [OPTION]... REPOSITORY BRANCH where REPO and BRANCH are a Git repository and branch to clone. Options: -h, --help Print this usage message and exit -b, --build=NUMBER Set build number (default: next available) -o, --output=DIRECTORY Set build directory (default: build\$BUILD_NUMBER) -f, --force Overwrite files in existing directory Report bugs to . GNU PSPP: . General help using GNU software: ."] version=["\ make-builder (@PACKAGE_NAME@) @VERSION@ Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+/Autoconf: GNU GPL version 3 or later , This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Ben Pfaff."] help="\ Try \`$as_me --help' for more information." exit_missing_arg=' m4_bpatsubst([AS_ERROR([option `$[1]' requires an argument$as_nl$help])], ['], ['\\''])' # restore font-lock: ' # Variables. outdir= overwrite=false BUILD_NUMBER= GNULIB_REPO=git://git.sv.gnu.org/gnulib.git # Parse command line. while test $# -gt 0 ; do option=[`expr "x$1" : 'x\(--[^=]*\)' \| \ "x$1" : 'x\(-.\)'`] optarg=[`expr "x$1" : 'x--[^=]*=\(.*\)' \| \ "x$1" : 'x-.\(.*\)'`] case $1 in --version | -V ) echo "$version" ; exit ;; --help | -h ) AS_ECHO(["$usage"]); exit ;; --verbose | -v ) verbose=: autom4te_options="$autom4te_options $1"; shift ;; --output=* | -o?* ) outdir=$optarg shift ;; --output | -o ) test $# = 1 && eval "$exit_missing_arg" outdir=$2 shift; shift ;; --build=* | -b?* ) BUILD_NUMBER=$optarg shift ;; --build | -b ) test $# = 1 && eval "$exit_missing_arg" BUILD_NUMBER=$2 shift; shift ;; --force | -f ) overwrite=true ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) exec >&2 AS_ERROR([invalid option `$[1]'$as_nl$help]) ;; #` * ) break ;; esac done # Find the input file. case $# in 2) PSPP_REPO=$1 PSPP_BRANCH=$2 ;; *) exec >&2 AS_ERROR([invalid number of arguments$as_nl$help]) ;; esac # Choose build number. if test "x$BUILD_NUMBER" = x; then lock_file () { echo $$ > $[1].$$ if ln $[1].$$ $[1].lock; then rm $[1].$$ return 0 fi pid=`cat $[1].lock` if kill -0 pid; then : else rm -f $[1].lock fi return 1 } until lock_file build_number; do sleep 1 done if test -e buildnr; then BUILD_NUMBER=`cat buildnr` else BUILD_NUMBER=1 fi echo `expr $BUILD_NUMBER + 1` > buildnr rm build_number.lock fi # Check that build number is a number. case $BUILD_NUMBER in # ( "" | *[!0-9]*) exec >&2 AS_ERROR([invalid build number `$BUILD_NUMBER'$as_nl$help]) #` ;; esac # Ensure that git repository exists. GIT_DIR=$PWD/repo.git export GIT_DIR if git init >/dev/null; then : else exec >&2 AS_ERROR([initializing Git repository in $GIT_DIR failed]) fi # Fetch PSPP source. if git fetch $PSPP_REPO +$PSPP_BRANCH:refs/builds/$BUILD_NUMBER/pspp >/dev/null 2>&1; then : else exec >&2 AS_ERROR([failed to fetch branch $PSPP_BRANCH from $PSPP_REPO]) fi # Get PSPP commit number. PSPP_COMMIT=`git rev-parse refs/builds/$BUILD_NUMBER/pspp` # Get gnulib commit number. GNULIB_COMMIT=`\ git show refs/builds/$BUILD_NUMBER/pspp:README.Git | \ sed -n 's/^[[ ]]*commit \([[0-9a-fA-F]]\{8,\}\)$/\1/p' | \ head -1` # Fetch Gnulib source. if git rev-parse --verify --quiet $GNULIB_COMMIT^0 > /dev/null; then : else # We don't have the right commit yet, update Gnulib. if git fetch $GNULIB_REPO '+refs/heads/*:refs/remotes/gnulib/*'; then : else exec >&2 AS_ERROR([failed to fetch commit $GNULIB_COMMIT from $GNULIB_REPO]) fi fi git update-ref refs/builds/$BUILD_NUMBER/gnulib $GNULIB_COMMIT # Choose and create output directory. test -z "$outdir" && outdir=build$BUILD_NUMBER if test -e "$outdir" && test $overwrite = false; then exec >&2 AS_ERROR([$outdir exists and --force not specified$as_nl$help]) fi AS_MKDIR_P([$outdir]) # Make source tarballs. mkdir "$outdir/repo" git archive --format=tar --prefix=pspp-$PSPP_COMMIT/ $PSPP_COMMIT \ | gzip > $outdir/repo/pspp-$PSPP_COMMIT.tar.gz git archive --format=tar --prefix=gnulib-$GNULIB_COMMIT/ $GNULIB_COMMIT \ | gzip > $outdir/repo/gnulib-$GNULIB_COMMIT.tar.gz # Make build scripts. for base in make-src-dist make-bin-dist; do sed < $base.in > "$outdir/$base" " s,[@]BUILD_NUMBER[@],$BUILD_NUMBER,g s,[@]PSPP_REPO[@],$PSPP_REPO,g s,[@]PSPP_BRANCH[@],$PSPP_BRANCH,g s,[@]PSPP_COMMIT[@],$PSPP_COMMIT,g s,[@]GNULIB_COMMIT[@],$GNULIB_COMMIT,g s,[@]GNULIB_REPO[@],$GNULIB_REPO,g " chmod +x "$outdir/$base" done # Copy in auxiliary files. mkdir "$outdir/build-aux" for base in gendocs.sh gendocs_template gendocs_template_min; do cp "build-aux/$base" "$outdir/build-aux/" done cat <