# -*- autoconf -*- BP_INIT usage=["\ Usage: $0 [OPTION]... PSPP_DIST.TAR.GZ BINID where PSPP_DIST.TAR.GZ is a PSPP tarball prepared by \"make dist\" and BINID briefly identifies the target, e.g. \"debian-squeeze-i386\". Options: --on HOST[:DIR] Perform remote build using ssh and scp -h, --help Print this usage message and exit -f, --force Delete existing directory instead of aborting Report bugs to . GNU PSPP: . General help using GNU software: ."] version=["\ make-binary (@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. overwrite=false remote= CONFIGUREFLAGS= n_envvars=0 check=true # 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 ;; --force | -f ) overwrite=true shift ;; --on=* ) remote=$optarg shift ;; --on ) test $# = 1 && eval "$exit_missing_arg" remote=$2 shift; shift ;; --configureflags=* ) CONFIGUREFLAGS=$optarg shift ;; --configureflags ) test $# = 1 && eval "$exit_missing_arg" CONFIGUREFLAGS=$2 shift; shift ;; --no-check ) check=false shift ;; -- ) # Stop option processing shift; break ;; -* ) exec >&2 AS_ERROR([invalid option `$[1]'$as_nl$help]) ;; #`( *=* ) AS_VAR_ARITH([n_envvars], [$n_envvars + 1]) AS_VAR_SET([env$n_envvars], ["$[1]"]) shift ;; * ) break ;; esac done # Find the input file. case $# in 2) tarball=$1 BINID=$2 ;; *) exec >&2 AS_ERROR([invalid number of arguments$as_nl$help]) ;; esac if test ! -e "$tarball"; then exec >&2 AS_ERROR([$tarball does not exist]) fi case $BINID in # ( *[!-_.+~a-zA-Z0-9]*) exec >&2 AS_ERROR([invalid binid $BINID]) ;; esac REMOTE_HOST= REMOTE_DIR= case $remote in # ( "") ;; # ( *:*) REMOTE_HOST=[`expr "$remote" : '\([^:]*\):'`] REMOTE_DIR=[`expr "$remote" : '[^:]*:\(.*\)'`] ;; # ( *) REMOTE_HOST=$remote ;; esac if test "X$REMOTE_HOST" != X; then m4_pattern_allow([BP_SSH]) : ${BP_SSH=ssh} escape () { AS_ECHO("$1") | sed "s/'/'\\\\''/g" } options= if test "x$CONFIGUREFLAGS" != x; then options="--configureflags='"`escape "$CONFIGUREFLAGS"`\' fi $check || options="$options --no-check" $overwrite && options="$options --force" i=0 while test $i -lt $n_envvars; do AS_VAR_ARITH([i], [$i + 1]) AS_VAR_COPY([tmp], [env$i]) options="$options '"`escape "$tmp"`\' done shift rc=0 tar cf - make-bin-dist build-aux $tarball | gzip | $BP_SSH $REMOTE_HOST "cd $REMOTE_DIR && zcat | tar xf - && ./make-bin-dist $options $tarball $BINID" || rc=$? $BP_SSH $REMOTE_HOST "cd $REMOTE_DIR && tar cf - $BINID" | tar xf - || rc=$? exit $rc fi for dir in $BINID $BINID.buildtmp; do if test -e $dir; then if $overwrite; then chmod -R u+w $dir rm -rf $dir else exec >&2 AS_ERROR([$dir exists and --force not specified]) fi fi mkdir $dir || { exec >&2; AS_ERROR([failed to create $dir]); } done BP_INIT_RESULTS([$BINID]) BP_INIT_LOG([$BINID/LOG]) BP_SET_VAR([BUILD_NUMBER], [@BUILD_NUMBER@]) BP_SET_VAR([PSPP_REPO], [@PSPP_REPO@]) BP_SET_VAR([PSPP_BRANCH], [@PSPP_BRANCH@]) BP_SET_VAR([PSPP_COMMIT], [@PSPP_COMMIT@]) BP_SET_VAR([GNULIB_REPO], [@GNULIB_REPO@]) BP_SET_VAR([GNULIB_COMMIT], [@GNULIB_COMMIT@]) BP_SET_VAR([BINID]) BP_SET_VAR([CONFIGUREFLAGS]) BP_START_STEP([Determining $tarball target directory]) DIST_DIR=`zcat $tarball | tar tf - 2>/dev/null | sed 1q | sed s,/.*,,` BP_SET_VAR([DIST_DIR]) if test X$DIST_DIR = X; then BP_ERROR([failed to determine $tarball target directory]) fi BP_START_STEP([Extracting source tarball]) BP_RUN([(cd $BINID.buildtmp && zcat ../$tarball | tar xf -) >&AS_MESSAGE_LOG_FD 2>&1]) BP_START_STEP([Extracting tar version]) DIST_VERSION=`$BINID.buildtmp/$DIST_DIR/configure --version 2>/dev/null | sed 1q | sed 's/.* //'` BP_SET_VAR([DIST_VERSION]) BP_START_STEP([Checking for GNU make]) case `(make --version | sed 1q) 2>/dev/null` in # ( "GNU Make"*) GNU_MAKE=true ;; *) GNU_MAKE=false ;; esac BP_SET_VAR([GNU_MAKE]) BP_START_STEP([Configuring]) srcdir=$BINID.buildtmp/$DIST_DIR if $GNU_MAKE; then builddir=$srcdir/_$BINID rel_srcdir=.. BP_RUN([mkdir $builddir >&AS_MESSAGE_LOG_FD 2>&1]) BP_RUN([chmod -R a-w $srcdir >&AS_MESSAGE_LOG_FD 2>&1]) BP_RUN([chmod u+w $builddir >&AS_MESSAGE_LOG_FD 2>&1]) else builddir=$srcdir rel_srcdir=. BP_RUN([find $builddir -type f -print | xargs chmod u-w >&AS_MESSAGE_LOG_FD 2>&1]) BP_RUN([chmod u+w $builddir >&AS_MESSAGE_LOG_FD 2>&1]) fi set x i=0 while test $i -lt $n_envvars; do AS_VAR_ARITH([i], [$i + 1]) AS_VAR_COPY([tmp], [env$i]) set "$@" "$tmp" done shift BP_TRY_RUN([(cd $builddir && $rel_srcdir/configure --enable-relocatable --prefix='' $CONFIGUREFLAGS "$@") >&AS_MESSAGE_LOG_FD 2>&1]) _bp_status=$? for base in config.h config.log; do fn=$builddir/$base if test -e "$fn"; then BP_COPY_OUTPUT([build configuration], [$fn]) fi done if test $_bp_status != 0; then AS_ECHO(["$as_me:$LINENO: command exited with status $_bp_status"]) >&AS_MESSAGE_LOG_FD exit 1 fi BP_START_STEP([Build]) BP_RUN([(cd $builddir && make) >&AS_MESSAGE_LOG_FD 2>&1]) BP_START_STEP([Install]) BP_RUN([(cd $builddir && make install DESTDIR=$PWD/pspp-$DIST_VERSION-$BINID) >&AS_MESSAGE_LOG_FD 2>&1]) BP_START_STEP([Make binary distribution]) BP_RUN([(cd $builddir && tar cfz pspp-$DIST_VERSION-$BINID.tar.gz pspp-$DIST_VERSION-$BINID) >&AS_MESSAGE_LOG_FD 2>&1]) BP_MOVE_OUTPUT([binary distribution], [$builddir/pspp-$DIST_VERSION-$BINID.tar.gz]) if $check; then BP_START_STEP([Check]) BP_TRY_RUN([(cd $builddir && make check) >&AS_MESSAGE_LOG_FD 2>&1]) _bp_status=$? for base in tests/testsuite.log tests/testsuite.dir; do fn=$builddir/$base if test -e "$fn"; then BP_MOVE_OUTPUT([test logs], [$fn]) fi done if test $_bp_status != 0; then AS_ECHO(["$as_me:$LINENO: command exited with status $_bp_status"]) >&AS_MESSAGE_LOG_FD exit 1 fi fi BP_START_STEP([Uninstall]) BP_RUN([(cd $builddir && make uninstall DESTDIR=$PWD/pspp-$DIST_VERSION-$BINID) >&AS_MESSAGE_LOG_FD 2>&1]) BP_START_STEP([Check uninstall]) BP_RUN([(cd $builddir && make distuninstallcheck distuninstallcheck_dir=$PWD/pspp-$DIST_VERSION-$BINID) >&AS_MESSAGE_LOG_FD 2>&1]) # distcleancheck BP_FINISH