summaryrefslogtreecommitdiff
path: root/mbld/deps.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-05-13 19:31:35 -0700
committerOri Bernstein <ori@eigenstate.org>2016-05-13 19:31:36 -0700
commit5bc9a99994e20a7d5ea6bc298e4b37bf7db2e48d (patch)
tree48888d7c487c74cf4227ef7ec3820be907738876 /mbld/deps.myr
parentf8152dae21873cf42f2d65bdf657a717c2240a25 (diff)
downloadmc-5bc9a99994e20a7d5ea6bc298e4b37bf7db2e48d.tar.gz
Switch to using lib{}.use.
Does 3 things; 1) Teaches the compiler about how to load libfoo.use, falling back to 'foo' 2) teaches muse how to generate packages named 'pkg' in fille 'libthing.use' 3) teaches mbld how to look up and resolve libfoo.use named usefiles. Eventually a fallback will be implemented.
Diffstat (limited to 'mbld/deps.myr')
-rw-r--r--mbld/deps.myr36
1 files changed, 19 insertions, 17 deletions
diff --git a/mbld/deps.myr b/mbld/deps.myr
index 4368205..dcfc7c4 100644
--- a/mbld/deps.myr
+++ b/mbld/deps.myr
@@ -360,38 +360,40 @@ const scrapelibs = {dg, lib, incs
}
const openlib = {lib, incs
- var path
+ var path, libname
for p in incs
- path = std.pathjoin([p, lib][:])
- if !std.fisreg(path)
- std.slfree(path)
- continue
+ libname = std.fmt("lib{}.use", lib)
+ path = std.pathjoin([p, libname][:])
+ std.slfree(libname)
+ if std.fisreg(path)
+ goto found
;;
- match bio.open(path, bio.Rd)
- | `std.Ok file:
- std.slfree(path)
- -> file
- | `std.Fail m:
- std.fput(std.Err, "could not open {}: {}\n", path, m)
- goto error
+ std.slfree(path)
+
+ path = std.pathjoin([p, lib][:])
+ if std.fisreg(path)
+ goto found
;;
+ std.slfree(path)
;;
- path = std.pathjoin([opt_instbase, config.Libpath, lib][:])
+
+ libname = std.fmt("lib{}.use", lib)
+ path = std.pathjoin([opt_instbase, config.Libpath, libname][:])
+ std.slfree(libname)
+:found
match bio.open(path, bio.Rd)
| `std.Ok file:
std.slfree(path)
-> file
- | `std.Fail m: /* nothing */
+ | `std.Fail m:
;;
std.fput(std.Err, "could not find library {}\n", lib)
-
-:error
std.fput(std.Err, "search path is:\n")
for p in incs
std.fput(std.Err, "\t{}\n", p)
;;
- std.fput(std.Err, "\t{}\n", path)
+ std.fput(std.Err, "\t{}\n", config.Libpath)
std.exit(1)
}