shithub: mc

Download patch

ref: debe132462d524de672e982f5982cc5882d2490b
parent: e086260086fdbf25ebd2de0adaf66299003ad646
author: Ori Bernstein <[email protected]>
date: Tue Apr 14 18:24:17 EDT 2015

Allow '-Rnone' to disable default lib search path.

    Useful for a number of things, like building kernels. Also,
    bootstrapping.

    Use this in the bootstrap script to remove the last vestiges
    of a dependency on a working install.

--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -208,5 +208,5 @@
 	../6/6m	-I ../libstd -I ../libbio -I ../libregex test.myr 
 echo 	../6/6m	-I ../libstd -I ../libbio -I ../libregex main.myr 
 	../6/6m	-I ../libstd -I ../libbio -I ../libregex main.myr 
-echo 	ld	-o mbld ../rt/_myrrt.o clean.o config.o deps.o types.o fsel.o util.o subdir.o main.o parse.o build.o opts.o install.o test.o -L../libstd -L../libbio -L../libregex -L./lib/myr -lregex -lbio -lstd -lsys -lsys -lstd -lbio -lregex 
-	ld	-o mbld ../rt/_myrrt.o clean.o config.o deps.o types.o fsel.o util.o subdir.o main.o parse.o build.o opts.o install.o test.o -L../libstd -L../libbio -L../libregex -L./lib/myr -lregex -lbio -lstd -lsys -lsys -lstd -lbio -lregex 
+echo 	ld	-o mbld ../rt/_myrrt.o clean.o config.o deps.o types.o fsel.o util.o subdir.o main.o parse.o build.o opts.o install.o test.o -L../libstd -L../libbio -L../libregex -lregex -lbio -lstd -lsys -lsys -lstd -lbio -lregex 
+	ld	-o mbld ../rt/_myrrt.o clean.o config.o deps.o types.o fsel.o util.o subdir.o main.o parse.o build.o opts.o install.o test.o -L../libstd -L../libbio -L../libregex -lregex -lbio -lstd -lsys -lsys -lstd -lbio -lregex 
--- a/genbootstrap.sh
+++ b/genbootstrap.sh
@@ -3,13 +3,16 @@
 export MYR_MUSE=../muse/muse
 export MYR_MC=../6/6m
 export MYR_RT=../rt/_myrrt.o
-mbld clean
+
+./mbldwrap.sh
+cp mbld/mbld xmbld
+./xmbld clean
 # The generated shell script should be a compatible bourne
 # shell script.
 bootscript=bootstrap+`uname -s`-`uname -m`
 echo '#!/bin/sh' > bootstrap.sh
 echo 'pwd=`pwd`' >> bootstrap.sh
-mbld -R. | \
+./xmbld -Rnone | \
     sed "s:Entering directory '\\(.*\\)':\tcd \$pwd/\\1:g" | \
     sed "s:Leaving directory.*:\tcd \$pwd:g" | \
     sed "s:\\([a-zA-Z0-9_-]*\\)+.*:\`\$pwd/sysselect.sh \1\`:" | \
@@ -17,3 +20,4 @@
     sed 's/.*/echo &\n&/' | \
     tee -a bootstrap.sh 
 chmod +x bootstrap.sh
+rm ./xmbld
--- a/mbld/build.myr
+++ b/mbld/build.myr
@@ -303,7 +303,6 @@
 		for inc in incs
 			cmd = std.slpush(cmd, std.fmt("-L%s", inc))
 		;;
-		cmd = std.slpush(cmd, std.fmt("-L%s%s", opt_instroot, "/lib/myr"))
 	;;
 
 	libs = std.htkeys(libgraph)
@@ -359,11 +358,12 @@
 		;;
 		std.slfree(p)
 	;;
-	p = std.pathjoin([opt_instroot, "lib/myr", sl][:])
-	if std.fexists(p)
-		-> `std.Some p
+	if opt_instroot.len > 0
+		if std.fexists(p)
+			-> `std.Some p
+		;;
+		std.slfree(p)
 	;;
-	std.slfree(p)
 	-> `std.None
 }
 
--- a/mbld/main.myr
+++ b/mbld/main.myr
@@ -17,6 +17,7 @@
 	var targname
 	var bintarg
 	var optctx
+	var libpath
 
 	optctx = std.optinit("hb:l:s:Sr:I:C:A:M:L:R:d", args)
 	bld.initopts()
@@ -49,6 +50,11 @@
 		| ('M', arg): bld.opt_muse = arg
 		| _:	std.die("got invalid arg\n")
 		;;
+	;;
+	if bld.opt_instroot.len > 0 && !std.sleq(bld.opt_instroot, "none")
+		std.put("instroot: %s\n", bld.opt_instroot)
+		libpath = std.pathcat(bld.opt_instroot, "lib/myr")
+		bld.opt_incpaths = std.slpush(bld.opt_incpaths, libpath)
 	;;
 
 	match regex.compile("^\\s*use\\s+((\\<\\S+\\>)|(\"(\\S+)\")).*")