Following code builds FriCAS without error, proves that
"at build time old $spadroot is never being used". We always use
$FRICAS and only use $FRICAS.

So we can simplify the logic greatly.

=====
diff --git a/src/interp/util.lisp b/src/interp/util.lisp
index ffce3d1f..2dd9a5a1 100644
--- a/src/interp/util.lisp
+++ b/src/interp/util.lisp
@@ -107,7 +107,7 @@ from scratch.
 ;;; of the {\bf FRICAS} shell variable at build time) if we can't.
 ;;; Use the parent directory of FRICASsys binary as fallback.
 (defun initroot (&optional (newroot nil))
-  (reroot (or (|getEnv| "FRICAS") newroot
+ (reroot (or (|getEnv| "FRICAS") (error (concatenate 'string "ERRORX " newroot))
               (if (|fricas_probe_file| $spadroot) $spadroot)
               (let ((bin-parent-dir
                      (concatenate 'string
=====

See attachment for full patch.

ECL uses a different code path, is also tested.

- 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/0539c277-4208-41d5-a165-a1c818dee32d%40gmail.com.
diff --git a/src/interp/Makefile.in b/src/interp/Makefile.in
index e900716c..72d19ac8 100644
--- a/src/interp/Makefile.in
+++ b/src/interp/Makefile.in
@@ -130,8 +130,7 @@ makeint.lisp: ../boot/lobj_lst
 	cat ../boot/lobj_lst >> makeint.lisp
 	echo '))))' >> makeint.lisp
 	echo '(build-interpsys' \
-	  '(quote ($(patsubst %, "%", ${ALL_OBJS})))' \
-	  '"${FRICAS}")' >> makeint.lisp
+	  '(quote ($(patsubst %, "%", ${ALL_OBJS}))))' >> makeint.lisp
 	@ echo '(in-package "BOOT")' >> makeint.lisp
 	echo '#-:ecl(|clearClams|)' >> makeint.lisp
 	@ echo '#+:GCL (setq compiler::*suppress-compiler-notes* t)' >> makeint.lisp
diff --git a/src/interp/util.lisp b/src/interp/util.lisp
index ffce3d1f..462388dc 100644
--- a/src/interp/util.lisp
+++ b/src/interp/util.lisp
@@ -103,12 +103,9 @@ from scratch.
   )
 
 ;;; Sets up the system to use the {\bf FRICAS} shell variable if we can
-;;; and default to the {\bf \$spadroot} variable (which was the value
-;;; of the {\bf FRICAS} shell variable at build time) if we can't.
-;;; Use the parent directory of FRICASsys binary as fallback.
-(defun initroot (&optional (newroot nil))
-  (reroot (or (|getEnv| "FRICAS") newroot
-              (if (|fricas_probe_file| $spadroot) $spadroot)
+;;; otherwise use the parent directory of FRICASsys binary as fallback.
+(defun initroot ()
+  (reroot (or (|getEnv| "FRICAS")
               (let ((bin-parent-dir
                      (concatenate 'string
                                   (directory-namestring (car (|getCLArgs|)))
@@ -116,7 +114,7 @@ from scratch.
                 (if (|fricas_probe_file| (concatenate 'string bin-parent-dir
                                                       "algebra/interp.daase"))
                     bin-parent-dir))
-              (error "setenv FRICAS or (setq $spadroot)"))))
+              (error "Environment variable FRICAS is not set!"))))
 
 ;;; Gnu Common Lisp (GCL) (at least 2.6.[78]) requires some changes
 ;;; to the default memory setup to run FriCAS efficiently.
@@ -161,11 +159,11 @@ it loads all of the named files, resets a few global state variables,
 loads the databases, sets up autoload triggers and clears out hash tables.
 After this function is called the image is clean and can be saved.
 |#
-(defun build-interpsys (load-files spad)
+(defun build-interpsys (load-files)
   #-:ecl
   (progn
       (mapcar #'load load-files)
-      (interpsys-image-init spad t))
+      (interpsys-image-init t))
   (if (and (boundp 'FRICAS-LISP::*building-fricassys*)
                 FRICAS-LISP::*building-fricassys*)
        (progn
@@ -186,7 +184,7 @@ After this function is called the image is clean and can be saved.
               (if (boundp el)
                   (push (list 'defparameter el (symbol-value el))
                         initforms)))
-          (push `(interpsys-ecl-image-init ,spad) initforms)
+          (push `(interpsys-ecl-image-init) initforms)
           (push `(fricas-restart) initforms)
           (setf initforms (reverse initforms))
           (push `progn initforms)
@@ -195,7 +193,7 @@ After this function is called the image is clean and can be saved.
   )
 )
 
-(defun interpsys-ecl-image-init (spad)
+(defun interpsys-ecl-image-init ()
      (format *standard-output* "Starting interpsys~%")
      #+:ecl (let ((sym (or (find-symbol "TRAP-FPE" "EXT")
                            (find-symbol "TRAP-FPE" "SI"))))
@@ -204,18 +202,16 @@ After this function is called the image is clean and can be saved.
      #+:ecl (let ((sym (find-symbol "*BREAK-ENABLE*" "SI")))
                 (if (and sym (boundp sym))
                     (setf (symbol-value sym) t)))
-     (initroot spad)
-     (setf spad $spadroot)
-     (format *standard-output* "spad = ~s~%" spad)
+     (interpsys-image-init nil)
+     (format *standard-output* "spad = ~s~%" $spadroot)
      (force-output  *standard-output*)
-     (interpsys-image-init spad nil)
      (format *standard-output* "before fricas-restart~%")
      (force-output  *standard-output*)
 )
 
-(defun interpsys-image-init (spad display_messages)
+(defun interpsys-image-init (display_messages)
   (setf *package* (find-package "BOOT"))
-  (initroot spad)
+  (initroot)
   #+:GCL
   (init-memory-config :cons 500 :fixnum 200 :symbol 500 :package 8
                       :array 400 :string 500 :cfun 100 :cpages 1000

Reply via email to