diff --git a/janet-installer.nsi b/janet-installer.nsi index e34952b5..3b51fd2f 100644 --- a/janet-installer.nsi +++ b/janet-installer.nsi @@ -70,11 +70,11 @@ section "install" # HKLM (all users) vs HKCU (current user) WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" JANET_PATH "$INSTDIR\Library" WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" JANET_HEADERPATH "$INSTDIR\C" - WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" JANET_BINDIR "$INSTDIR\bin" + WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" JANET_BINPATH "$INSTDIR\bin" WriteRegExpandStr HKCU "Environment" JANET_PATH "$INSTDIR\Library" WriteRegExpandStr HKCU "Environment" JANET_HEADERPATH "$INSTDIR\C" - WriteRegExpandStr HKCU "Environment" JANET_BINDIR "$INSTDIR\bin" + WriteRegExpandStr HKCU "Environment" JANET_BINPATH "$INSTDIR\bin" SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 @@ -137,11 +137,11 @@ section "uninstall" DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" JANET_PATH DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" JANET_HEADERPATH - DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" JANET_BINDIR + DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" JANET_BINPATH DeleteRegValue HKCU "Environment" JANET_PATH DeleteRegValue HKCU "Environment" JANET_HEADERPATH - DeleteRegValue HKCU "Environment" JANET_BINDIR + DeleteRegValue HKCU "Environment" JANET_BINPATH # Unset PATH ${un.EnvVarUpdate} $0 "PATH" "R" "HKCU" "$INSTDIR\bin" ; Remove @@ -159,4 +159,4 @@ section "uninstall" # Remove uninstaller information from the registry DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Janet" -sectionEnd \ No newline at end of file +sectionEnd 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 diff --git a/tools/jpm b/tools/jpm index f791b978..8449f9a0 100755 --- a/tools/jpm +++ b/tools/jpm @@ -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))