chiark / gitweb /
bin/mdw-build: Prepare for a world where `mdw-setup' doesn't exist any more.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 27 Aug 2020 02:33:44 +0000 (03:33 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 29 Aug 2020 23:25:18 +0000 (00:25 +0100)
I want `cfd' to go away as a thing which is installed centrally on
systems.  So stare at a package and try to figure out how one should go
about setting it up.

bin/mdw-build

index eff2c009972dc4991010f10d57437f9ce54ce691..6c034b8b1be2d50ca77233e1838203a465af6f4b 100755 (executable)
@@ -77,7 +77,7 @@ default_depends () {
 }
 : ${checkout=yes} ${checkoutrev=HEAD}
 : ${build=test}
-: ${setup=yes} ${setupcmd=mdw-setup}
+: ${setup=yes} ${setupcmd=!guess}
 : ${distcheck=yes}
 : ${debian=yes}
 : ${clean=yes}
@@ -145,7 +145,7 @@ for opt; do
     checkout=*) checkout=yes checkoutrev=${opt#*=} ;;
     release)   build=release ;;
     norelease) build=test ;;
-    setup)     setup=yes setupcmd=mdw-setup ;;
+    setup)     setup=yes setupcmd=!guess ;;
     setup=*)   setup=yes setupcmd=${opt#*=} ;;
     upload)    maybe_set upload uploadpath ;;
     upload=*)  upload=yes uploadpath=${opt#*=} ;;
@@ -366,6 +366,16 @@ esac
 ## Maybe refresh the build machinery.
 case "$setup" in
   yes)
+    case $setupcmd in
+      !guess)
+       if [ -f .links ]; then setupcmd=mdw-setup
+       elif [ -x autogen.sh ]; then setupcmd=./autogen.sh
+       elif [ -x setup ]; then setupcmd=./setup
+       elif [ -f configure.ac ]; then setupcmd="autoreconf -is"
+       else setupcmd=mdw-setup
+       fi
+       ;;
+    esac
     run $setupcmd
     ;;
 esac