mirror of
https://github.com/janet-lang/janet
synced 2025-01-03 12:20:26 +00:00
Use function for install-paths
This commit is contained in:
parent
4077822e37
commit
536648ec19
8
jpm
8
jpm
@ -29,7 +29,7 @@
|
||||
(def i (last (string/find-all sep exe)))
|
||||
(slice exe 0 i)))
|
||||
|
||||
(def- install-paths
|
||||
(defn- install-paths []
|
||||
{:headerpath (os/realpath (string exe-dir "/../include/janet"))
|
||||
:libpath (os/realpath (string exe-dir "/../lib"))
|
||||
:binpath exe-dir})
|
||||
@ -38,16 +38,16 @@
|
||||
|
||||
# Default based on janet binary location
|
||||
(def JANET_HEADERPATH (or (os/getenv "JANET_HEADERPATH")
|
||||
(get install-paths :headerpath)))
|
||||
(get (install-paths) :headerpath)))
|
||||
(def JANET_LIBPATH (or (os/getenv "JANET_LIBPATH")
|
||||
(get install-paths :libpath)))
|
||||
(get (install-paths) :libpath)))
|
||||
# We want setting JANET_PATH to contain installed binaries. However, it is convenient
|
||||
# to have globally installed binaries got to the same place as jpm itself, which is on
|
||||
# the $PATH.
|
||||
(def JANET_BINPATH (or (os/getenv "JANET_BINPATH")
|
||||
(if-let [mp (os/getenv "JANET_MODPATH")] (string mp "/bin"))
|
||||
(if-let [mp (os/getenv "JANET_PATH")] (string mp "/bin"))
|
||||
(get install-paths :binpath)))
|
||||
(get (install-paths) :binpath)))
|
||||
|
||||
# modpath should only be derived from the syspath being used or an environment variable.
|
||||
(def JANET_MODPATH (or (os/getenv "JANET_MODPATH") (dyn :syspath)))
|
||||
|
@ -20,7 +20,7 @@
|
||||
(def- replace-peg
|
||||
(peg/compile
|
||||
~(% (* '(to "###START###")
|
||||
(constant ,(string/format "# Inserted by tools/patch-jpm.janet\n(def install-paths %j)" install-paths))
|
||||
(constant ,(string/format "# Inserted by tools/patch-jpm.janet\n(defn- install-paths [] %j)" install-paths))
|
||||
(thru "###END###")
|
||||
'(any 1)))))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user