shithub: mc

Download patch

ref: e2c679b435ce2e9a71a4247acaf0c9177cd33c0b
parent: 94448201527e0c47c2924219bf1a8d0c0c2406b7
parent: 8355d0e6cd741731b972955dd10dfb494c3370bf
author: Ori Bernstein <[email protected]>
date: Fri Jan 12 18:15:03 EST 2018

Merge branch 'remd' of https://github.com/moreais/mc

--- a/mbld/deps.myr
+++ b/mbld/deps.myr
@@ -429,6 +429,8 @@
 }
 
 const linkcmd = {b, n, mt, bin, libs, dynlibs, istest
+	var dynlink
+
 	for c : config.Linkcmd
 		std.slpush(&n.cmd, std.sldup(c))
 	;;
@@ -453,7 +455,7 @@
 		std.slpush(&n.cmd, std.sldup(o))
 	;;
 
-	addlibs(b, &n.cmd, libs, mt.incpath)
+	dynlink = addlibs(b, &n.cmd, libs, mt.incpath)
 	for l : dynlibs
 		std.slpush(&n.cmd, std.fmt("-l{}", l))
 	;;
@@ -462,7 +464,7 @@
 	if std.sleq(opt_sys, "osx")
 		std.slpush(&n.cmd, std.sldup("-macosx_version_min"))
 		std.slpush(&n.cmd, std.sldup("10.6"))
-	elif std.sleq(opt_sys, "linux") && mt.isdyn
+	elif std.sleq(opt_sys, "linux") && (dynlink || mt.isdyn)
 		std.slpush(&n.cmd, std.sldup("-dynamic-linker"))
 		std.slpush(&n.cmd, std.sldup("/lib64/ld-linux-x86-64.so.2"))
 	;;
--- a/mbld/libs.myr
+++ b/mbld/libs.myr
@@ -9,7 +9,7 @@
 	const addlibs	: (b : build#, \
 		sl : byte[:][:]#, \
 		libs : byte[:][:], \
-		incs : byte[:][:] -> void)
+		incs : byte[:][:] -> bool)
 
 	const builtlib	: (b : build#, \
 		lt : myrtarg#, \
@@ -117,6 +117,7 @@
 
 const addlibs = {b, sl, libs, incs
 	var added, diradded, looped
+	var dynlink
 	var lo
 
 	added  = std.mkht()
@@ -124,8 +125,9 @@
 	diradded  = std.mkht()
 
 	lo = sl#.len
+	dynlink = false
 	for l : libs
-		addlib(b, sl, l, added, diradded, looped)
+		dynlink = addlib(b, sl, l, added, diradded, looped, dynlink)
 	;;
 	for var i = 0; i < sl#[lo:].len/2; i++
 		std.swap(&sl#[lo+i], &sl#[sl#.len - i - 1])
@@ -134,9 +136,11 @@
 	std.htfree(diradded)
 	std.htfree(looped)
 	std.htfree(added)
+
+	-> dynlink
 }
 
-const addlib = {b, sl, lib, added, diradded, looped
+const addlib = {b, sl, lib, added, diradded, looped, dl
 	var ar
 
 	if std.hthas(looped, lib)
@@ -146,12 +150,13 @@
 	match std.htget(b.libs, lib)
 	| `std.None:
 		std.slpush(sl, std.fmt("-l{}", lib))
+		dl = true
 	| `std.Some ld:
 		for l : ld.dep
-			addlib(b, sl, l, added, diradded, looped)
+			dl = addlib(b, sl, l, added, diradded, looped, dl)
 		;;
 		for l : ld.dyndep
-			addlib(b, sl, l, added, diradded, looped)
+			dl = addlib(b, sl, l, added, diradded, looped, dl)
 		;;
 		if !std.hthas(added, lib)
 			if config.Directlib
@@ -169,6 +174,7 @@
 		;;
 	;;
 	std.htdel(looped, lib)
+	-> dl
 }