shithub: mc

Download patch

ref: a6b13e22bbb7cbeeae4cffa335ac04065a90f6db
parent: c01acd9ed61803d2ac2bdcc49720bf2d9d78bb3e
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Apr 13 06:46:02 EDT 2015

fix configure scripts, add var cache support for regen.

--- a/configure
+++ b/configure
@@ -8,12 +8,16 @@
 done
 echo "Automake emulated successfully"
 
-INST_ROOT='/usr/local'
 prefix="/usr/local"
 
 for arg in $*; do
     shift 1
     case $arg in
+        "--redo" | "-r")
+            if [ -f ./configvar_cache ]; then
+                . ./configvar_cache
+            fi
+            ;;
         "--prefix" | "-p") 
             prefix=shift $*
             ;;
@@ -41,20 +45,34 @@
 echo '#define Defaultasm Gnugas' >> config.h
 echo '#define Objsuffix ".o"' >> config.h
 echo 'export SYSCLASS=posixy' >> config.mk
+
+# mbld mbld/config.myr
+echo "pkg config = " > mbld/config.myr
+echo "const Instroot = \"$prefix\"" >> mbld/config.myr
+echo "const Objsuffix = \".o\"" >> mbld/config.myr
+echo "const Linkcmd = [\"ld\", \"-o\"]" >> mbld/config.myr
+echo "const Arcmd = [\"ar\", \"-rcs\"]" >> mbld/config.myr
+echo "const Ascmd = [\"as\", \"-g\"]" >> mbld/config.myr
+echo "const Directlib = false" >> mbld/config.myr
+echo "const Runtime = \"_myrrt.o\"" >> mbld/config.myr
+echo "const Manpath = \"share/man/man\"" >> mbld/config.myr
 case $OS in
     *Linux*)
         echo '#define Symprefix ""' >> config.h
         echo '#define Defaultasm Gnugas' >> config.h
         echo 'export SYS=linux' >> config.mk
+        echo 'const Sys = "Linux"' >> mbld/config.myr
         ;;
     *Darwin*)
         echo '#define Symprefix "_"' >> config.h
         echo 'export SYS=osx' >> config.mk
+        echo 'const Sys = "OSX"' >> mbld/config.myr
         ;;
     *FreeBSD*)
         echo '#define Symprefix ""' >> config.h
         echo '#define Defaultasm Gnugas' >> config.h
         echo 'export SYS=freebsd' >> config.mk
+        echo 'const Sys = "FreeBSD"' >> mbld/config.myr
         ;;
     *)
         echo ''
@@ -70,6 +88,7 @@
 case $MACH in
     *x86_64*)
         echo 'export ARCH=x64' >> config.mk
+        echo 'const Arch = "x64"' >> mbld/config.myr
         ;;
     *)
         echo ''
@@ -78,7 +97,9 @@
         echo 'Cannot build'
         echo '********************************'
 esac
+echo ';;' >> mbld/config.myr
 
+echo "prefix=$prefix" > configvar_cache
 cat << EOF
     Building with:
         prefix=$prefix
--- a/mbld/bldfile
+++ b/mbld/bldfile
@@ -24,7 +24,9 @@
 	lib ../libregex:regex
 ;;
 
-gen config.myr {durable} = ./configure ;;
+gen config.myr {durable} =
+	sh -c "cd .. && ./configure --redo"
+;;
 
 man = mbld.1;;
 
--- a/mk/c.mk
+++ b/mk/c.mk
@@ -117,6 +117,6 @@
 	mkdir -p $(_DEPSDIR)
 
 config.mk: configure
-	./configure
+	./configure --redo
 
 -include $(_DEPS)