From 540b326c547e05a780358717c54f90aca9f543f3 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Mon, 18 Feb 2019 14:48:29 -0500 Subject: [PATCH] Simpler way to set JANET_PATH at compile time. --- Makefile | 5 ++--- build_win.bat | 1 + src/core/core.janet | 10 +++------- src/core/corelib.c | 2 -- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index d5ed50d7..ade74e1e 100644 --- a/Makefile +++ b/Makefile @@ -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 ##### diff --git a/build_win.bat b/build_win.bat index 10caa6c8..826885f4 100644 --- a/build_win.bat +++ b/build_win.bat @@ -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 diff --git a/src/core/core.janet b/src/core/core.janet index a8d4d02f..9185512c 100644 --- a/src/core/core.janet +++ b/src/core/core.janet @@ -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)) diff --git a/src/core/corelib.c b/src/core/corelib.c index bce59665..546d2a32 100644 --- a/src/core/corelib.c +++ b/src/core/corelib.c @@ -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