shithub: mc

Download patch

ref: 177573cce9c9ec978a88fe23814422fa2c740b0e
parent: 98faed57da6da8b1e39ebaa2e9e4c22ac2cef5c3
author: Ori Bernstein <[email protected]>
date: Wed Apr 15 17:56:30 EDT 2015

Clean up install root handling a bit.

--- a/mbld/build.myr
+++ b/mbld/build.myr
@@ -303,6 +303,9 @@
 		for inc in incs
 			cmd = std.slpush(cmd, std.fmt("-L%s", inc))
 		;;
+		if opt_instroot.len > 0
+			cmd = std.slpush(cmd, std.fmt("-L%s%s", opt_instroot, "/lib/myr"))
+		;;
 	;;
 
 	libs = std.htkeys(libgraph)
@@ -339,7 +342,7 @@
 	else
 		match findlib(lib, incs)
 		| `std.None:
-			std.fatal(1, "could not find library lib%s.a", lib)
+			std.fatal(1, "could not find library lib%s.a\n", lib)
 		| `std.Some p:
 			-> std.slput(cmd, head, p)
 		;;
@@ -352,18 +355,12 @@
 
 	sl = std.bfmt(buf[:], "lib%s.a", lib)
 	for i in incs
-		p = std.pathjoin([i, sl][:])
+		p = std.pathcat(i, sl)
 		if std.fexists(p)
 			-> `std.Some p
 		;;
 		std.slfree(p)
 	;;
-	if opt_instroot.len > 0
-		if std.fexists(p)
-			-> `std.Some p
-		;;
-		std.slfree(p)
-	;;
 	-> `std.None
 }
 
@@ -380,7 +377,12 @@
 			;;
 			std.slfree(lib)
 		| `std.None:
-			std.fatal(1, "%s: could not find library lib%s.a", l)
+			std.fput(1, "%s: could not find library lib%s.a\n", targ.name, l)
+			std.fput(1, "searched:\n")
+			for inc in targ.incpath
+				std.fput(1, "\t%s\n", inc)
+			;;
+			std.exit(1)
 		;;
 	;;
 	std.slfree(libs)