;;;; -*- Mode:Common-Lisp; Package:Common-Lisp-User; Syntax:common-lisp -*- ;;;; *-* File: /usr/local/gbbopen/startup.lisp *-* ;;;; *-* Edited-By: cork *-* ;;;; *-* Last-Edit: Sun Aug 31 14:43:40 2008 *-* ;;;; *-* Machine: cyclone.cs.umass.edu *-* ;;;; ************************************************************************** ;;;; ************************************************************************** ;;;; * ;;;; * GBBopen Startup File ;;;; * ;;;; ************************************************************************** ;;;; ************************************************************************** ;;; ;;; Written by: Dan Corkill ;;; ;;; Copyright (C) 2002-2008, Dan Corkill ;;; Part of the GBBopen Project (see LICENSE for license information). ;;; ;;; For GBBopen porting information, refer to the file PORTING. ;;; ;;; This file is used as source only. ;;; ;;; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;;; ;;; 07-08-02 File created. (Corkill) ;;; 04-14-04 Added MCL feature hacking to keep things simpler ;;; throughout. (Corkill) ;;; 06-09-04 Added /gbbopen-init.lisp file loading. (Corkill) ;;; 06-10-04 Moved the :gbbopen package definition here (from ;;; gbbopen/preamble.lisp) to facilitate setting GBBopen parameters ;;; in a user's /gbbopen-init.lisp file. (Corkill) ;;; 06-08-05 Added CLISP support. (sds) ;;; 09-28-05 Added *preferred-browser*. (Corkill) ;;; 03-11-06 Added *module-manager-compile-verbose* and ;;; *module-manager-load-verbose*. (Corkill) ;;; 04-07-06 Added gbbopen-modules directory support. (Corkill) ;;; 04-27-08 Added shared-gbbopen-modules directory support. (Corkill) ;;; ;;; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * (in-package :common-lisp-user) ;;; =========================================================================== ;;; Preferred browser setting (defaults) (defvar *preferred-browser* ;; On Mac OSX we defer to the OS default browser: #+(or macosx darwin) "open" ;; Lispworks (non-Windows) and SBCL do not search PATH for programs, so ;; the path must be explicitly included in the preferred browser setting: #+(or (and lispworks (not win32)) sbcl) "/usr/bin/firefox" #-(or macosx darwin (and lispworks (not win32)) sbcl) "firefox") ;;; --------------------------------------------------------------------------- ;;; Set/reset GBBopen install root (defvar is in initiate.lisp) (declaim (special *gbbopen-install-root*)) ;; This file also can establish the GBBopen install directory: (unless (boundp '*gbbopen-install-root*) (setf *gbbopen-install-root* (make-pathname :name nil :type nil :defaults *load-truename*))) ;;; --------------------------------------------------------------------------- ;;; Control gbbopen-modules directory processing (defvar is in initiate.lisp) (declaim (special *skip-gbbopen-modules-directory-processing*)) (unless (boundp '*skip-gbbopen-modules-directory-processing*) (setf *skip-gbbopen-modules-directory-processing* nil)) ;;; --------------------------------------------------------------------------- ;;; Load required Corman Common Lisp patches #+cormanlisp (load (make-pathname :name "corman-patches" :type "lisp" :defaults *gbbopen-install-root*)) ;;; --------------------------------------------------------------------------- ;;; Define COMPILE-IF-ADVANTAGEOUS if it is not already present (from loading ;;; initiate.lisp) (unless (fboundp 'compile-if-advantageous) (defun compile-if-advantageous (fn-name) ;;; CMUCL, Lispworks, and SBCL running in :interpret *evaluator-mode* can't ;;; compile interpreted closures (so we avoid having `fn-name' any ;;; definitions that are closures) ;;; ;;; CMUCL can't compile macro definitions (so we skip compiling them) ;;; ;;; ECL's compiler is slow and creates temporary files, so we don't bother #+ecl (declare (ignore fn-name)) #-ecl (unless (or #+cmu (macro-function fn-name)) (compile fn-name)))) ;;; --------------------------------------------------------------------------- ;;; Define EXTENDED-REPL-QUIT-LISP if it is not already present (from loading ;;; extended-repl.lisp) (unless (fboundp 'extended-repl-quit-lisp) (defun extended-repl-quit-lisp (&rest args) #+sbcl (let ((swank-package (find-package :swank))) (when swank-package (let ((quit-lisp-fn (intern (symbol-name 'quit-lisp) swank-package))) (when (fboundp quit-lisp-fn) (funcall quit-lisp-fn))))) (apply ;; Avoid infinite #'quit recursion in Allegro: #+allegro #'exit #-allegro #'quit args)) (compile-if-advantageous 'extended-repl-quit-lisp)) ;;; --------------------------------------------------------------------------- ;;; Bootstrap-load the module-manager system from its location relative to the ;;; GBBopen install root: (load (make-pathname :name "module-manager-loader" :type "lisp" :directory `(,@(pathname-directory *gbbopen-install-root*) "source" "module-manager") :version :newest :defaults *gbbopen-install-root*)) ;;; --------------------------------------------------------------------------- ;;; Define and load the remaining GBBopen module definitions from ;;; modules.lisp: (module-manager:define-module :gbbopen-modules (:requires :module-manager) (:directory nil :up) (:files ("modules" :source))) (module-manager:load-module :gbbopen-modules) ;;; --------------------------------------------------------------------------- ;;; Define the :gbbopen-tools and :gbbopen packages here, to allow a user to ;;; set GBBopen parameters in their /gbbopen-init.lisp file ;;; (loaded below): (unless (find-package :gbbopen-tools) (make-package ':gbbopen-tools :use '(:common-lisp :module-manager))) (unless (find-package :gbbopen) (make-package ':gbbopen :use '(:common-lisp :module-manager :gbbopen-tools))) ;;; --------------------------------------------------------------------------- ;;; If there is a gbbopen-init.lisp file (or compiled version) in the users ;;; "home" directory, load it now: (load (namestring (make-pathname :name "gbbopen-init" :type #-(or clisp ecl) ':unspecific #+(or clisp ecl) nil :version ':newest :defaults (user-homedir-pathname))) :if-does-not-exist nil) ;;; =========================================================================== ;;; Load gbbopen-modules-directory processing, if needed: (unless (fboundp 'process-gbbopen-modules-directory) (load (make-pathname :name "gbbopen-modules-directory" :type "lisp" :defaults *gbbopen-install-root*))) ;;; --------------------------------------------------------------------------- ;;; Process the modules.lisp file (if present) from each module directory ;;; that is linked from GBBopen's shared-gbbopen-modules directory: (unless *skip-gbbopen-modules-directory-processing* (process-shared-gbbopen-modules-directory "modules")) ;;; --------------------------------------------------------------------------- ;;; If there is a gbbopen-modules directory in the users "home" directory, ;;; load the modules.lisp file (if present) from each module directory that ;;; is linked from the gbbopen-modules directory: (unless *skip-gbbopen-modules-directory-processing* (process-gbbopen-modules-directory "modules")) ;;; --------------------------------------------------------------------------- ;;; Record that GBBopen's startup file has been loaded: (declaim (special *gbbopen-startup-loaded*)) (setf *gbbopen-startup-loaded* 't) ;;; =========================================================================== ;;; End of File ;;; ===========================================================================