Update jpm path settings.

This will make it easier to use jpm as a per-project
management tool, as well as easier to set up individual
module trees.
This commit is contained in:
Calvin Rose 2019-12-12 19:35:40 -06:00
parent 9b7d642c38
commit c3f1b54171
3 changed files with 21 additions and 15 deletions

View File

@ -93,16 +93,23 @@
# Configuration
#
(def- exe-dir
"Directory containing jpm script"
(do
(def exe (dyn :current-file))
(def i (last (string/find-all sep exe)))
(slice exe 0 i)))
(def JANET_MODPATH (or (os/getenv "JANET_MODPATH") (dyn :syspath)))
# Default based on janet binary location
(def JANET_HEADERPATH (or (os/getenv "JANET_HEADERPATH")
(if-let [j (dyn :syspath)]
(string j "/../../include/janet"))))
(def JANET_BINPATH (or (os/getenv "JANET_BINPATH")
(if-let [j (dyn :syspath)]
(string j "/../../bin"))))
(string exe-dir "/../include/janet")))
(def JANET_LIBPATH (or (os/getenv "JANET_LIBPATH")
(if-let [j (dyn :syspath)]
(string j "/.."))))
(string exe-dir "/../lib")))
(def JANET_BINPATH (or (os/getenv "JANET_BINPATH")
(string (dyn :syspath) "/bin")))
#
# Compilation Defaults
@ -116,8 +123,6 @@
(def env (fiber/getenv (fiber/current)))
(def threads? (not (not (env 'thread/new))))
(print "threads " threads?)
# Default flags for natives, but not required
(def default-lflags (if is-win ["/nologo"] []))
(def default-cflags

11
jpm.1
View File

@ -36,7 +36,7 @@ If passed to jpm install, runs tests before installing. Will run tests recursive
.TP
.BR \-\-modpath=/some/path
Set the path to install modules to. Defaults to $JANET_MODPATH, $JANET_PATH, or (dyn :syspath) in that order.
Set the path to install modules to. Defaults to $JANET_MODPATH, $JANET_PATH, or (dyn :syspath) in that order. You most likely don't need this.
.TP
.BR \-\-headerpath=/some/path
@ -172,7 +172,8 @@ This variable is overwritten by the --modpath=/some/path if it is provided.
The location that jpm will look for janet header files (janet.h and janetconf.h) that are used
to build native modules and standalone executables. If janet.h and janetconf.h are available as
default includes on your system, this value is not required. If not provided, will default to
(dyn :syspath)/../../include/janet. The --headerpath=/some/path will override this variable.
<jpm script location>/../include/janet. The --headerpath=/some/path option will override this
variable.
.RE
.B JANET_LIBPATH
@ -180,15 +181,15 @@ default includes on your system, this value is not required. If not provided, wi
Similar to JANET_HEADERPATH, this path is where jpm will look for
libjanet.a for creating standalong executables. This does not need to be
set on a normal install.
If not provided, this will default to (dyn :syspath)/../../lib.
The --libpath=/some/path will override this variable.
If not provided, this will default to <jpm script location>/../lib.
The --libpath=/some/path option will override this variable.
.RE
.B JANET_BINPATH
.RS
The directory where jpm will install binary scripts and executables to.
Defaults to
(dyn :syspath)/../../lib.
(dyn :syspath)/bin
The --binpath=/some/path will override this variable.
.RE

View File

@ -472,7 +472,7 @@ error:
#ifdef JANET_WINDOWS
static DWORD janet_create_thread_wrapper(void *param) {
static DWORD WINAPI janet_create_thread_wrapper(LPVOID param) {
thread_worker((JanetMailbox *)param);
return 0;
}