The subset of pr#96 to solve issue#110 is this:
diff --git a/src/interp/util.lisp b/src/interp/util.lisp
index 63cd20f3..2a6219cd 100644
--- a/src/interp/util.lisp
+++ b/src/interp/util.lisp
@@ -77,7 +77,7 @@ at load time.
;;; It is set up in the {\bf reroot} function.
(defvar $library-directory-list ())
-;;; Prefix a filename with the {\bf FRICAS} shell variable.
+;;; Prefix a filename with the {\bf $spadroot} variable.
(defun make-absolute-filename (name)
(concatenate 'string $spadroot name))
@@ -88,13 +88,10 @@ the system. In particular, these variables are
sensitive to the
be {\bf \$spadroot}. The {\bf reroot} function will change the
system to use a new root directory and will have the same effect
as changing the {\bf FRICAS} shell variable and rerunning the system
-from scratch. A correct call looks like:
-\begin{verbatim}
-(in-package "BOOT")
-(reroot "${FRICAS}")
-\end{verbatim}
-where the [[${FRICAS}]] variable points to installed tree.
+from scratch.
|#
+(defvar $spadroot "")
+
(defun reroot (dir)
(setq $spadroot dir)
(setq $directory-list
@@ -267,10 +264,9 @@ After this function is called the image is clean
and can be saved.
#+:GCL (system:gbc-time 0)
#+(or :sbcl :clisp :openmcl :lispworks)
(if *fricas-load-libspad*
- (let* ((ax-dir (|getEnv| "FRICAS"))
- (spad-lib (concatenate 'string ax-dir "/lib/libspad.so")))
+ (let ((spad-lib (make-absolute-filename "/lib/libspad.so")))
(format t "Checking for foreign routines~%")
- (format t "FRICAS=~S~%" ax-dir)
+ (format t "FRICAS=~S~%" $spadroot)
(format t "spad-lib=~S~%" spad-lib)
(if (|fricas_probe_file| spad-lib)
(progn
@@ -280,7 +276,7 @@ After this function is called the image is clean and
can be saved.
(|quiet_load_alien| spad-lib)
#+(or :sbcl :openmcl)
(fricas-lisp::init-gmp
- (concatenate 'string ax-dir "/lib/gmp_wrap.so"))
+ (make-absolute-filename "/lib/gmp_wrap.so"))
#+(and :clisp :ffi)
(progn
(eval `(FFI:DEFAULT-FOREIGN-LIBRARY ,spad-lib))
On 10/14/22 20:19, Qian Yun wrote:
(This is a follow up discussion of
https://github.com/fricas/fricas/pull/96)
I'd like to discuss this again, to avoid problem like
https://github.com/fricas/fricas/issues/110,
aka to load "libspad.so" when "FRICAS" is not set.
First, the binary (instead of shell script) FRICASsys should
work when "FRICAS" is not set.
Second, during a fricas session, we can safely assume that
the environment variable "FRICAS" does not change.
Third, if so, the we can use "FRICAS" from C side and use
"$spadroot" in Lisp side and still be consistent.
Finally, if we are considering the use case of using FRICASsys
alone, aka using the Lisp image without the C part, then it
is clear that we should (|getEnv| "FRICAS") once, if it does not
exist, use some other default value, and store it into an
variable ($spadroot) and use that variable later.
- Qian
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/e83e749c-d7fd-32f8-7a38-6f9f7da7c702%40gmail.com.