[no]debian
[no]upload
[no]clean
+ [no]vpath
EOF
}
debian=yes
upload=yes
clean=yes
+vpath=yes
for opt; do
case "$opt" in
checkout) checkout=yes checkoutrev=HEAD ;;
release) build=release ;;
norelease) build=test ;;
- setup | distcheck | debian | upload | clean)
+ setup | distcheck | debian | upload | clean | vpath)
eval "$opt=yes"
;;
- nosetup | nodistcheck | nodebian | noupload | noclean)
+ nosetup | nodistcheck | nodebian | noupload | noclean | novpath)
eval "${opt#no}=no"
;;
*)
esac
done
+## Parse DEB_BUILD_OPTIONS.
+jobs=1
+set -- $DEB_BUILD_OPTIONS
+for opt; do
+ case "$opt" in
+ parallel=*) jobs=${opt#*=} ;;
+ esac
+done
+
+makeopts=""
+case $jobs in 1) ;; *) makeopts="$makeopts -j$jobs" ;; esac
+
###--------------------------------------------------------------------------
### Utility functions.
;;
esac
-## Maybe check ot a copy of the source.
+## Maybe check out a copy of the source.
case "$checkout" in
yes)
cd $releasepath
esac
## Initialize the build directory.
-if [ -e $srcpath/configure ]; then
- assign buildpath $releasepath/_build
- mkdir $buildpath
- cd $buildpath
- run $srcpath/configure
-else
- info "no configure script"
- assign buildpath $srcpath
- cd $srcpath
-fi
+case "$vpath,$(yesno [ -e $srcpath/configure ])" in
+ yes,yes)
+ assign buildpath $releasepath/_build
+ mkdir $buildpath
+ cd $buildpath
+ run $srcpath/configure
+ ;;
+ no,yes)
+ info "VPATH build disabled"
+ assign buildpath $srcpath
+ distcheck=no
+ cd $srcpath
+ run ./configure
+ ;;
+ *,no)
+ info "no configure script"
+ assign buildpath $srcpath
+ cd $srcpath
+ ;;
+esac
## Discover the release name.
cat >find-distdir.mk <<'EOF'
include Makefile
print-distdir:
- @echo $(distdir)
+ @echo >&3 $(distdir)
EOF
-assign distdir $(make -f find-distdir.mk print-distdir)
+assign distdir \
+ $({ make -f find-distdir.mk print-distdir >/dev/null 2>&1; } 3>&1)
## Get a tarball distribution.
case "$distcheck" in
yes)
- run make distcheck
+ run make $makeopts distcheck
;;
no)
- run make dist
+ run make $makeopts dist
;;
esac