shithub: mc

Download patch

ref: 5fa05936d56f927db90c52d07fae2db63bca7d29
parent: ea067be32dd52602d1f36051e51baefe01135aa3
author: Ori Bernstein <ori@mmarkovcorp.com>
date: Tue Sep 5 07:45:59 EDT 2017

Improve error messages for missing libs.

	It's useful to know which target is missing them.

--- a/mbld/deps.myr
+++ b/mbld/deps.myr
@@ -147,7 +147,7 @@
 				depends(g, n, d)
 			;;
 			for `Xdep d : deps
-				scrapelib(b, d, mt.incpath)
+				scrapelib(b, mt.name, d, mt.incpath)
 				xdepends(b, g, n, d)
 				std.slpush(&libs, d)
 			;;
@@ -329,7 +329,7 @@
 		depends(g, n, d)
 	;;
 	for `Xdep d : deps
-		scrapelib(b, d, mt.incpath)
+		scrapelib(b, mt.name, d, mt.incpath)
 		xdepends(b, g, n, d)
 		std.slpush(&libs, d)
 	;;
--- a/mbld/libs.myr
+++ b/mbld/libs.myr
@@ -16,7 +16,10 @@
 		dep : byte[:][:], \
 		dyndep : byte[:][:] -> void)
 
-	const scrapelib : (b : build#, libs : byte[:], incs : byte[:][:] -> void)
+	const scrapelib : (b : build#, \
+		targ : byte[:], \
+		libs : byte[:], \
+		incs : byte[:][:] -> void)
 ;;
 
 const Abiversion = 14
@@ -37,12 +40,12 @@
 	std.slfree(l)
 	std.slfree(u)
 	for d : dep
-		scrapelib(b, d, mt.incpath)
+		scrapelib(b, mt.name, d, mt.incpath)
 	;;
 	std.htput(b.libs, mt.name, ldep)
 }
 
-const scrapelib = {b, lib, incs
+const scrapelib = {b, targ, lib, incs
 	var dep, dyndep, ldep
 	var f, dir
 
@@ -50,7 +53,7 @@
 		-> void
 	;;
 
-	(f, dir) = openlib(lib, incs)
+	(f, dir) = openlib(lib, targ, incs)
 	match bio.getc(f)
 	| `bio.Ok 'U':	/* ok */
 	| `bio.Ok _:	std.fput(1, "{}/{}: not a usefile\n", dir, lib)
@@ -87,11 +90,11 @@
 	std.htput(b.libs, lib, ldep)
 
 	for d : dep
-		scrapelib(b, d, incs)
+		scrapelib(b, targ, d, incs)
 	;;
 }
 
-const openlib = {lib, incs : byte[:][:]
+const openlib = {lib, targ, incs
 	var path, libname
 
 	path = ""
@@ -107,11 +110,11 @@
 				-> (file, p)
 			| `std.Err m:
 			;;
-			std.fatal("{} does not exist in {j=, }\n", lib, incs)
+			std.fatal("{}: {} does not exist in {j=, }\n", targ, lib, incs)
 		;;
 		std.slfree(path)
 	;;
-	std.fatal("{} does not exist in {j= }\n", lib, incs)
+	std.fatal("{}: {} does not exist in {j= }\n", targ, lib, incs)
 }
 
 const addlibs = {b, sl, libs, incs