diff options
author | Ori Bernstein <ori@eigenstate.org> | 2016-05-13 19:31:35 -0700 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2016-05-13 19:31:36 -0700 |
commit | 5bc9a99994e20a7d5ea6bc298e4b37bf7db2e48d (patch) | |
tree | 48888d7c487c74cf4227ef7ec3820be907738876 /mbld | |
parent | f8152dae21873cf42f2d65bdf657a717c2240a25 (diff) | |
download | mc-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')
-rw-r--r-- | mbld/build.myr | 4 | ||||
-rw-r--r-- | mbld/deps.myr | 36 | ||||
-rw-r--r-- | mbld/install.myr | 15 |
3 files changed, 31 insertions, 24 deletions
diff --git a/mbld/build.myr b/mbld/build.myr index 5b1afe1..2d27b96 100644 --- a/mbld/build.myr +++ b/mbld/build.myr @@ -359,6 +359,8 @@ const mergeuse = {dg, lib, files, incs cmd = [][:] std.slpush(&cmd, std.sldup(opt_muse)) std.slpush(&cmd, std.sldup("-o")) + std.slpush(&cmd, std.fmt("lib{}.use", lib)) + std.slpush(&cmd, std.sldup("-p")) std.slpush(&cmd, std.sldup(lib)) for f in files if std.hassuffix(f, ".myr") @@ -449,7 +451,7 @@ const findlib = {lib, incs std.slfree(p) ;; - p = std.pathjoin([opt_instbase, config.Libpath, lib][:]) + p = std.pathjoin([opt_instbase, config.Libpath, sl][:]) if std.fexists(p) -> `std.Some p ;; 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) } diff --git a/mbld/install.myr b/mbld/install.myr index 448db99..8a4f496 100644 --- a/mbld/install.myr +++ b/mbld/install.myr @@ -23,7 +23,7 @@ const uninstall = {b } const movetargs = {b, rm - var libarchive + var libarchive, libuse var pfx for tn in b.all @@ -34,10 +34,12 @@ const movetargs = {b, rm ;; | `Lib lt: if lt.install && !lt.istest - movefile(b, rm, lt.dir, lt.name, config.Libpath, 0o644) + libuse = std.fmt("lib{}.use", lt.name) + movefile(b, rm, lt.dir, libuse, config.Libpath, 0o644) libarchive = std.fmt("lib{}.a", lt.name) movefile(b, rm, lt.dir, libarchive, config.Libpath, 0o644) std.slfree(libarchive) + std.slfree(libuse) ;; | `Data dt: for blob in dt.blobs @@ -75,13 +77,14 @@ const movefile = {b, rm, dir, file, prefix, perm std.put("\t\tno such file {}\n", file) ;; else - std.put("\t{} => {}\n", file, path) std.remove(path) match std.slurp(file) - | `std.Fail m: std.fatal("Could not open {} for reading\n", file) + | `std.Fail m: std.fatal("could not open {} for reading\n", file) | `std.Ok buf: - if !std.blat(path, buf, perm) - std.put("Could not write {}\n", file) + if std.blat(path, buf, perm) + std.put("\t{} => {}\n", file, path) + else + std.put("could not write {}\n", file) ;; ;; ;; |