Simpler way to set JANET_PATH at compile time.

This commit is contained in:
Calvin Rose 2019-02-18 14:48:29 -05:00
parent 660a2b41ae
commit 540b326c54
4 changed files with 6 additions and 12 deletions

View File

@ -35,8 +35,7 @@ MANPATH?=$(PREFIX)/share/man/man1/
DEBUGGER=gdb
CFLAGS=-std=c99 -Wall -Wextra -Isrc/include -fpic -O2 -fvisibility=hidden \
-DJANET_BUILD=$(JANET_BUILD) \
-DJANET_DEFAULT_PATH="\"$(JANET_PATH)\""
-DJANET_BUILD=$(JANET_BUILD)
UNAME:=$(shell uname -s)
ifeq ($(UNAME), Darwin)
@ -78,7 +77,7 @@ build/janet_boot: $(JANET_BOOT_OBJECTS)
# Now the reason we bootstrap in the first place
build/core_image.c: build/janet_boot
build/janet_boot
JANET_PATH=$(JANET_PATH) build/janet_boot
##########################################################
##### The main interpreter program and shared object #####

View File

@ -57,6 +57,7 @@ for %%f in (src\boot\*.c) do (
)
%JANET_LINK% /out:build\janet_boot.exe build\boot\*.obj
@if errorlevel 1 goto :BUILDFAIL
set JANET_PATH="C:/Janet/Library"
build\janet_boot
@rem Build the core image

View File

@ -1601,13 +1601,9 @@ value, one key will be ignored."
(var module/*syspath*
"The path where globally installed libraries are located.
The default value is the environment variable JANET_PATH,
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)) "" JANET_DEFAULT_PATH)))
(put _env 'JANET_DEFAULT_PATH nil)
The default is set at build time and is /usr/local/lib/janet on linux/posix, and
on Windows is C:/Janet/Library."
(or (os/getenv "JANET_PATH") ""))
(defn- fexists [path]
(def f (file/open path))

View File

@ -761,8 +761,6 @@ 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