ref: 0f623b59194288d612412d6db7fb0db4ebb5321d
parent: 59a098256a8e983f8e46473b70f4e35241b22a72
author: Carlin Bingham <[email protected]>
date: Thu Jan 11 21:00:21 EST 2018
Return if dynamic linking is needed from addlibs
--- a/mbld/deps.myr
+++ b/mbld/deps.myr
@@ -428,6 +428,8 @@
}
const linkcmd = {b, n, mt, bin, libs, dynlibs, istest
+ var dynlink
+
for c : config.Linkcmd
std.slpush(&n.cmd, std.sldup(c))
;;
@@ -452,7 +454,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))
;;
@@ -461,7 +463,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") && b.dynlink
+ elif std.sleq(opt_sys, "linux") && dynlink
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,13 +150,13 @@
match std.htget(b.libs, lib)
| `std.None:
std.slpush(sl, std.fmt("-l{}", lib))
- b.dynlink = true
+ 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
@@ -170,6 +174,7 @@
;;
;;
std.htdel(looped, lib)
+ -> dl
}
--- a/mbld/types.myr
+++ b/mbld/types.myr
@@ -20,9 +20,6 @@
system : byte[:]
arch : byte[:]
- /* dynmically link */
- dynlink : bool
-
;;
type targ = union