1
0
mirror of https://github.com/janet-lang/janet synced 2024-06-29 00:23:18 +00:00

Update options for jpm and path stuff.

This commit is contained in:
Calvin Rose 2019-05-29 11:04:38 -04:00
parent 7a7f586094
commit 178d175bcf
3 changed files with 25 additions and 26 deletions

View File

@ -70,11 +70,11 @@ section "install"
# HKLM (all users) vs HKCU (current user) # 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_PATH "$INSTDIR\Library"
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" JANET_HEADERPATH "$INSTDIR\C" 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_PATH "$INSTDIR\Library"
WriteRegExpandStr HKCU "Environment" JANET_HEADERPATH "$INSTDIR\C" 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 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_PATH
DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" JANET_HEADERPATH 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_PATH
DeleteRegValue HKCU "Environment" JANET_HEADERPATH DeleteRegValue HKCU "Environment" JANET_HEADERPATH
DeleteRegValue HKCU "Environment" JANET_BINDIR DeleteRegValue HKCU "Environment" JANET_BINPATH
# Unset PATH # Unset PATH
${un.EnvVarUpdate} $0 "PATH" "R" "HKCU" "$INSTDIR\bin" ; Remove ${un.EnvVarUpdate} $0 "PATH" "R" "HKCU" "$INSTDIR\bin" ; Remove
@ -159,4 +159,4 @@ section "uninstall"
# Remove uninstaller information from the registry # Remove uninstaller information from the registry
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Janet" DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Janet"
sectionEnd sectionEnd

View File

@ -115,9 +115,9 @@
# #
# Installation settings # Installation settings
(def LIBDIR (or (os/getenv "JANET_PATH") module/*syspath*)) (def JANET_MODPATH (or (os/getenv "JANET_MODPATH") module/*syspath*))
(def BINDIR (or (os/getenv "JANET_BINDIR") (unless is-win "/usr/local/bin"))) (def JANET_HEADERPATH (or (os/getenv "JANET_HEADERPATH") module/*headerpath*))
(def INCLUDEDIR (or (os/getenv "JANET_HEADERPATH") module/*headerpath*)) (def JANET_BINPATH (or (os/getenv "JANET_BINPATH") (unless is-win "/usr/local/bin")))
# Compilation settings # Compilation settings
(def OPTIMIZE (or (os/getenv "OPTIMIZE") 2)) (def OPTIMIZE (or (os/getenv "OPTIMIZE") 2))
@ -225,7 +225,7 @@
[opts] [opts]
(string (opt opts :cflags CFLAGS) (string (opt opts :cflags CFLAGS)
(if is-win " /I" " -I") (if is-win " /I" " -I")
(opt opts :includedir INCLUDEDIR) (opt opts :headerpath JANET_HEADERPATH)
(if is-win " /O" " -O") (if is-win " /O" " -O")
(opt opts :optimize OPTIMIZE))) (opt opts :optimize OPTIMIZE)))
@ -249,7 +249,7 @@
(def olist (string/join objects " ")) (def olist (string/join objects " "))
(rule target objects (rule target objects
(if is-win (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)))) (shell ld " " cflags " -o " target " " olist " " lflags))))
(defn- create-buffer-c (defn- create-buffer-c
@ -309,24 +309,24 @@
(compile-c opts c-src o-src))) (compile-c opts c-src o-src)))
(link-c opts lname ;objects) (link-c opts lname ;objects)
(add-dep "build" lname) (add-dep "build" lname)
(def libdir (opt opts :libdir LIBDIR)) (def path (opt opts :modpath JANET_MODPATH))
(install-rule lname LIBDIR)) (install-rule lname path))
(defn declare-source (defn declare-source
"Create a Janet modules. This does not actually build the module(s), "Create a Janet modules. This does not actually build the module(s),
but registers it for packaging and installation." but registers it for packaging and installation."
[&keys opts] [&keys opts]
(def sources (opts :source)) (def sources (opts :source))
(def libdir (opt opts :libdir LIBDIR)) (def path (opt opts :modpath JANET_MODPATH))
(each s sources (each s sources
(install-rule s libdir))) (install-rule s path)))
(defn declare-binscript (defn declare-binscript
"Declare a janet file to be installed as an executable script." "Declare a janet file to be installed as an executable script."
[&keys opts] [&keys opts]
(def main (opts :main)) (def main (opts :main))
(def bindir (opt opts :bindir BINDIR)) (def binpath (opt opts :binpath JANET_BINPATH))
(install-rule main bindir)) (install-rule main binpath))
(defn declare-archive (defn declare-archive
"Build a janet archive. This is a file that bundles together many janet "Build a janet archive. This is a file that bundles together many janet
@ -338,8 +338,8 @@
(def iname (string "build" sep name ".jimage")) (def iname (string "build" sep name ".jimage"))
(rule iname (or (opts :deps) []) (rule iname (or (opts :deps) [])
(spit iname (make-image (require entry)))) (spit iname (make-image (require entry))))
(def libdir (opt opts :libdir LIBDIR)) (def path (opt opts :modpath JANET_MODPATH))
(install-rule iname libdir)) (install-rule iname path))
(defn declare-project (defn declare-project
"Define your project metadata. This should "Define your project metadata. This should

View File

@ -2,7 +2,7 @@
# CLI tool for building janet projects. Wraps cook. # CLI tool for building janet projects. Wraps cook.
(import cook :prefix "") (import cook)
(def- argpeg (def- argpeg
(peg/compile (peg/compile
@ -17,9 +17,9 @@
(print ` (print `
Keys are: Keys are:
--libdir : The directory to install modules to. Defaults to $JANET_PATH or module/*syspath* --modpath : The directory to install modules to. Defaults to $JANET_MODPATH or module/*syspath*
--includedir : The directory containing janet headers. Defaults to $JANET_HEADERPATH or module/*headerpath* --headerpath : The directory containing janet headers. Defaults to $JANET_HEADERPATH or module/*headerpath*
--bindir : The directory to install binaries and scripts. Defaults to $JANET_BINDIR. --binpath : The directory to install binaries and scripts. Defaults to $JANET_BINPATH.
--optimize : Optimization level for natives. Defaults to $OPTIMIZE or 2. --optimize : Optimization level for natives. Defaults to $OPTIMIZE or 2.
--compiler : C compiler to use for natives. Defaults to $CC or cc. --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. --linker : C linker to use for linking natives. Defaults to $LINKER or cc.
@ -35,8 +35,7 @@ Keys are:
(setdyn (keyword key) value)) (setdyn (keyword key) value))
(array/push todo arg))) (array/push todo arg)))
(import-rules "./project.janet") (cook/import-rules "./project.janet")
(each r todo (do-rule r)) (if (empty? todo) (help))
(each rule todo (cook/do-rule rule))
(if (empty? args) (help))