1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-31 07:33:01 +00:00

Building standalone binaries on linux working.

Mostly changes to cook and jpm. Also some
code for file associations in the windows installer, and
adding the :linux value from os/which (instead of just :posix).
This commit is contained in:
Calvin Rose
2019-07-26 22:43:54 -05:00
parent 9118f2ce08
commit dfe00fee94
11 changed files with 488 additions and 113 deletions

View File

@@ -1732,6 +1732,7 @@
:source (fn [path args]
(put module/loading path true)
(def newenv (dofile path ;args))
(put newenv :source path)
(put module/loading path nil)
newenv)
:image (fn [path &] (load-image (slurp path)))})

View File

@@ -270,6 +270,7 @@ static Janet janet_core_native(int32_t argc, Janet *argv) {
janet_panicf("could not load native %S: %S", path, error);
}
init(env);
janet_table_put(env, janet_ckeywordv("native"), argv[0]);
return janet_wrap_table(env);
}

View File

@@ -73,6 +73,8 @@ static Janet os_which(int32_t argc, Janet *argv) {
return janet_ckeywordv("macos");
#elif defined(__EMSCRIPTEN__)
return janet_ckeywordv("web");
#elif defined(__linux__)
return janet_ckeywordv("linux");
#else
return janet_ckeywordv("posix");
#endif
@@ -763,6 +765,8 @@ static const JanetReg os_cfuns[] = {
"Check the current operating system. Returns one of:\n\n"
"\t:windows - Microsoft Windows\n"
"\t:macos - Apple macos\n"
"\t:web - Web assembly (emscripten)\n"
"\t:linux - Linux\n"
"\t:posix - A POSIX compatible system (default)")
},
{

View File

@@ -1306,11 +1306,16 @@ JANET_API void janet_register(const char *name, JanetCFunction cfun);
/* New C API */
/* Allow setting entry name for static libraries */
#ifndef JANET_ENTRY_NAME
#define JANET_ENTRY_NAME _janet_init
#endif
#define JANET_MODULE_ENTRY \
JANET_API JanetBuildConfig _janet_mod_config(void) { \
return janet_config_current(); \
} \
JANET_API void _janet_init
JANET_API void JANET_ENTRY_NAME
JANET_NO_RETURN JANET_API void janet_panicv(Janet message);
JANET_NO_RETURN JANET_API void janet_panic(const char *message);