From 3dc479ae544db8bc9224f183f33cb3e16fe2daac Mon Sep 17 00:00:00 2001 From: Gabriel Dos Reis Date: Sat, 20 Aug 2022 23:10:21 -0700 Subject: fix sbcl 1.5.9 build (#16) * Fix build with SBCL-1.5.9 * Fix dynamic loading of open-axiom-core.so --- src/boot/strap/translator.clisp | 57 +++++++++++++++++++++++++++-------------- src/boot/translator.boot | 21 ++++++++++++--- 2 files changed, 55 insertions(+), 23 deletions(-) (limited to 'src/boot') diff --git a/src/boot/strap/translator.clisp b/src/boot/strap/translator.clisp index df59ddc4..bde5bea1 100644 --- a/src/boot/strap/translator.clisp +++ b/src/boot/strap/translator.clisp @@ -15,9 +15,9 @@ (EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE) (EXPORT - '(|evalBootFile| |loadNativeModule| |loadSystemRuntimeCore| - |compileBootHandler| |string2BootTree| - |genImportDeclaration| |retainFile?|))) + '(|evalBootFile| |directoryFromCommandLine| |loadNativeModule| + |loadSystemRuntimeCore| |compileBootHandler| + |string2BootTree| |genImportDeclaration| |retainFile?|))) (DEFPARAMETER |$currentModuleName| NIL) @@ -443,7 +443,7 @@ (SETQ |ps| (|makeParserState| |toks|)) (|bpFirstTok| |ps|) (SETQ |found| - (LET ((#1=#:G402 + (LET ((#1=#:G379 (CATCH :OPEN-AXIOM-CATCH-POINT (|bpOutItem| |ps|)))) (COND ((AND (CONSP #1#) (EQUAL (CAR #1#) :OPEN-AXIOM-CATCH-POINT)) @@ -936,21 +936,40 @@ (|associateRequestWithFileType| (|Option| "compile") "boot" #'|compileBootHandler|) -(DEFUN |loadNativeModule| (|m|) - (PROGN - (SETQ |m| (CONCAT |$NativeModulePrefix| |m| |$NativeModuleExt|)) - (COND - ((|%hasFeature| :SBCL) - (FUNCALL (|bfColonColon| 'SB-ALIEN 'LOAD-SHARED-OBJECT) |m| :DONT-SAVE T)) - ((|%hasFeature| :CLISP) - (EVAL (LIST (|bfColonColon| 'FFI 'DEFAULT-FOREIGN-LIBRARY) |m|))) - ((|%hasFeature| :ECL) - (EVAL (LIST (|bfColonColon| 'FFI 'LOAD-FOREIGN-LIBRARY) |m|))) - ((|%hasFeature| :CLOZURE) - (EVAL (LIST (|bfColonColon| 'CCL 'OPEN-SHARED-LIBRARY) |m|))) - (T (|coreError| "don't know how to load a dynamically linked module"))))) +(DEFUN |directoryFromCommandLine| (|opt|) + (LET* (|dir|) + (COND + ((SETQ |dir| (ASSOC (|Option| |opt|) (|%systemOptions|))) + (|ensureTrailingSlash| (CDR |dir|))) + (T NIL)))) + +(DEFUN |loadNativeModule| (|m| &REST |dir|) + (LET* (|LETTMP#1|) + (PROGN + (SETQ |m| (CONCAT |$NativeModulePrefix| |m| |$NativeModuleExt|)) + (COND + (|dir| (SETQ |LETTMP#1| |dir|) (SETQ |dir| (CAR |LETTMP#1|)) + (SETQ |m| (CONCAT |dir| |m|)))) + (COND + ((|%hasFeature| :SBCL) + (FUNCALL (|bfColonColon| 'SB-ALIEN 'LOAD-SHARED-OBJECT) |m| :DONT-SAVE + T)) + ((|%hasFeature| :CLISP) + (EVAL (LIST (|bfColonColon| 'FFI 'DEFAULT-FOREIGN-LIBRARY) |m|))) + ((|%hasFeature| :ECL) + (EVAL (LIST (|bfColonColon| 'FFI 'LOAD-FOREIGN-LIBRARY) |m|))) + ((|%hasFeature| :CLOZURE) + (EVAL (LIST (|bfColonColon| 'CCL 'OPEN-SHARED-LIBRARY) |m|))) + (T (|coreError| "don't know how to load a dynamically linked module")))))) (DEFUN |loadSystemRuntimeCore| () - (COND ((OR (|%hasFeature| :ECL) (|%hasFeature| :GCL)) NIL) - (T (|loadNativeModule| "open-axiom-core")))) + (LET* (|dir| |path|) + (COND ((OR (|%hasFeature| :ECL) (|%hasFeature| :GCL)) NIL) + (T + (SETQ |dir| + (COND + ((SETQ |path| (|directoryFromCommandLine| "syslib")) + |path|) + (T (CONCAT (|systemRootDirectory|) "lib/")))) + (|loadNativeModule| "open-axiom-core" |dir|))))) diff --git a/src/boot/translator.boot b/src/boot/translator.boot index 03c493a1..55bf9321 100644 --- a/src/boot/translator.boot +++ b/src/boot/translator.boot @@ -39,8 +39,9 @@ import pile import parser import ast namespace BOOTTRAN -module translator (evalBootFile, loadNativeModule, loadSystemRuntimeCore, - compileBootHandler, string2BootTree, genImportDeclaration, retainFile?) +module translator (evalBootFile, directoryFromCommandLine, + loadNativeModule, loadSystemRuntimeCore, + compileBootHandler, string2BootTree, genImportDeclaration, retainFile?) ++ If non nil, holds the name of the current module being translated. $currentModuleName := nil @@ -607,9 +608,18 @@ associateRequestWithFileType(Option '"compile", '"boot", --% Runtime support +++ Returns the directory name as specified through option name `opt'. +directoryFromCommandLine opt == + dir := ASSOC(Option opt, %systemOptions()) => + ensureTrailingSlash rest dir + nil + ++ Load native dynamically linked module -loadNativeModule m == +loadNativeModule(m,:dir) == m := strconc($NativeModulePrefix,m,$NativeModuleExt) + if dir ~= nil then + [dir] := dir + m := strconc(dir,m) %hasFeature KEYWORD::SBCL => apply(bfColonColon("SB-ALIEN","LOAD-SHARED-OBJECT"), [m,KEYWORD::DONT_-SAVE,true]) @@ -623,4 +633,7 @@ loadNativeModule m == loadSystemRuntimeCore() == %hasFeature KEYWORD::ECL or %hasFeature KEYWORD::GCL => nil - loadNativeModule '"open-axiom-core" + dir := + path := directoryFromCommandLine '"syslib" => path + strconc(systemRootDirectory(),'"lib/") + loadNativeModule('"open-axiom-core",dir) -- cgit v1.2.3