dot/emacs: Use Simon's Fixed font for Windows.
[profile] / bin / mdw-build
index 2c4edaa..a465040 100755 (executable)
@@ -69,6 +69,7 @@ Build options:
   [no]debian
   [no]upload
   [no]clean
+  [no]vpath
 EOF
 }
 
@@ -92,6 +93,7 @@ distcheck=yes
 debian=yes
 upload=yes
 clean=yes
+vpath=yes
 for opt; do
   case "$opt" in
     checkout)  checkout=yes checkoutrev=HEAD ;;
@@ -100,10 +102,10 @@ for opt; do
     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"
       ;;
     *)
@@ -239,7 +241,7 @@ case "$gitver,$debver" in
     ;;
 esac
 
-## Maybe check ot a copy of the source.
+## Maybe check out a copy of the source.
 case "$checkout" in
   yes)
     cd $releasepath
@@ -258,24 +260,35 @@ case "$setup" in
 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
@@ -294,6 +307,7 @@ if ! tar tf $buildpath/$distdir.tar.gz 2>/dev/null | grep -q RELEASE; then
 fi
 
 run mv $buildpath/$distdir.tar.gz .
+run gpg -u$(mdw-conf releasekey) -ab -o$distdir.tar.gz.gpg $distdir.tar.gz
 
 ## Maybe build the Debian packages.
 case "$debian" in
@@ -311,7 +325,7 @@ case "$upload,$build" in
     info "Test build: not uploading."
     ;;
   yes,release)
-    run rsync $distdir.tar.gz \
+    run rsync $distdir.tar.gz $distdir.tar.gz.gpg \
       $(mdw-conf upload-target ftp.distorted.org.uk:~ftp/pub/mdw/)
     case "$debian" in
       yes)