1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-24 17:27:18 +00:00

Set module/*syspath* to JANET_PATH at build time

The takes out the hardcoded reference to /usr/local/
This commit is contained in:
Calvin Rose 2019-02-18 14:31:23 -05:00
parent d2d502b9ae
commit 660a2b41ae
3 changed files with 7 additions and 2 deletions

View File

@ -35,7 +35,8 @@ MANPATH?=$(PREFIX)/share/man/man1/
DEBUGGER=gdb
CFLAGS=-std=c99 -Wall -Wextra -Isrc/include -fpic -O2 -fvisibility=hidden \
-DJANET_BUILD=$(JANET_BUILD)
-DJANET_BUILD=$(JANET_BUILD) \
-DJANET_DEFAULT_PATH="\"$(JANET_PATH)\""
UNAME:=$(shell uname -s)
ifeq ($(UNAME), Darwin)

View File

@ -1605,7 +1605,9 @@ value, one key will be ignored."
and if that is not set /usr/local/lib/janet on linux/posix, and
on Windows the default is the empty string."
(or (os/getenv "JANET_PATH")
(if (= :windows (os/which)) "" "/usr/local/lib/janet")))
(if (= :windows (os/which)) "" JANET_DEFAULT_PATH)))
(put _env 'JANET_DEFAULT_PATH nil)
(defn- fexists [path]
(def f (file/open path))

View File

@ -761,6 +761,8 @@ JanetTable *janet_core_env(void) {
#endif
#ifdef JANET_BOOTSTRAP
/* Let the bootstrap program know where to set the default path */
janet_core_def(env, "JANET_DEFAULT_PATH", janet_cstringv(JANET_DEFAULT_PATH), NULL);
/* Run bootstrap source */
janet_dobytes(env, janet_gen_core, janet_gen_core_size, "core.janet", NULL);
#else