1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-26 08:20:27 +00:00

Merge branch 'master' of github.com:janet-lang/janet

This commit is contained in:
Calvin Rose 2022-04-13 17:20:49 -05:00
commit a964b164a6
2 changed files with 20 additions and 6 deletions

View File

@ -58,6 +58,7 @@ UNAME:=$(shell uname -s)
ifeq ($(UNAME), Darwin) ifeq ($(UNAME), Darwin)
CLIBS:=$(CLIBS) -ldl CLIBS:=$(CLIBS) -ldl
SONAME_SETTER:=-Wl,-install_name, SONAME_SETTER:=-Wl,-install_name,
JANET_LIBRARY=build/libjanet.dylib
LDCONFIG:=true LDCONFIG:=true
else ifeq ($(UNAME), Linux) else ifeq ($(UNAME), Linux)
CLIBS:=$(CLIBS) -lrt -ldl CLIBS:=$(CLIBS) -lrt -ldl
@ -165,7 +166,11 @@ build/c/janet.c: build/janet_boot src/boot/boot.janet
##### Amalgamation ##### ##### Amalgamation #####
######################## ########################
ifeq ($(UNAME), Darwin)
SONAME=libjanet.1.21.dylib
else
SONAME=libjanet.so.1.21 SONAME=libjanet.so.1.21
endif
build/c/shell.c: src/mainclient/shell.c build/c/shell.c: src/mainclient/shell.c
cp $< $@ cp $< $@
@ -279,10 +284,16 @@ install: $(JANET_TARGET) $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY) build/janet.pc
cp -r build/janet.h '$(DESTDIR)$(INCLUDEDIR)/janet' cp -r build/janet.h '$(DESTDIR)$(INCLUDEDIR)/janet'
mkdir -p '$(DESTDIR)$(JANET_PATH)' mkdir -p '$(DESTDIR)$(JANET_PATH)'
mkdir -p '$(DESTDIR)$(LIBDIR)' mkdir -p '$(DESTDIR)$(LIBDIR)'
cp $(JANET_LIBRARY) '$(DESTDIR)$(LIBDIR)/libjanet.so.$(shell $(JANET_TARGET) -e '(print janet/version)')' if test $(UNAME) = Darwin ; then \
cp $(JANET_LIBRARY) '$(DESTDIR)$(LIBDIR)/libjanet.$(shell $(JANET_TARGET) -e '(print janet/version)').dylib' ; \
ln -sf $(SONAME) '$(DESTDIR)$(LIBDIR)/libjanet.dylib' ; \
ln -sf libjanet.$(shell $(JANET_TARGET) -e '(print janet/version)').dylib $(DESTDIR)$(LIBDIR)/$(SONAME) ; \
else \
cp $(JANET_LIBRARY) '$(DESTDIR)$(LIBDIR)/libjanet.so.$(shell $(JANET_TARGET) -e '(print janet/version)')' ; \
ln -sf $(SONAME) '$(DESTDIR)$(LIBDIR)/libjanet.so' ; \
ln -sf libjanet.so.$(shell $(JANET_TARGET) -e '(print janet/version)') $(DESTDIR)$(LIBDIR)/$(SONAME) ; \
fi
cp $(JANET_STATIC_LIBRARY) '$(DESTDIR)$(LIBDIR)/libjanet.a' cp $(JANET_STATIC_LIBRARY) '$(DESTDIR)$(LIBDIR)/libjanet.a'
ln -sf $(SONAME) '$(DESTDIR)$(LIBDIR)/libjanet.so'
ln -sf libjanet.so.$(shell $(JANET_TARGET) -e '(print janet/version)') $(DESTDIR)$(LIBDIR)/$(SONAME)
mkdir -p '$(DESTDIR)$(JANET_MANPATH)' mkdir -p '$(DESTDIR)$(JANET_MANPATH)'
cp janet.1 '$(DESTDIR)$(JANET_MANPATH)' cp janet.1 '$(DESTDIR)$(JANET_MANPATH)'
mkdir -p '$(DESTDIR)$(JANET_PKG_CONFIG_PATH)' mkdir -p '$(DESTDIR)$(JANET_PKG_CONFIG_PATH)'

View File

@ -2225,10 +2225,13 @@
### ###
### ###
(defdyn *syspath*
"Path of directory to load system modules from.")
# Initialize syspath # Initialize syspath
(each [k v] (partition 2 (tuple/slice boot/args 2)) (each [k v] (partition 2 (tuple/slice boot/args 2))
(case k (case k
"JANET_PATH" (setdyn :syspath v))) "JANET_PATH" (setdyn *syspath* v)))
(defn make-env (defn make-env
`Create a new environment table. The new environment `Create a new environment table. The new environment
@ -3662,7 +3665,7 @@
(var error-level nil) (var error-level nil)
(var expect-image false) (var expect-image false)
(if-let [jp (getenv-alias "JANET_PATH")] (setdyn :syspath jp)) (if-let [jp (getenv-alias "JANET_PATH")] (setdyn *syspath* jp))
(if-let [jprofile (getenv-alias "JANET_PROFILE")] (setdyn *profilepath* jprofile)) (if-let [jprofile (getenv-alias "JANET_PROFILE")] (setdyn *profilepath* jprofile))
(defn- get-lint-level (defn- get-lint-level
@ -3707,7 +3710,7 @@
"i" (fn [&] (set expect-image true) 1) "i" (fn [&] (set expect-image true) 1)
"k" (fn [&] (set compile-only true) (set exit-on-error false) 1) "k" (fn [&] (set compile-only true) (set exit-on-error false) 1)
"n" (fn [&] (set colorize false) 1) "n" (fn [&] (set colorize false) 1)
"m" (fn [i &] (setdyn :syspath (in args (+ i 1))) 2) "m" (fn [i &] (setdyn *syspath* (in args (+ i 1))) 2)
"c" (fn c-switch [i &] "c" (fn c-switch [i &]
(def path (in args (+ i 1))) (def path (in args (+ i 1)))
(def e (dofile path)) (def e (dofile path))