summaryrefslogtreecommitdiff
path: root/mbld
diff options
context:
space:
mode:
authorCarlin Bingham <cb@viennan.net>2018-01-12 02:00:21 +1300
committerCarlin Bingham <cb@viennan.net>2018-01-12 02:00:21 +1300
commit0f623b59194288d612412d6db7fb0db4ebb5321d (patch)
treeeb491137422f5e108c5fe9d56c42aea37aae8e67 /mbld
parent59a098256a8e983f8e46473b70f4e35241b22a72 (diff)
downloadmc-0f623b59194288d612412d6db7fb0db4ebb5321d.tar.gz
Return if dynamic linking is needed from addlibs
Diffstat (limited to 'mbld')
-rw-r--r--mbld/deps.myr6
-rw-r--r--mbld/libs.myr17
-rw-r--r--mbld/types.myr3
3 files changed, 15 insertions, 11 deletions
diff --git a/mbld/deps.myr b/mbld/deps.myr
index 46d522f..49f3aa6 100644
--- a/mbld/deps.myr
+++ b/mbld/deps.myr
@@ -428,6 +428,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))
;;
@@ -452,7 +454,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))
;;
@@ -461,7 +463,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") && 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"))
;;
diff --git a/mbld/libs.myr b/mbld/libs.myr
index 8d8bf9a..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,13 +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))
- 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 @@ const addlib = {b, sl, lib, added, diradded, looped
;;
;;
std.htdel(looped, lib)
+ -> dl
}
diff --git a/mbld/types.myr b/mbld/types.myr
index baa7536..0d671e6 100644
--- a/mbld/types.myr
+++ b/mbld/types.myr
@@ -20,9 +20,6 @@ pkg bld =
system : byte[:]
arch : byte[:]
- /* dynmically link */
- dynlink : bool
-
;;
type targ = union