summaryrefslogtreecommitdiff
path: root/mbld
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2018-01-12 23:15:03 -0800
committerOri Bernstein <ori@eigenstate.org>2018-01-12 23:15:03 -0800
commite2c679b435ce2e9a71a4247acaf0c9177cd33c0b (patch)
treef1163ae870178979533d0374936af8726c79ab5d /mbld
parent94448201527e0c47c2924219bf1a8d0c0c2406b7 (diff)
parent8355d0e6cd741731b972955dd10dfb494c3370bf (diff)
downloadmc-e2c679b435ce2e9a71a4247acaf0c9177cd33c0b.tar.gz
Merge branch 'remd' of https://github.com/moreais/mc
Diffstat (limited to 'mbld')
-rw-r--r--mbld/deps.myr6
-rw-r--r--mbld/libs.myr16
2 files changed, 15 insertions, 7 deletions
diff --git a/mbld/deps.myr b/mbld/deps.myr
index d7767d8..a95bef8 100644
--- a/mbld/deps.myr
+++ b/mbld/deps.myr
@@ -429,6 +429,8 @@ const arcmd = {b, n, mt, ar
}
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 @@ const linkcmd = {b, n, mt, bin, libs, dynlibs, istest
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 @@ const linkcmd = {b, n, mt, bin, libs, dynlibs, istest
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"))
;;
diff --git a/mbld/libs.myr b/mbld/libs.myr
index 544181a..f70698c 100644
--- a/mbld/libs.myr
+++ b/mbld/libs.myr
@@ -9,7 +9,7 @@ pkg bld =
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 openlib = {lib, targ, incs
const addlibs = {b, sl, libs, incs
var added, diradded, looped
+ var dynlink
var lo
added = std.mkht()
@@ -124,8 +125,9 @@ const addlibs = {b, sl, libs, incs
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 @@ const addlibs = {b, sl, libs, incs
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 @@ const addlib = {b, sl, lib, added, diradded, looped
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 @@ const addlib = {b, sl, lib, added, diradded, looped
;;
;;
std.htdel(looped, lib)
+ -> dl
}