diff --git a/apps/bim.c b/apps/bim.c index 85819c184..48cf32a2a 100644 --- a/apps/bim.c +++ b/apps/bim.c @@ -285,7 +285,7 @@ static uint32_t state = 0; #define UTF8_ACCEPT 0 #define UTF8_REJECT 1 -static inline uint32_t decode(uint32_t* state, uint32_t* codep, uint32_t byte) { +static inline uint32_t decode(uint32_t* state, uint32_t* codep, unsigned char byte) { static int state_table[32] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xxxxxxx */ 1,1,1,1,1,1,1,1, /* 10xxxxxx */ @@ -11128,7 +11128,7 @@ void import_directory(char * dirName) { static void findBim(char * argv[]) { /* Try asking /proc */ char * binpath = realpath("/proc/self/exe", NULL); - if (!binpath) { + if (!binpath || (access(binpath, X_OK) != 0)) { if (strchr(argv[0], '/')) { binpath = realpath(argv[0], NULL); } else { @@ -11466,6 +11466,23 @@ void initialize(void) { krk_resetStack(); krk_startModule(""); + +#ifdef __toaru__ +# define KUROKO_SEARCH_PATH "/lib/kuroko/" +#else +# define KUROKO_SEARCH_PATH "/usr/lib/kuroko/" +#endif + + /* Try to import the shared object 'os' module. If we can't, + * try adjusting the module_paths to find it. */ + krk_interpret( + "try:\n" + " import os\n" + "except:\n" + " import kuroko\n" + " if '" KUROKO_SEARCH_PATH "' not in kuroko.module_paths:\n" + " kuroko.module_paths.append('" KUROKO_SEARCH_PATH "')", ""); + import_directory("syntax"); krk_startModule(""); import_directory("themes"); diff --git a/build/aarch64.mk b/build/aarch64.mk index 332e1c419..578f09b54 100644 --- a/build/aarch64.mk +++ b/build/aarch64.mk @@ -67,5 +67,5 @@ debug: system BUILD_KRK=$(TOOLCHAIN)/local/bin/kuroko $(TOOLCHAIN)/local/bin/kuroko: kuroko/src/*.c mkdir -p $(TOOLCHAIN)/local/bin - cc -Ikuroko/src -DNO_RLINE -DKRK_STATIC_ONLY -DKRK_DISABLE_THREADS -o "${TOOLCHAIN}/local/bin/kuroko" kuroko/src/*.c + cc -Ikuroko/src -DKRK_BUNDLE_LIBS="BUNDLED(os);BUNDLED(fileio);" -DNO_RLINE -DKRK_STATIC_ONLY -DKRK_DISABLE_THREADS -o "${TOOLCHAIN}/local/bin/kuroko" kuroko/src/*.c kuroko/src/modules/module_os.c kuroko/src/modules/module_fileio.c diff --git a/build/x86_64.mk b/build/x86_64.mk index e0c77125f..ca76e2d58 100644 --- a/build/x86_64.mk +++ b/build/x86_64.mk @@ -105,7 +105,7 @@ fatbase/efi/boot/bootx64.efi: boot/efi64.so BUILD_KRK=$(TOOLCHAIN)/local/bin/kuroko $(TOOLCHAIN)/local/bin/kuroko: kuroko/src/*.c mkdir -p $(TOOLCHAIN)/local/bin - cc -Ikuroko/src -DNO_RLINE -DKRK_STATIC_ONLY -DKRK_DISABLE_THREADS -o "${TOOLCHAIN}/local/bin/kuroko" kuroko/src/*.c + cc -Ikuroko/src -DKRK_BUNDLE_LIBS="BUNDLED(os);BUNDLED(fileio);" -DNO_RLINE -DKRK_STATIC_ONLY -DKRK_DISABLE_THREADS -o "${TOOLCHAIN}/local/bin/kuroko" kuroko/src/*.c kuroko/src/modules/module_os.c kuroko/src/modules/module_fileio.c image.iso: cdrom/fat.img cdrom/boot.sys boot/mbr.S util/update-extents.krk | $(BUILD_KRK) xorriso -as mkisofs -R -J -c bootcat \ diff --git a/kuroko b/kuroko index fb6faaff1..031ca32ab 160000 --- a/kuroko +++ b/kuroko @@ -1 +1 @@ -Subproject commit fb6faaff1a2305d0d557ab0a9f1142b4ad97a8ef +Subproject commit 031ca32ab0f2d7411a4f031b35bff65310f6cfad