diff options
| author | 2019-05-29 11:04:38 -0400 | |
|---|---|---|
| committer | 2019-05-29 11:04:38 -0400 | |
| commit | 178d175bcfa5f25955f6b0ba0f17f5e23cef3b7e (patch) | |
| tree | 371e05cb1160df86d832b08bd34fd445a7f285bc /tools | |
| parent | Merge branch 'master' of github.com:janet-lang/janet (diff) | |
Update options for jpm and path stuff.
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/cook.janet | 26 | ||||
| -rwxr-xr-x | tools/jpm | 15 |
2 files changed, 20 insertions, 21 deletions
diff --git a/tools/cook.janet b/tools/cook.janet index d1eb1b9d..d7cf4a49 100644 --- a/tools/cook.janet +++ b/tools/cook.janet @@ -115,9 +115,9 @@ # # Installation settings -(def LIBDIR (or (os/getenv "JANET_PATH") module/*syspath*)) -(def BINDIR (or (os/getenv "JANET_BINDIR") (unless is-win "/usr/local/bin"))) -(def INCLUDEDIR (or (os/getenv "JANET_HEADERPATH") module/*headerpath*)) +(def JANET_MODPATH (or (os/getenv "JANET_MODPATH") module/*syspath*)) +(def JANET_HEADERPATH (or (os/getenv "JANET_HEADERPATH") module/*headerpath*)) +(def JANET_BINPATH (or (os/getenv "JANET_BINPATH") (unless is-win "/usr/local/bin"))) # Compilation settings (def OPTIMIZE (or (os/getenv "OPTIMIZE") 2)) @@ -225,7 +225,7 @@ [opts] (string (opt opts :cflags CFLAGS) (if is-win " /I" " -I") - (opt opts :includedir INCLUDEDIR) + (opt opts :headerpath JANET_HEADERPATH) (if is-win " /O" " -O") (opt opts :optimize OPTIMIZE))) @@ -249,7 +249,7 @@ (def olist (string/join objects " ")) (rule target objects (if is-win - (shell ld " " lflags " /DLL /OUT:" target " " olist " " (opt opts :includedir INCLUDEDIR) "\\janet.lib") + (shell ld " " lflags " /DLL /OUT:" target " " olist " " (opt opts :headerpath JANET_HEADERPATH) "\\janet.lib") (shell ld " " cflags " -o " target " " olist " " lflags)))) (defn- create-buffer-c @@ -309,24 +309,24 @@ (compile-c opts c-src o-src))) (link-c opts lname ;objects) (add-dep "build" lname) - (def libdir (opt opts :libdir LIBDIR)) - (install-rule lname LIBDIR)) + (def path (opt opts :modpath JANET_MODPATH)) + (install-rule lname path)) (defn declare-source "Create a Janet modules. This does not actually build the module(s), but registers it for packaging and installation." [&keys opts] (def sources (opts :source)) - (def libdir (opt opts :libdir LIBDIR)) + (def path (opt opts :modpath JANET_MODPATH)) (each s sources - (install-rule s libdir))) + (install-rule s path))) (defn declare-binscript "Declare a janet file to be installed as an executable script." [&keys opts] (def main (opts :main)) - (def bindir (opt opts :bindir BINDIR)) - (install-rule main bindir)) + (def binpath (opt opts :binpath JANET_BINPATH)) + (install-rule main binpath)) (defn declare-archive "Build a janet archive. This is a file that bundles together many janet @@ -338,8 +338,8 @@ (def iname (string "build" sep name ".jimage")) (rule iname (or (opts :deps) []) (spit iname (make-image (require entry)))) - (def libdir (opt opts :libdir LIBDIR)) - (install-rule iname libdir)) + (def path (opt opts :modpath JANET_MODPATH)) + (install-rule iname path)) (defn declare-project "Define your project metadata. This should @@ -2,7 +2,7 @@ # CLI tool for building janet projects. Wraps cook. -(import cook :prefix "") +(import cook) (def- argpeg (peg/compile @@ -17,9 +17,9 @@ (print ` Keys are: - --libdir : The directory to install modules to. Defaults to $JANET_PATH or module/*syspath* - --includedir : The directory containing janet headers. Defaults to $JANET_HEADERPATH or module/*headerpath* - --bindir : The directory to install binaries and scripts. Defaults to $JANET_BINDIR. + --modpath : The directory to install modules to. Defaults to $JANET_MODPATH or module/*syspath* + --headerpath : The directory containing janet headers. Defaults to $JANET_HEADERPATH or module/*headerpath* + --binpath : The directory to install binaries and scripts. Defaults to $JANET_BINPATH. --optimize : Optimization level for natives. Defaults to $OPTIMIZE or 2. --compiler : C compiler to use for natives. Defaults to $CC or cc. --linker : C linker to use for linking natives. Defaults to $LINKER or cc. @@ -35,8 +35,7 @@ Keys are: (setdyn (keyword key) value)) (array/push todo arg))) -(import-rules "./project.janet") +(cook/import-rules "./project.janet") -(each r todo (do-rule r)) - -(if (empty? args) (help)) +(if (empty? todo) (help)) +(each rule todo (cook/do-rule rule)) |
