mirror of
https://github.com/janet-lang/janet
synced 2025-01-05 13:20:27 +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)))
|
(def i (last (string/find-all sep exe)))
|
||||||
(slice exe 0 i)))
|
(slice exe 0 i)))
|
||||||
|
|
||||||
(def- install-paths
|
(defn- install-paths []
|
||||||
{:headerpath (os/realpath (string exe-dir "/../include/janet"))
|
{:headerpath (os/realpath (string exe-dir "/../include/janet"))
|
||||||
:libpath (os/realpath (string exe-dir "/../lib"))
|
:libpath (os/realpath (string exe-dir "/../lib"))
|
||||||
:binpath exe-dir})
|
:binpath exe-dir})
|
||||||
@ -38,16 +38,16 @@
|
|||||||
|
|
||||||
# Default based on janet binary location
|
# Default based on janet binary location
|
||||||
(def JANET_HEADERPATH (or (os/getenv "JANET_HEADERPATH")
|
(def JANET_HEADERPATH (or (os/getenv "JANET_HEADERPATH")
|
||||||
(get install-paths :headerpath)))
|
(get (install-paths) :headerpath)))
|
||||||
(def JANET_LIBPATH (or (os/getenv "JANET_LIBPATH")
|
(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
|
# 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
|
# to have globally installed binaries got to the same place as jpm itself, which is on
|
||||||
# the $PATH.
|
# the $PATH.
|
||||||
(def JANET_BINPATH (or (os/getenv "JANET_BINPATH")
|
(def JANET_BINPATH (or (os/getenv "JANET_BINPATH")
|
||||||
(if-let [mp (os/getenv "JANET_MODPATH")] (string mp "/bin"))
|
(if-let [mp (os/getenv "JANET_MODPATH")] (string mp "/bin"))
|
||||||
(if-let [mp (os/getenv "JANET_PATH")] (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.
|
# modpath should only be derived from the syspath being used or an environment variable.
|
||||||
(def JANET_MODPATH (or (os/getenv "JANET_MODPATH") (dyn :syspath)))
|
(def JANET_MODPATH (or (os/getenv "JANET_MODPATH") (dyn :syspath)))
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
(def- replace-peg
|
(def- replace-peg
|
||||||
(peg/compile
|
(peg/compile
|
||||||
~(% (* '(to "###START###")
|
~(% (* '(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###")
|
(thru "###END###")
|
||||||
'(any 1)))))
|
'(any 1)))))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user