summaryrefslogtreecommitdiff
path: root/mbld
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-10-01 23:26:57 -0700
committerOri Bernstein <ori@eigenstate.org>2015-10-02 19:10:43 -0700
commit6799d5048886a3c61b200bf367f305bf8c068164 (patch)
treec0feda885320511f6a95e137cbc9b049ae4cb930 /mbld
parentea60cdb464fe0bb4d289fb841304a44539d24593 (diff)
downloadmc-6799d5048886a3c61b200bf367f305bf8c068164.tar.gz
Propagate extra libraries through the system.
Diffstat (limited to 'mbld')
-rw-r--r--mbld/build.myr9
-rw-r--r--mbld/deps.myr12
-rw-r--r--mbld/types.myr2
3 files changed, 14 insertions, 9 deletions
diff --git a/mbld/build.myr b/mbld/build.myr
index afbfba5..055f8b7 100644
--- a/mbld/build.myr
+++ b/mbld/build.myr
@@ -268,7 +268,7 @@ const compile = {dg, src, incs
;;
}
-const linkbin = {dg, bin, srcfiles, ldscript, rt, incs, extralibs
+const linkbin = {dg, bin, srcfiles, ldscript, rt, incs, extlibs
var cmd
cmd = [][:]
@@ -300,7 +300,7 @@ const linkbin = {dg, bin, srcfiles, ldscript, rt, incs, extralibs
cmd = addlibs(cmd, dg.libs, incs)
/* add extra libs */
- for l in dg.extralibs
+ for l in dg.extlibs
cmd = std.slpush(cmd, std.fmt("-l{}", l))
;;
@@ -344,10 +344,13 @@ const mergeuse = {dg, lib, files, incs
for f in files
if std.hassuffix(f, ".myr")
cmd = std.slpush(cmd, srcswapsuffix(f, ".use"))
- elif !std.hassuffix(f, ".s")
+ elif !std.hassuffix(f, ".s") && !std.hassuffix(f, ".glue.c")
std.fatal("unknown file type for {}\n", f)
;;
;;
+ for l in dg.extlibs
+ cmd = std.slpush(cmd, std.fmt("-l{}", l))
+ ;;
run(cmd)
strlistfree(cmd)
}
diff --git a/mbld/deps.myr b/mbld/deps.myr
index 7a00574..66aeb6a 100644
--- a/mbld/deps.myr
+++ b/mbld/deps.myr
@@ -55,7 +55,7 @@ const myrdeps = {b, mt, doclean, addsrc
.seen = std.mkht(std.strhash, std.streq),
.done = std.mkht(std.strhash, std.streq),
.cflags = std.mkht(std.strhash, std.streq),
- .extralibs = [][:],
+ .extlibs = [][:],
.dynamic = false,
])
/* direct dependencies of binary */
@@ -87,7 +87,7 @@ const myrdeps = {b, mt, doclean, addsrc
elif std.hassuffix(srcs[i], ".glue.c")
(cflags, libs) = scrapecflags(b, dg, srcs[i])
std.htput(dg.cflags, srcs[i], cflags)
- dg.extralibs = std.sljoin(dg.extralibs, libs)
+ dg.extlibs = std.sljoin(dg.extlibs, libs)
dg.dynamic = true
;;
;;
@@ -232,7 +232,6 @@ const getcflags = {ln, cflags, libs
match regex.exec(cflagpat, ln)
| `std.None:
| `std.Some m:
- std.put("Got cflags {}\n", m)
flags = std.strtok(m[1])
for fl in flags
cflags = std.slpush(cflags, std.sldup(fl))
@@ -243,7 +242,6 @@ const getcflags = {ln, cflags, libs
match regex.exec(clibpat, ln)
| `std.None:
| `std.Some m:
- std.put("Got libs {}\n", m)
flags = std.strtok(m[1])
for fl in flags
libs = std.slpush(libs, std.sldup(fl))
@@ -315,7 +313,6 @@ const scrapelibs = {dg, lib, incs
->
;;
- deps = [][:]
f = openlib(lib, incs)
match bio.getc(f)
| `std.Some 'U': /* nothing */
@@ -333,12 +330,17 @@ const scrapelibs = {dg, lib, incs
| `std.None: std.fatal("library {}: corrupt or invalid usefile\n", lib)
;;
std.slfree(rdstr(f))
+
done = false
+ deps = [][:]
while !done
match bio.getc(f)
| `std.Some 'L':
d = rdstr(f)
deps = std.slpush(deps, d)
+ | `std.Some 'X':
+ d = rdstr(f)
+ dg.extlibs = std.slpush(dg.extlibs, d)
| `std.Some _: done = true
| `std.None: done = true
;;
diff --git a/mbld/types.myr b/mbld/types.myr
index aeb6121..b6edca9 100644
--- a/mbld/types.myr
+++ b/mbld/types.myr
@@ -72,7 +72,7 @@ pkg bld =
done : std.htab(byte[:], bool)#
/* used for linking C */
- extralibs : byte[:][:]
+ extlibs : byte[:][:]
cflags : std.htab(byte[:], byte[:][:])#
dynamic : bool
;;