summaryrefslogtreecommitdiff
path: root/mbld/libs.myr
diff options
context:
space:
mode:
Diffstat (limited to 'mbld/libs.myr')
-rw-r--r--mbld/libs.myr48
1 files changed, 24 insertions, 24 deletions
diff --git a/mbld/libs.myr b/mbld/libs.myr
index f99b0b2..487d110 100644
--- a/mbld/libs.myr
+++ b/mbld/libs.myr
@@ -16,10 +16,13 @@ pkg bld =
dep : byte[:][:], \
dyndep : byte[:][:] -> void)
- const scrapelib : (b : build#, libs : byte[:], incs : byte[:][:] -> void)
+ const scrapelib : (b : build#, \
+ targ : byte[:], \
+ libs : byte[:], \
+ incs : byte[:][:] -> void)
;;
-const Abiversion = 13
+const Abiversion = 14
const builtlib = {b, mt, dep, dyndep
var ldep, l, u
@@ -37,12 +40,12 @@ const builtlib = {b, mt, dep, dyndep
std.slfree(l)
std.slfree(u)
for d : dep
- scrapelib(b, d, mt.incpath)
+ scrapelib(b, mt.name, d, mt.incpath)
;;
std.htput(b.libs, mt.name, ldep)
}
-const scrapelib = {b, lib, incs
+const scrapelib = {b, targ, lib, incs
var dep, dyndep, ldep
var f, dir
@@ -50,18 +53,16 @@ const scrapelib = {b, lib, incs
-> void
;;
- (f, dir) = openlib(lib, incs)
+ (f, dir) = openlib(lib, targ, incs)
match bio.getc(f)
- | `bio.Ok 'U': /* ok */
- | `bio.Ok _: std.fput(1, "{}: not a usefile\n", lib)
- | `bio.Err e: std.fatal("{}: error reading: {}\n", lib, e)
- | `bio.Eof: std.fatal("{}: truncated\n", lib)
+ | `std.Ok 'U': /* ok */
+ | `std.Ok _: std.fput(1, "{}/{}: not a usefile\n", dir, lib)
+ | `std.Err e: std.fatal("{}/{}: error reading: {}\n", dir, lib, e)
;;
match bio.getbe32(f)
- | `bio.Ok Abiversion: /* nothing: version matches. */
- | `bio.Ok v: std.fput(1, "{}: mismatched abi {}\n", lib, v)
- | `bio.Err e: std.fatal("{}: error reading: {}\n", lib, e)
- | `bio.Eof: std.fatal("{}: truncated\n", lib)
+ | `std.Ok Abiversion: /* nothing: version matches. */
+ | `std.Ok v: std.fput(1, "{}/{}: mismatched abi {}\n", dir, lib, v)
+ | `std.Err e: std.fatal("{}/{}: error reading: {}\n", dir, lib, e)
;;
std.slfree(rdstr(f))
@@ -69,10 +70,10 @@ const scrapelib = {b, lib, incs
dyndep = [][:]
while true
match bio.getc(f)
- | `bio.Ok 'L': std.slpush(&dep, rdstr(f))
- | `bio.Ok 'X': std.slpush(&dyndep, rdstr(f))
- | `bio.Err e: std.fatal("{}: error reading {}", lib, e)
- | _: break;
+ | `std.Ok 'L': std.slpush(&dep, rdstr(f))
+ | `std.Ok 'X': std.slpush(&dyndep, rdstr(f))
+ | `std.Err e: std.fatal("{}: error reading {}\n", lib, e)
+ | _: break
;;
;;
bio.close(f)
@@ -87,11 +88,11 @@ const scrapelib = {b, lib, incs
std.htput(b.libs, lib, ldep)
for d : dep
- scrapelib(b, d, incs)
+ scrapelib(b, targ, d, incs)
;;
}
-const openlib = {lib, incs : byte[:][:]
+const openlib = {lib, targ, incs
var path, libname
path = ""
@@ -107,11 +108,11 @@ const openlib = {lib, incs : byte[:][:]
-> (file, p)
| `std.Err m:
;;
- std.fatal("{} does not exist in {j=, }\n", lib, incs)
+ std.fatal("{}: {} does not exist in {j=, }\n", targ, lib, incs)
;;
std.slfree(path)
;;
- std.fatal("{} does not exist in {j= }\n", lib, incs)
+ std.fatal("{}: {} does not exist in {j= }\n", targ, lib, incs)
}
const addlibs = {b, sl, libs, incs
@@ -176,11 +177,10 @@ const rdstr = {f -> byte[:]
var sl
match bio.getbe32(f)
- | `bio.Ok l:
+ | `std.Ok l:
len = l
sl = std.slalloc(len)
- | `bio.Eof: std.fatal("end of file while reading string")
- | `bio.Err e: std.fatal("error while reading string: {}", e)
+ | `std.Err e: std.fatal("error while reading string: {}", e)
;;
bio.read(f, sl)
-> sl