shithub: mc

Download patch

ref: 28284f54c9ac36296ad3c820e779c24fcfc6f550
parent: a7039f62015b0c17a38c8241107ac6d2518e586d
author: Ori Bernstein <ori@Oris-Mac-mini.local>
date: Tue Dec 20 15:48:27 EST 2016

Fix warnings on OSX, refactor ./configure

	By default, OSX builds for the current OS, but
	we tell it to link for 10.6 and up. This mismatch
	will sometimes cause warnings.

	This exports an environment variable in order to fix
	that annoyance, as well as cleaning up the way we
	pass round the flags to do it.

--- a/6/main.c
+++ b/6/main.c
@@ -208,6 +208,9 @@
 		}
 	}
 
+	/* Sysinit is arbitrary code defined by the configure script */
+	Sysinit;
+
 	lappend(&incpaths, &nincpaths, Instroot "/lib/myr");
 
 	if (ctx.nargs == 0) {
--- a/configure
+++ b/configure
@@ -36,57 +36,44 @@
 OS=`uname`
 MACH=`uname -m`
 
-echo export INST_ROOT=$prefix > config.mk
+rm -f config.mk
+rm -f config.h
+rm -f mbld/config.myr
+rm -f configvar_cache
 
-echo '#define Instroot "'$prefix'"' > config.h
-echo '#define Asmcmd {"as", "-g", "-o", NULL}' >> config.h
-echo '#define Objsuffix ".o"' >> config.h
-echo 'export SYSCLASS=posixy' >> config.mk
+echo export INST_ROOT=$prefix >> 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 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
-# paths to install to
-echo "const Manpath = \"share/man/man\"" >> mbld/config.myr
-echo "const Sharepath = \"share\"" >> mbld/config.myr
-echo "const Binpath = \"bin\"" >> mbld/config.myr
-echo "const Libpath = \"lib/myr\"" >> mbld/config.myr
+echo "pkg config = " >> mbld/config.myr
+
+symprefix='""'
+defaultasm='Gnugaself'
+sysinit=''
 case $OS in
     *Linux*)
-        echo '#define Symprefix ""' >> config.h
-        echo '#define Defaultasm Gnugaself' >> config.h
         echo 'export SYS=linux' >> config.mk
         echo 'const Sys = "Linux"' >> mbld/config.myr
         echo 'const Linkcmd = ["ld", "-o"]' >> mbld/config.myr
         ;;
     *Darwin*)
-        echo '#define Symprefix "_"' >> config.h
-        echo '#define Defaultasm Gnugasmacho' >> config.h
+	symprefix='"_"'
+	defaultasm=Gnugasmacho
+	sysinit='setenv("MACOSX_DEPLOYMENT_TARGET", "10.6", 0)'
         echo 'export SYS=osx' >> config.mk
+        echo 'const Sys = "OSX"' >> mbld/config.myr
         echo 'const Linkcmd = ["ld", ' \
             '"-pagezero_size", "0x100000000",' \
             '"-macosx_version_min", "10.6",'\
             '"-o"]' >> mbld/config.myr
-        echo 'const Sys = "OSX"' >> mbld/config.myr
         ;;
     *FreeBSD*)
-        echo '#define Symprefix ""' >> config.h
-        echo '#define Defaultasm Gnugaself' >> config.h
         echo 'export SYS=freebsd' >> config.mk
-        echo 'const Linkcmd = ["ld", "-o"]' >> mbld/config.myr
         echo 'const Sys = "FreeBSD"' >> mbld/config.myr
+        echo 'const Linkcmd = ["ld", "-o"]' >> mbld/config.myr
         ;;
     *OpenBSD*)
-        echo '#define Symprefix ""' >> config.h
-        echo '#define Defaultasm Gnugaself' >> config.h
         echo 'export SYS=openbsd' >> config.mk
-        echo 'const Linkcmd = ["ld", "-static", "-nopie", "-o"]' >> mbld/config.myr
         echo 'const Sys = "OpenBSD"' >> mbld/config.myr
+        echo 'const Linkcmd = ["ld", "-static", "-nopie", "-o"]' >> mbld/config.myr
         ;;
     *)
         echo ''
@@ -99,6 +86,30 @@
         ;;
 esac
 
+# config.h
+echo '#define Instroot "'$prefix'"' >> config.h
+echo '#define Asmcmd {"as", "-g", "-o", NULL}' >> config.h
+echo '#define Objsuffix ".o"' >> config.h
+echo 'export SYSCLASS=posixy' >> config.mk
+echo '#define Symprefix' $symprefix >> config.h
+echo '#define Defaultasm' $defaultasm >> config.h
+echo '#define Sysinit ' $sysinit >> config.h
+
+# mbld mbld/config.myr
+echo "const Instroot = \"$prefix\"" >> mbld/config.myr
+echo "const Objsuffix = \".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
+
+# paths to install to
+echo "const Manpath = \"share/man/man\"" >> mbld/config.myr
+echo "const Sharepath = \"share\"" >> mbld/config.myr
+echo "const Binpath = \"bin\"" >> mbld/config.myr
+echo "const Libpath = \"lib/myr\"" >> mbld/config.myr
+
+
 case $MACH in
     *x86_64* | *amd64*)
 	echo 'export ARCH=x64' >> config.mk
@@ -110,7 +121,9 @@
         echo 'Unknown arch '$MACH
         echo 'Cannot build'
         echo '********************************'
+	;;
 esac
+
 echo ';;' >> mbld/config.myr
 
 echo "prefix=$prefix" > configvar_cache