Ticket #1028: tools.diff
| File tools.diff, 113.2 KB (added by fare, 6 months ago) |
|---|
-
asdf.lisp
1 1 ;;; -*- mode: Common-Lisp; Base: 10 ; Syntax: ANSI-Common-Lisp ; coding: utf-8 -*- 2 ;;; This is ASDF 2.2 3: Another System Definition Facility.2 ;;; This is ASDF 2.26: Another System Definition Facility. 3 3 ;;; 4 4 ;;; Feedback, bug reports, and patches are all welcome: 5 5 ;;; please mail to <asdf-devel@common-lisp.net>. … … 50 50 (cl:in-package :common-lisp-user) 51 51 #+genera (in-package :future-common-lisp-user) 52 52 53 #-(or abcl allegro clisp clozure cmu cormanlisp ecl gcl genera lispworks mcl sbcl scl xcl)53 #-(or abcl allegro clisp clozure cmu cormanlisp ecl gcl genera lispworks mcl mkcl sbcl scl xcl) 54 54 (error "ASDF is not supported on your implementation. Please help us port it.") 55 55 56 56 ;;;; Create and setup packages in a way that is compatible with hot-upgrade. … … 71 71 (and (= system::*gcl-major-version* 2) 72 72 (< system::*gcl-minor-version* 7))) 73 73 (pushnew :gcl-pre2.7 *features*)) 74 #+(or abcl (and allegro ics) (and clisp unicode) clozure (and cmuunicode)75 (and ecl unicode)lispworks (and sbcl sb-unicode) scl)74 #+(or abcl (and allegro ics) (and (or clisp cmu ecl mkcl) unicode) 75 clozure lispworks (and sbcl sb-unicode) scl) 76 76 (pushnew :asdf-unicode *features*) 77 77 ;;; make package if it doesn't exist yet. 78 78 ;;; DEFPACKAGE may cause errors on discrepancies, so we avoid it. … … 86 86 ;;; except that the defun has to be in package asdf. 87 87 #+ecl (defun use-ecl-byte-compiler-p () (and (member :ecl-bytecmp *features*) t)) 88 88 #+ecl (unless (use-ecl-byte-compiler-p) (require :cmp)) 89 #+mkcl (require :cmp) 90 #+mkcl (setq clos::*redefine-class-in-place* t) ;; Make sure we have strict ANSI class redefinition semantics 89 91 90 92 ;;; Package setup, step 2. 91 93 (defvar *asdf-version* nil) … … 116 118 ;; "2.345.6" would be a development version in the official upstream 117 119 ;; "2.345.0.7" would be your seventh local modification of official release 2.345 118 120 ;; "2.345.6.7" would be your seventh local modification of development version 2.345.6 119 (asdf-version "2.2 3")121 (asdf-version "2.26") 120 122 (existing-asdf (find-class 'component nil)) 121 123 (existing-version *asdf-version*) 122 124 (already-there (equal asdf-version existing-version))) … … 228 230 :redefined-functions ',redefined-functions))) 229 231 (pkgdcl 230 232 :asdf 231 :nicknames (:asdf-utilities) ;; DEPRECATED! Do not use, for backward compatibility only.232 233 :use (:common-lisp) 233 234 :redefined-functions 234 235 (#:perform #:explain #:output-files #:operation-done-p … … 303 304 #:*compile-file-warnings-behaviour* 304 305 #:*compile-file-failure-behaviour* 305 306 #:*resolve-symlinks* 306 #:* require-asdf-operator*307 #:*load-system-operation* 307 308 #:*asdf-verbose* 308 309 #:*verbose-out* 309 310 … … 362 363 #:user-source-registry-directory 363 364 #:system-source-registry-directory 364 365 365 ;; Utilities 366 ;; Utilities: please use asdf-utils instead 367 #| 366 368 ;; #:aif #:it 367 #:appendf #:orf369 ;; #:appendf #:orf 368 370 #:length=n-p 369 371 #:remove-keys #:remove-keyword 370 #:first-char #:last-char #: ends-with372 #:first-char #:last-char #:string-suffix-p 371 373 #:coerce-name 372 374 #:directory-pathname-p #:ensure-directory-pathname 373 375 #:absolute-pathname-p #:ensure-pathname-absolute #:pathname-root 374 #:getenv #:getenv-pathname #:getenv-pathname 376 #:getenv #:getenv-pathname #:getenv-pathnames 375 377 #:getenv-absolute-directory #:getenv-absolute-directories 376 378 #:probe-file* 377 379 #:find-symbol* #:strcat … … 387 389 #:while-collecting 388 390 #:*wild* #:*wild-file* #:*wild-directory* #:*wild-inferiors* 389 391 #:*wild-path* #:wilden 390 #:directorize-pathname-host-device 392 #:directorize-pathname-host-device|# 391 393 ))) 392 394 #+genera (import 'scl:boolean :asdf) 393 395 (setf *asdf-version* asdf-version … … 419 421 (defparameter +asdf-methods+ 420 422 '(perform-with-restarts perform explain output-files operation-done-p)) 421 423 424 (defvar *load-system-operation* 'load-op 425 "Operation used by ASDF:LOAD-SYSTEM. By default, ASDF:LOAD-OP. 426 You may override it with e.g. ASDF:LOAD-FASL-OP from asdf-bundle, 427 or ASDF:LOAD-SOURCE-OP if your fasl loading is somehow broken.") 428 429 (defvar *compile-op-compile-file-function* 'compile-file* 430 "Function used to compile lisp files.") 431 432 433 422 434 #+allegro 423 435 (eval-when (:compile-toplevel :execute) 424 436 (defparameter *acl-warn-save* … … 450 462 (progn 451 463 (deftype logical-pathname () nil) 452 464 (defun make-broadcast-stream () *error-output*) 465 (defun translate-logical-pathname (x) x) 453 466 (defun file-namestring (p) 454 467 (setf p (pathname p)) 455 468 (format nil "~@[~A~]~@[.~A~]" (pathname-name p) (pathname-type p)))) … … 659 672 ;; Giving :unspecific as argument to make-pathname is not portable. 660 673 ;; See CLHS make-pathname and 19.2.2.2.3. 661 674 ;; We only use it on implementations that support it, 662 #+(or abcl allegro clozure cmu gcl genera lispworks sbcl scl xcl) :unspecific675 #+(or abcl allegro clozure cmu gcl genera lispworks mkcl sbcl scl xcl) :unspecific 663 676 #+(or clisp ecl #|These haven't been tested:|# cormanlisp mcl) nil)) 664 677 (destructuring-bind (name &optional (type unspecific)) 665 678 (split-string filename :max 2 :separator ".") … … 741 754 (let ((value (_getenv name))) 742 755 (unless (ccl:%null-ptr-p value) 743 756 (ccl:%get-cstring value)))) 757 #+mkcl (#.(or (find-symbol* 'getenv :si) (find-symbol* 'getenv :mk-ext)) x) 744 758 #+sbcl (sb-ext:posix-getenv x) 745 #-(or abcl allegro clisp clozure cmu cormanlisp ecl gcl genera lispworks mcl sbcl scl xcl)759 #-(or abcl allegro clisp clozure cmu cormanlisp ecl gcl genera lispworks mcl mkcl sbcl scl xcl) 746 760 (error "~S is not supported on your implementation" 'getenv)) 747 761 748 762 (defun* directory-pathname-p (pathname) … … 849 863 ((zerop i) (return (null l))) 850 864 ((not (consp l)) (return nil))))) 851 865 852 (defun* ends-with(s suffix)866 (defun* string-suffix-p (s suffix) 853 867 (check-type s string) 854 868 (check-type suffix string) 855 869 (let ((start (- (length s) (length suffix)))) … … 877 891 (null nil) 878 892 (string (probe-file* (parse-namestring p))) 879 893 (pathname (unless (wild-pathname-p p) 880 #.(or #+(or allegro clozure cmu cormanlisp ecl lispworks sbcl scl)894 #.(or #+(or allegro clozure cmu cormanlisp ecl lispworks mkcl sbcl scl) 881 895 '(probe-file p) 882 896 #+clisp (aif (find-symbol* '#:probe-pathname :ext) 883 897 `(ignore-errors (,it p))) … … 2450 2464 (funcall (ensure-function hook) thunk) 2451 2465 (funcall thunk)))) 2452 2466 2453 (defvar *compile-op-compile-file-function* 'compile-file*2454 "Function used to compile lisp files.")2455 2456 2467 ;;; perform is required to check output-files to find out where to put 2457 2468 ;;; its answers, in case it has been overridden for site policy 2458 2469 (defmethod perform ((operation compile-op) (c cl-source-file)) 2459 #-:broken-fasl-loader2460 2470 (let ((source-file (component-pathname c)) 2461 2471 ;; on some implementations, there are more than one output-file, 2462 2472 ;; but the first one should always be the primary fasl that gets loaded. … … 2489 2499 2490 2500 (defmethod output-files ((operation compile-op) (c cl-source-file)) 2491 2501 (declare (ignorable operation)) 2492 (let ((p (lispize-pathname (component-pathname c)))) 2493 #-broken-fasl-loader (list (compile-file-pathname p)) 2494 #+broken-fasl-loader (list p))) 2502 (let* ((p (lispize-pathname (component-pathname c))) 2503 (f (compile-file-pathname ;; fasl 2504 p #+mkcl :fasl-p #+mkcl t #+ecl :type #+ecl :fasl)) 2505 #+mkcl (o (compile-file-pathname p :fasl-p nil))) ;; object file 2506 #+ecl (if (use-ecl-byte-compiler-p) 2507 (list f) 2508 (list (compile-file-pathname p :type :object) f)) 2509 #+mkcl (list o f) 2510 #-(or ecl mkcl) (list f))) 2495 2511 2496 2512 (defmethod perform ((operation compile-op) (c static-file)) 2497 2513 (declare (ignorable operation c)) … … 2532 2548 (perform (make-sub-operation c o c 'compile-op) c))))) 2533 2549 2534 2550 (defmethod perform ((o load-op) (c cl-source-file)) 2535 (map () #'load (input-files o c))) 2551 (map () #'load 2552 #-(or ecl mkcl) 2553 (input-files o c) 2554 #+(or ecl mkcl) 2555 (loop :for i :in (input-files o c) 2556 :unless (string= (pathname-type i) "fas") 2557 :collect (compile-file-pathname (lispize-pathname i))))) 2536 2558 2537 2559 (defmethod perform ((operation load-op) (c static-file)) 2538 2560 (declare (ignorable operation c)) … … 2736 2758 (setf (documentation 'operate 'function) 2737 2759 operate-docstring)) 2738 2760 2739 (defun* load-system (system &rest args &key force verbose version &allow-other-keys)2761 (defun* load-system (system &rest keys &key force verbose version &allow-other-keys) 2740 2762 "Shorthand for `(operate 'asdf:load-op system)`. 2741 2763 See OPERATE for details." 2742 2764 (declare (ignore force verbose version)) 2743 (apply 'operate 'load-op system args)2765 (apply 'operate *load-system-operation* system keys) 2744 2766 t) 2745 2767 2746 2768 (defun* load-systems (&rest systems) … … 2752 2774 (defun loaded-systems () 2753 2775 (remove-if-not 'component-loaded-p (registered-systems))) 2754 2776 2755 (defun require-system (s )2756 ( load-system s :force-not (loaded-systems)))2777 (defun require-system (s &rest keys &key &allow-other-keys) 2778 (apply 'load-system s :force-not (loaded-systems) keys)) 2757 2779 2758 2780 (defun* compile-system (system &rest args &key force verbose version 2759 2781 &allow-other-keys) … … 3096 3118 #+mcl 3097 3119 (ccl::with-cstrs ((%command command)) (_system %command)) 3098 3120 3121 #+mkcl 3122 ;; This has next to no chance of working on basic Windows! 3123 ;; Your best hope is that Cygwin or MSYS is somewhere in the PATH. 3124 (multiple-value-bind (io process exit-code) 3125 (apply #'mkcl:run-program #+windows "sh" #-windows "/bin/sh" 3126 (list "-c" command) 3127 :input nil :output t #|*verbose-out*|# ;; will be *verbose-out* when we support it 3128 #-windows '(:search nil)) 3129 (declare (ignore io process)) 3130 exit-code) 3131 3099 3132 #+sbcl 3100 3133 (sb-ext:process-exit-code 3101 3134 (apply 'sb-ext:run-program … … 3107 3140 #+xcl 3108 3141 (ext:run-shell-command command) 3109 3142 3110 #-(or abcl allegro clisp clozure cmu ecl gcl lispworks mcl sbcl scl xcl)3143 #-(or abcl allegro clisp clozure cmu ecl gcl lispworks mcl mkcl sbcl scl xcl) 3111 3144 (error "RUN-SHELL-COMMAND not implemented for this Lisp"))) 3112 3145 3113 3146 #+clisp … … 3197 3230 (defun implementation-type () 3198 3231 (first-feature 3199 3232 '(:abcl (:acl :allegro) (:ccl :clozure) :clisp (:corman :cormanlisp) :cmu 3200 :ecl :gcl (:lw :lispworks) :mcl : sbcl :scl :symbolics :xcl)))3233 :ecl :gcl (:lw :lispworks) :mcl :mkcl :sbcl :scl :symbolics :xcl))) 3201 3234 3202 3235 (defun operating-system () 3203 3236 (first-feature … … 3232 3265 (car ; as opposed to OR, this idiom prevents some unreachable code warning 3233 3266 (list 3234 3267 #+allegro 3235 (format nil "~A~ A~@[~A~]"3268 (format nil "~A~@[~A~]~@[~A~]~@[~A~]" 3236 3269 excl::*common-lisp-version-number* 3237 ;; ANSI vs MoDeRn - thanks to Robert Goldman and Charley Cox3238 ( if (eq excl:*current-case-mode* :case-sensitive-lower) "M" "A")3270 ;; M means "modern", as opposed to ANSI-compatible mode (which I consider default) 3271 (and (eq excl:*current-case-mode* :case-sensitive-lower) "M") 3239 3272 ;; Note if not using International ACL 3240 3273 ;; see http://www.franz.com/support/documentation/8.1/doc/operators/excl/ics-target-case.htm 3241 (excl:ics-target-case (:-ics "8"))) 3274 (excl:ics-target-case (:-ics "8")) 3275 (and (member :smp *features*) "S")) 3242 3276 #+armedbear (format nil "~a-fasl~a" s system::*fasl-version*) 3243 3277 #+clisp 3244 3278 (subseq s 0 (position #\space s)) ; strip build information (date, etc.) … … 3272 3306 3273 3307 (defun* hostname () 3274 3308 ;; Note: untested on RMCL 3275 #+(or abcl clozure cmucl ecl genera lispworks mcl sbcl scl xcl) (machine-instance)3309 #+(or abcl clozure cmucl ecl genera lispworks mcl mkcl sbcl scl xcl) (machine-instance) 3276 3310 #+cormanlisp "localhost" ;; is there a better way? Does it matter? 3277 3311 #+allegro (excl.osi:gethostname) 3278 3312 #+clisp (first (split-string (machine-instance) :separator " ")) … … 3288 3322 (defun* user-homedir () 3289 3323 (truenamize 3290 3324 (pathname-directory-pathname 3325 #+cormanlisp (ensure-directory-pathname (user-homedir-pathname)) 3291 3326 #+mcl (current-user-homedir-pathname) 3292 #- mcl(user-homedir-pathname))))3327 #-(or cormanlisp mcl) (user-homedir-pathname)))) 3293 3328 3294 3329 (defun* ensure-pathname* (x want-absolute want-directory fmt &rest args) 3295 3330 (when (plusp (length x)) … … 3304 3339 (loop :for dir :in (split-string 3305 3340 x :separator (string (inter-directory-separator))) 3306 3341 :collect (apply 'ensure-pathname* dir want-absolute want-directory fmt args))) 3307 (defun getenv-pathname (x &key want-absolute want-directory &aux (s (getenv x)))3342 (defun* getenv-pathname (x &key want-absolute want-directory &aux (s (getenv x))) 3308 3343 (ensure-pathname* s want-absolute want-directory "from (getenv ~S)" x)) 3309 (defun getenv-pathnames (x &key want-absolute want-directory &aux (s (getenv x)))3344 (defun* getenv-pathnames (x &key want-absolute want-directory &aux (s (getenv x))) 3310 3345 (and (plusp (length s)) 3311 3346 (split-pathnames* s want-absolute want-directory "from (getenv ~S) = ~S" x s))) 3312 (defun getenv-absolute-directory (x)3347 (defun* getenv-absolute-directory (x) 3313 3348 (getenv-pathname x :want-absolute t :want-directory t)) 3314 (defun getenv-absolute-directories (x)3349 (defun* getenv-absolute-directories (x) 3315 3350 (getenv-pathnames x :want-absolute t :want-directory t)) 3316 3351 3352 (defun* get-folder-path (folder) 3353 (or ;; this semi-portably implements a subset of the functionality of lispworks' sys:get-folder-path 3354 #+(and lispworks mswindows) (sys:get-folder-path folder) 3355 ;; read-windows-registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\AppData 3356 (ecase folder 3357 (:local-appdata (getenv-absolute-directory "LOCALAPPDATA")) 3358 (:appdata (getenv-absolute-directory "APPDATA")) 3359 (:common-appdata (or (getenv-absolute-directory "ALLUSERSAPPDATA") 3360 (subpathname* (getenv-absolute-directory "ALLUSERSPROFILE") "Application Data/")))))) 3317 3361 3318 3362 (defun* user-configuration-directories () 3319 3363 (let ((dirs … … 3323 3367 (loop :for dir :in (getenv-absolute-directories "XDG_CONFIG_DIRS") 3324 3368 :collect (subpathname* dir "common-lisp/")))) 3325 3369 ,@(when (os-windows-p) 3326 `(,(subpathname* (or #+lispworks (sys:get-folder-path :local-appdata) 3327 (getenv-absolute-directory "LOCALAPPDATA")) 3328 "common-lisp/config/") 3329 ;; read-windows-registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\AppData 3330 ,(subpathname* (or #+lispworks (sys:get-folder-path :appdata) 3331 (getenv-absolute-directory "APPDATA")) 3332 "common-lisp/config/"))) 3370 `(,(subpathname* (get-folder-path :local-appdata) "common-lisp/config/") 3371 ,(subpathname* (get-folder-path :appdata) "common-lisp/config/"))) 3333 3372 ,(subpathname (user-homedir) ".config/common-lisp/")))) 3334 3373 (remove-duplicates (remove-if-not #'absolute-pathname-p dirs) 3335 3374 :from-end t :test 'equal))) … … 3340 3379 ((os-windows-p) 3341 3380 (aif 3342 3381 ;; read-windows-registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Common AppData 3343 (subpathname* (or #+lispworks (sys:get-folder-path :common-appdata) 3344 (getenv-absolute-directory "ALLUSERSAPPDATA") 3345 (subpathname* (getenv-absolute-directory "ALLUSERSPROFILE") "Application Data/")) 3346 "common-lisp/config/") 3382 (subpathname* (get-folder-path :common-appdata) "common-lisp/config/") 3347 3383 (list it))))) 3348 3384 3349 3385 (defun* in-first-directory (dirs x &key (direction :input)) … … 3468 3504 (or 3469 3505 (try (getenv-absolute-directory "XDG_CACHE_HOME") "common-lisp" :implementation) 3470 3506 (when (os-windows-p) 3471 (try (or #+lispworks (sys:get-folder-path :local-appdata) 3472 (getenv-absolute-directory "LOCALAPPDATA") 3473 #+lispworks (sys:get-folder-path :appdata) 3474 (getenv-absolute-directory "APPDATA")) 3507 (try (or (get-folder-path :local-appdata) 3508 (get-folder-path :appdata)) 3475 3509 "common-lisp" "cache" :implementation)) 3476 3510 '(:home ".cache" "common-lisp" :implementation)))) 3477 3511 … … 3698 3732 #+sbcl ,(let ((h (getenv-pathname "SBCL_HOME" :want-directory t))) 3699 3733 (when h `((,(truenamize h) ,*wild-inferiors*) ()))) 3700 3734 ;; The below two are not needed: no precompiled ASDF system there 3701 #+ecl (,(translate-logical-pathname "SYS:**;*.*") ()) 3735 #+(or ecl mkcl) (,(translate-logical-pathname "SYS:**;*.*") ()) 3736 #+mkcl (,(translate-logical-pathname "CONTRIB:") ()) 3702 3737 ;; #+clozure ,(ignore-errors (list (wilden (let ((*default-pathname-defaults* #p"")) (truename #p"ccl:"))) ())) 3703 3738 ;; All-import, here is where we want user stuff to be: 3704 3739 :inherit-configuration … … 3875 3910 (if (absolute-pathname-p output-file) 3876 3911 ;; what cfp should be doing, w/ mp* instead of mp 3877 3912 (let* ((type (pathname-type (apply 'compile-file-pathname "x.lisp" keys))) 3878 (defaults (make-pathname3879 :type type :defaults (merge-pathnames* input-file))))3880 (merge-pathnames* output-file defaults))3913 (defaults (make-pathname 3914 :type type :defaults (merge-pathnames* input-file)))) 3915 (merge-pathnames* output-file defaults)) 3881 3916 (apply-output-translations 3882 (apply 'compile-file-pathname input-file keys)))) 3917 (apply 'compile-file-pathname input-file 3918 (if output-file keys (remove-keyword :output-file keys)))))) 3883 3919 3884 3920 (defun* tmpize-pathname (x) 3885 3921 (make-pathname … … 3954 3990 (default-toplevel-directory 3955 3991 (subpathname (user-homedir) ".fasls/")) ;; Use ".cache/common-lisp/" instead ??? 3956 3992 (include-per-user-information nil) 3957 (map-all-source-files (or #+(or ecl clisp) t nil))3993 (map-all-source-files (or #+(or clisp ecl mkcl) t nil)) 3958 3994 (source-to-target-mappings nil)) 3959 #+(or ecl clisp)3995 #+(or clisp ecl mkcl) 3960 3996 (when (null map-all-source-files) 3961 (error "asdf:enable-asdf-binary-locations-compatibility doesn't support :map-all-source-files nil on ECL and CLISP"))3997 (error "asdf:enable-asdf-binary-locations-compatibility doesn't support :map-all-source-files nil on CLISP, ECL and MKCL")) 3962 3998 (let* ((fasl-type (pathname-type (compile-file-pathname "foo.lisp"))) 3963 3999 (mapped-files (if map-all-source-files *wild-file* 3964 4000 (make-pathname :type fasl-type :defaults *wild-file*))) … … 4161 4197 string)) 4162 4198 (setf inherit t) 4163 4199 (push ':inherit-configuration directives)) 4164 (( ends-withs "//") ;; TODO: allow for doubling of separator even outside Unix?4200 ((string-suffix-p s "//") ;; TODO: allow for doubling of separator even outside Unix? 4165 4201 (push `(:tree ,(check (subseq s 0 (- (length s) 2)))) directives)) 4166 4202 (t 4167 4203 (push `(:directory ,(check s)) directives)))) … … 4192 4228 4193 4229 (defun* wrapping-source-registry () 4194 4230 `(:source-registry 4231 #+ecl (:tree ,(translate-logical-pathname "SYS:")) 4232 #+mkcl (:tree ,(translate-logical-pathname "CONTRIB:")) 4195 4233 #+sbcl (:tree ,(truenamize (getenv-pathname "SBCL_HOME" :want-directory t))) 4196 4234 :inherit-configuration 4197 4235 #+cmu (:tree #p"modules:") … … 4200 4238 `(:source-registry 4201 4239 #+sbcl (:directory ,(subpathname (user-homedir) ".sbcl/systems/")) 4202 4240 (:directory ,(default-directory)) 4203 ,@(loop :for dir :in 4204 `(,@(when (os-unix-p) 4205 `(,(or (getenv-absolute-directory "XDG_DATA_HOME") 4206 (subpathname (user-homedir) ".local/share/")) 4207 ,@(or (getenv-absolute-directories "XDG_DATA_DIRS") 4208 '("/usr/local/share" "/usr/share")))) 4209 ,@(when (os-windows-p) 4210 `(,(or #+lispworks (sys:get-folder-path :local-appdata) 4211 (getenv-absolute-directory "LOCALAPPDATA")) 4212 ,(or #+lispworks (sys:get-folder-path :appdata) 4213 (getenv-absolute-directory "APPDATA")) 4214 ,(or #+lispworks (sys:get-folder-path :common-appdata) 4215 (getenv-absolute-directory "ALLUSERSAPPDATA") 4216 (subpathname* (getenv-absolute-directory "ALLUSERSPROFILE") "Application Data/"))))) 4217 :collect `(:directory ,(subpathname* dir "common-lisp/systems/")) 4218 :collect `(:tree ,(subpathname* dir "common-lisp/source/"))) 4219 :inherit-configuration)) 4241 ,@(loop :for dir :in 4242 `(,@(when (os-unix-p) 4243 `(,(or (getenv-absolute-directory "XDG_DATA_HOME") 4244 (subpathname (user-homedir) ".local/share/")) 4245 ,@(or (getenv-absolute-directories "XDG_DATA_DIRS") 4246 '("/usr/local/share" "/usr/share")))) 4247 ,@(when (os-windows-p) 4248 (mapcar 'get-folder-path '(:local-appdata :appdata :common-appdata)))) 4249 :collect `(:directory ,(subpathname* dir "common-lisp/systems/")) 4250 :collect `(:tree ,(subpathname* dir "common-lisp/source/"))) 4251 :inherit-configuration)) 4220 4252 (defun* user-source-registry (&key (direction :input)) 4221 4253 (in-user-configuration-directory *source-registry-file* :direction direction)) 4222 4254 (defun* system-source-registry (&key (direction :input)) … … 4362 4394 (clear-output-translations)) 4363 4395 4364 4396 4365 ;;; ECL support for COMPILE-OP / LOAD-OP4397 ;;; ECL and MKCL support for COMPILE-OP / LOAD-OP 4366 4398 ;;; 4367 ;;; In ECL , these operations produce both FASL files and the4368 ;;; object files that they are built from. Having both of them allows4369 ;;; us to later on reuse the object files for bundles, libraries,4370 ;;; standalone executables, etc.4399 ;;; In ECL and MKCL, these operations produce both 4400 ;;; FASL files and the object files that they are built from. 4401 ;;; Having both of them allows us to later on reuse the object files 4402 ;;; for bundles, libraries, standalone executables, etc. 4371 4403 ;;; 4372 4404 ;;; This has to be in asdf.lisp and not asdf-ecl.lisp, or else it becomes 4373 4405 ;;; a problem for asdf on ECL to compile asdf-ecl.lisp after loading asdf.lisp. 4374 4406 ;;; 4375 #+ecl 4407 ;;; Also, register-pre-built-system. 4408 4409 #+(or ecl mkcl) 4376 4410 (progn 4377 (setf *compile-op-compile-file-function* 'ecl-compile-file) 4411 (defun register-pre-built-system (name) 4412 (register-system (make-instance 'system :name (coerce-name name) :source-file nil))) 4378 4413 4379 (defun ecl-compile-file (input-file &rest keys &key &allow-other-keys) 4380 (if (use-ecl-byte-compiler-p) 4381 (apply 'compile-file* input-file keys) 4382 (multiple-value-bind (object-file flags1 flags2) 4383 (apply 'compile-file* input-file :system-p t keys) 4384 (values (and object-file 4385 (c::build-fasl (compile-file-pathname object-file :type :fasl) 4386 :lisp-files (list object-file)) 4387 object-file) 4388 flags1 4389 flags2)))) 4414 #+(or (and ecl win32) (and mkcl windows)) 4415 (unless (assoc "asd" #+ecl ext:*load-hooks* #+mkcl si::*load-hooks* :test 'equal) 4416 (appendf #+ecl ext:*load-hooks* #+mkcl si::*load-hooks* '(("asd" . si::load-source)))) 4390 4417 4391 (defmethod output-files ((operation compile-op) (c cl-source-file)) 4392 (declare (ignorable operation)) 4393 (let* ((p (lispize-pathname (component-pathname c))) 4394 (f (compile-file-pathname p :type :fasl))) 4395 (if (use-ecl-byte-compiler-p) 4396 (list f) 4397 (list (compile-file-pathname p :type :object) f)))) 4418 (setf #+ecl ext:*module-provider-functions* #+mkcl mk-ext::*module-provider-functions* 4419 (loop :for f :in #+ecl ext:*module-provider-functions* 4420 #+mkcl mk-ext::*module-provider-functions* 4421 :unless (eq f 'module-provide-asdf) 4422 :collect #'(lambda (name) 4423 (let ((l (multiple-value-list (funcall f name)))) 4424 (and (first l) (register-pre-built-system (coerce-name name))) 4425 (values-list l))))) 4398 4426 4399 (defmethod perform ((o load-op) (c cl-source-file)) 4400 (map () #'load 4401 (loop :for i :in (input-files o c) 4402 :unless (string= (pathname-type i) "fas") 4403 :collect (compile-file-pathname (lispize-pathname i)))))) 4427 (setf *compile-op-compile-file-function* 'compile-file-keeping-object) 4404 4428 4405 ;;;; ----------------------------------------------------------------- 4406 ;;;; Hook into REQUIRE for ABCL, CLISP, ClozureCL, CMUCL, ECL and SBCL 4429 (defun compile-file-keeping-object (input-file &rest keys &key &allow-other-keys) 4430 (#+ecl if #+ecl (use-ecl-byte-compiler-p) #+ecl (apply 'compile-file* input-file keys) 4431 #+mkcl progn 4432 (multiple-value-bind (object-file flags1 flags2) 4433 (apply 'compile-file* input-file 4434 #+ecl :system-p #+ecl t #+mkcl :fasl-p #+mkcl nil keys) 4435 (values (and object-file 4436 (compiler::build-fasl 4437 (compile-file-pathname object-file 4438 #+ecl :type #+ecl :fasl #+mkcl :fasl-p #+mkcl t) 4439 #+ecl :lisp-files #+mkcl :lisp-object-files (list object-file)) 4440 object-file) 4441 flags1 4442 flags2))))) 4443 4444 ;;;; ----------------------------------------------------------------------- 4445 ;;;; Hook into REQUIRE for ABCL, CLISP, ClozureCL, CMUCL, ECL, MKCL and SBCL 4407 4446 ;;;; 4408 (defvar *require-asdf-operator* 'load-op)4409 4410 4447 (defun* module-provide-asdf (name) 4411 4448 (handler-bind 4412 4449 ((style-warning #'muffle-warning) … … 4418 4455 (let ((*verbose-out* (make-broadcast-stream)) 4419 4456 (system (find-system (string-downcase name) nil))) 4420 4457 (when system 4421 ( operate *require-asdf-operator* system :verbose nil :force-not (loaded-systems))4458 (require-system system :verbose nil) 4422 4459 t)))) 4423 4460 4424 #+(or abcl clisp clozure cmu ecl sbcl)4461 #+(or abcl clisp clozure cmu ecl mkcl sbcl) 4425 4462 (let ((x (and #+clisp (find-symbol* '#:*module-provider-functions* :custom)))) 4426 4463 (when x 4427 4464 (eval `(pushnew 'module-provide-asdf … … 4429 4466 #+clisp ,x 4430 4467 #+clozure ccl:*module-provider-functions* 4431 4468 #+(or cmu ecl) ext:*module-provider-functions* 4469 #+mkcl mk-ext:*module-provider-functions* 4432 4470 #+sbcl sb-ext:*module-provider-functions*)))) 4433 4471 4434 4472 … … 4448 4486 (when *load-verbose* 4449 4487 (asdf-message ";; ASDF, version ~a~%" (asdf-version))) 4450 4488 4489 #+mkcl 4490 (progn 4491 (defvar *loading-asdf-bundle* nil) 4492 (unless *loading-asdf-bundle* 4493 (let ((*central-registry* 4494 (cons (translate-logical-pathname #P"CONTRIB:asdf-bundle;") *central-registry*)) 4495 (*loading-asdf-bundle* t)) 4496 (clear-system :asdf-bundle) ;; we hope to force a reload. 4497 (multiple-value-bind (result bundling-error) 4498 (ignore-errors (asdf:oos 'asdf:load-op :asdf-bundle)) 4499 (unless result 4500 (format *error-output* 4501 "~&;;; ASDF: Failed to load package 'asdf-bundle'!~%;;; ASDF: Reason is: ~A.~%" 4502 bundling-error)))))) 4503 4451 4504 #+allegro 4452 4505 (eval-when (:compile-toplevel :execute) 4453 4506 (when (boundp 'excl:*warn-on-nested-reader-conditionals*) -
README-OpenMCL.txt
1 1 This directory contains various third-party opensourced 2 2 system-building tools. 3 3 4 The code here is current as of February 1, 2005; you may want5 to check the originating project's homepages to see if more recent 6 versions are available.4 The code here is current as of November 11, 2012; 5 you may want to check the originating project's homepages 6 to see if more recent versions are available. 7 7 8 "defsystem.lisp" is part of the clocc project on SourcForge: 9 <http://sourceforge.net/projects/clocc>. It's a "system definition 10 facility" which provides functionality similar to that offered by 11 the Unix "make" program. It was originally written by Mark Kantrowitz 12 and has been maintained and enhanced by many people; I believe that 13 Marco Antoniotti is currently the principal developer. This is 14 version 3.4i of DEFSYSTEM (which is often called "MK-DEFSYSTEM"). 15 Note that, for historical reasons, DEFSYSTEM will try to redefine 16 the CL:REQUIRE function. 8 "asdf.lisp" is Another System Definition Facility and 9 is available as part of its own project on Common-Lisp.net: 10 <http://common-lisp.net/project/asdf/>. 11 It was written by Daniel Barlow and 12 is currently maintained by Francois-Rene Rideau. 13 It hooks into CCL's existing CL:REQUIRE function. 17 14 18 "asdf.lisp" is Another System Definition Facility and is available as 19 part of the cclan project on SourceForge: 20 <http://sourceforge.net/projects/cclan>. It was written by and 21 is maintained by Daniel Barlow. 15 To automatically download libraries, we recommend 16 you use quicklisp <http://www.quicklisp.org/> 17 or clbuild <http://common-lisp.net/project/clbuild/> 22 18 23 "asdf-install" is a library which can be used to download CL packages 24 from the Internet and which uses ASDF to build and install them. It's 25 also part of the cclan project and was originally written (for SBCL) 26 by Dan Barlow. It's since been ported to several other CL 27 implementations; Marco Baringer did the OpenMCL port. 28 29 There's excellent documentation on asdf-install in the asdf-install/doc 30 directory. As that document mentions, asdf-install is designed to use 31 the GnuPG package to validate cryptographic signatures associated with 32 asdf-install-able packages, though it can apparently be configured to 33 work in an environment in which GnuPG is not available. 34 35 Downloading code from publicly-writable Internet sites - without the 36 ability to verify that that code's really what it claims to be and 37 from the author who claims to have provided it - is obviously a 38 dangerous and unwise thing to do. It's strongly recommended that 39 people ensure that GnuPG is installed (and ensure that asdf-install is 40 configured to use it) before using asdf-install to download packages. 41 42 (GnuPG packages for OSX are available from <http://macgpg.sourceforge.net>. 43 Most Linux distributions offer GnuPG through their packaging system; 44 further information on GnuPG is available at <http:///www.gnupg.org>. 45 46 19 "defsystem.lisp" is part of the clocc project on SourceForge: 20 <http://sourceforge.net/projects/clocc>. 21 It's a "system definition facility" that provides functionality 22 similar to that offered by the Unix "make" program. 23 It was originally written by Mark Kantrowitz 24 and has been maintained and enhanced by many people; 25 I believe that Marco Antoniotti was the last maintainer. 26 This is version 3.6i of DEFSYSTEM (which is often called "MK-DEFSYSTEM"). 27 Note that, for historical reasons, 28 DEFSYSTEM will try to redefine the CL:REQUIRE function. -
defsystem.lisp
1 1 ;;; -*- Mode: Lisp; Package: make -*- 2 2 ;;; -*- Mode: CLtL; Syntax: Common-Lisp -*- 3 3 4 ;;; DEFSYSTEM 3. 4Interim.4 ;;; DEFSYSTEM 3.6 Interim. 5 5 6 6 ;;; defsystem.lisp -- 7 7 … … 28 28 ;;; Originally written by Mark Kantrowitz, School of Computer Science, 29 29 ;;; Carnegie Mellon University, October 1989. 30 30 31 ;;; MK:DEFSYSTEM 3. 3Interim31 ;;; MK:DEFSYSTEM 3.6 Interim 32 32 ;;; 33 33 ;;; Copyright (c) 1989 - 1999 Mark Kantrowitz. All rights reserved. 34 ;;; 1999 - 200 4Mark Kantrowitz and Marco Antoniotti. All34 ;;; 1999 - 2005 Mark Kantrowitz and Marco Antoniotti. All 35 35 ;;; rights reserved. 36 36 37 37 ;;; Use, copying, modification, merging, publishing, distribution … … 835 835 ;;; ******************************** 836 836 ;;; Let's be smart about CLtL2 compatible Lisps: 837 837 (eval-when (compile load eval) 838 #+(or (and allegro-version>= (version>= 4 0)) :mcl : openmcl :sbcl)838 #+(or (and allegro-version>= (version>= 4 0)) :mcl :sbcl) 839 839 (pushnew :cltl2 *features*)) 840 840 841 841 ;;; ******************************** … … 864 864 #-(or :CMU 865 865 :vms 866 866 :mcl 867 :openmcl868 867 :lispworks 869 868 :clisp 870 869 :gcl … … 1013 1012 1014 1013 #+:lispworks 1015 1014 (defpackage "MAKE" (:nicknames "MK") (:use "COMMON-LISP") 1016 (:import-from system*modules* provide require)1015 (:import-from "SYSTEM" *modules* provide require) 1017 1016 (:export "DEFSYSTEM" "COMPILE-SYSTEM" "LOAD-SYSTEM" 1018 1017 "DEFINE-LANGUAGE" "*MULTIPLE-LISP-SUPPORT*")) 1019 1018 … … 1108 1107 ;;; then a succeeding export as well. 1109 1108 1110 1109 (eval-when (compile load eval) 1111 (defvar *special-exports* nil)1112 (defvar *exports* nil)1113 (defvar *other-exports* nil)1110 (defvar *special-exports* nil) 1111 (defvar *exports* nil) 1112 (defvar *other-exports* nil) 1114 1113 1115 (export (setq *exports*1116 '(operate-on-system1117 oos1118 afs-binary-directory afs-source-directory1119 files-in-system)))1120 (export (setq *special-exports*1121 '()))1122 (export (setq *other-exports*1123 '(*central-registry*1124 *bin-subdir*1114 (export (setq *exports* 1115 '(operate-on-system 1116 oos 1117 afs-binary-directory afs-source-directory 1118 files-in-system))) 1119 (export (setq *special-exports* 1120 '())) 1121 (export (setq *other-exports* 1122 '(*central-registry* 1123 *bin-subdir* 1125 1124 1126 add-registry-location 1127 find-system 1128 defsystem compile-system load-system hardcopy-system 1125 add-registry-location 1126 list-central-registry-directories 1127 print-central-registry-directories 1128 find-system 1129 defsystem compile-system load-system hardcopy-system 1129 1130 1130 system-definition-pathname1131 system-definition-pathname 1131 1132 1132 missing-component1133 missing-component-name1134 missing-component-component1135 missing-module1136 missing-system1133 missing-component 1134 missing-component-name 1135 missing-component-component 1136 missing-module 1137 missing-system 1137 1138 1138 register-foreign-system1139 register-foreign-system 1139 1140 1140 machine-type-translation 1141 software-type-translation 1142 compiler-type-translation 1143 ;; require 1144 define-language 1145 allegro-make-system-fasl 1146 files-which-need-compilation 1147 undefsystem 1148 defined-systems 1149 describe-system clean-system edit-system ;hardcopy-system 1150 system-source-size make-system-tag-table 1151 *defsystem-version* 1152 *compile-during-load* 1153 *minimal-load* 1154 *dont-redefine-require* 1155 *files-missing-is-an-error* 1156 *reload-systems-from-disk* 1157 *source-pathname-default* 1158 *binary-pathname-default* 1159 *multiple-lisp-support* 1160 )))) 1141 machine-type-translation 1142 software-type-translation 1143 compiler-type-translation 1144 ;; require 1145 define-language 1146 allegro-make-system-fasl 1147 files-which-need-compilation 1148 undefsystem 1149 defined-systems 1150 describe-system clean-system edit-system ;hardcopy-system 1151 system-source-size make-system-tag-table 1152 *defsystem-version* 1153 *compile-during-load* 1154 *minimal-load* 1155 *dont-redefine-require* 1156 *files-missing-is-an-error* 1157 *reload-systems-from-disk* 1158 *source-pathname-default* 1159 *binary-pathname-default* 1160 *multiple-lisp-support* 1161 1161 1162 run-unix-program 1163 *default-shell* 1164 run-shell-command 1165 ))) 1166 ) 1162 1167 1168 1163 1169 ;;; We import these symbols into the USER package to make them 1164 1170 ;;; easier to use. Since some lisps have already defined defsystem 1165 1171 ;;; in the user package, we may have to shadowing-import it. … … 1184 1190 (pushnew :pcl *modules*) 1185 1191 (pushnew :pcl *features*)) 1186 1192 1193 1187 1194 ;;; ******************************** 1188 1195 ;;; Defsystem Version ************** 1189 1196 ;;; ******************************** 1190 (defparameter *defsystem-version* "3. 3 Interim, 2002-06-13"1191 "Current version number/date for Defsystem.")1197 (defparameter *defsystem-version* "3.6 Interim, 2008-12-18" 1198 "Current version number/date for MK:DEFSYSTEM.") 1192 1199 1200 1193 1201 ;;; ******************************** 1194 1202 ;;; Customizable System Parameters * 1195 1203 ;;; ******************************** 1196 1204 1197 (defvar *dont-redefine-require* nil 1198 "If T, prevents the redefinition of REQUIRE. This is useful for 1199 lisps that treat REQUIRE specially in the compiler.") 1205 (defvar *dont-redefine-require* 1206 #+cmu (if (find-symbol "*MODULE-PROVIDER-FUNCTIONS*" "EXT") t nil) 1207 #+(or clisp sbcl) t 1208 #+allegro t 1209 #-(or cmu sbcl clisp allegro) nil 1210 "If T, prevents the redefinition of REQUIRE. 1211 This is useful for lisps that treat REQUIRE specially in the compiler.") 1200 1212 1213 1201 1214 (defvar *multiple-lisp-support* t 1202 1215 "If T, afs-binary-directory will try to return a name dependent 1203 on the particular lisp compiler version being used.")1216 on the particular lisp compiler version being used.") 1204 1217 1218 1205 1219 ;;; home-subdirectory -- 1206 1220 ;;; HOME-SUBDIRECTORY is used only in *central-registry* below. 1207 1221 ;;; Note that CMU CL 17e does not understand the ~/ shorthand for home … … 1213 1227 ;;; it is UNIX dependent. 1214 1228 ;;; I added the kludgy #+cormalisp (v 1.5) one, since it is missing 1215 1229 ;;; the ANSI USER-HOMEDIR-PATHNAME function. 1230 1216 1231 #-cormanlisp 1217 1232 (defun home-subdirectory (directory) 1218 1233 (concatenate 'string … … 1224 1239 "~/")) 1225 1240 directory)) 1226 1241 1242 1227 1243 #+cormanlisp 1228 1244 (defun home-subdirectory (directory) 1229 1245 (declare (type string directory)) 1230 1246 (concatenate 'string "C:\\" directory)) 1231 1247 1248 1232 1249 ;;; The following function is available for users to add 1233 1250 ;;; (setq mk:*central-registry* (defsys-env-search-path)) 1234 1251 ;;; to Lisp init files in order to use the value of the DEFSYSPATH 1235 1252 ;;; instead of directly coding it in the file. 1253 1236 1254 #+:allegro 1237 1255 (defun defsys-env-search-path () 1238 1256 "This function grabs the value of the DEFSYSPATH environment variable … … 1240 1258 (remove-duplicates (split-string (sys:getenv "DEFSYSPATH") :item #\:) 1241 1259 :test #'string-equal)) 1242 1260 1261 1243 1262 ;;; Change this variable to set up the location of a central 1244 1263 ;;; repository for system definitions if you want one. 1245 1264 ;;; This is a defvar to allow users to change the value in their … … 1255 1274 #+:LUCID (working-directory) 1256 1275 #+ACLPC (current-directory) 1257 1276 #+:allegro (excl:current-directory) 1277 #+:clisp (ext:default-directory) 1258 1278 #+:sbcl (progn *default-pathname-defaults*) 1259 1279 #+(or :cmu :scl) (ext:default-directory) 1260 1280 ;; *** Marco Antoniotti <marcoxa@icsi.berkeley.edu> 1261 1281 ;; Somehow it is better to qualify default-directory in CMU with 1262 1282 ;; the appropriate package (i.e. "EXTENSIONS".) 1263 1283 ;; Same for Allegro. 1264 #+(and :lispworks (not :lispworks4) )1284 #+(and :lispworks (not :lispworks4) (not :lispworks5)) 1265 1285 ,(multiple-value-bind (major minor) 1266 1286 #-:lispworks-personal-edition 1267 1287 (system::lispworks-version) … … 1277 1297 (find-package "SYSTEM"))) 1278 1298 (find-symbol "*CURRENT-WORKING-DIRECTORY*" 1279 1299 (find-package "LW")))) 1280 #+ :lispworks41300 #+(or :lispworks4 :lispworks5) 1281 1301 (hcl:get-working-directory) 1282 1302 ;; Home directory 1283 1303 #-sbcl 1284 1304 (mk::home-subdirectory "lisp/systems/") 1285 1305 1286 1306 ;; Global registry 1287 "/usr/local/lisp/Registry/") 1288 "Central directory of system definitions. May be either a single 1289 directory pathname, or a list of directory pathnames to be checked 1290 after the local directory.") 1307 #+unix (pathname "/usr/local/lisp/Registry/") 1308 ) 1309 "Central directory of system definitions. 1310 May be either a single directory pathname, or a list of directory 1311 pathnames to be checked after the local directory.") 1291 1312 1292 1313 1293 1314 (defun add-registry-location (pathname) 1294 1315 "Adds a path to the central registry." 1295 1316 (pushnew pathname *central-registry* :test #'equal)) 1296 1317 1318 1319 (defun registry-pathname (registry) 1320 "Return the pathname represented by the element of *CENTRAL-REGISTRY*." 1321 (typecase registry 1322 (string (pathname registry)) 1323 (pathname registry) 1324 (otherwise (pathname (eval registry))))) 1325 1326 1327 (defun print-central-registry-directories (&optional (stream *standard-output*)) 1328 (dolist (registry *central-registry*) 1329 (print (registry-pathname registry) stream))) 1330 1331 1332 (defun list-central-registry-directories () 1333 (mapcar #'registry-pathname *central-registry*)) 1334 1335 1297 1336 (defvar *bin-subdir* ".bin/" 1298 1337 "The subdirectory of an AFS directory where the binaries are really kept.") 1299 1338 1339 1300 1340 ;;; These variables set up defaults for operate-on-system, and are used 1301 1341 ;;; for communication in lieu of parameter passing. Yes, this is bad, 1302 1342 ;;; but it keeps the interface small. Also, in the case of the -if-no-binary 1303 1343 ;;; variables, parameter passing would require multiple value returns 1304 1344 ;;; from some functions. Why make life complicated? 1345 1305 1346 (defvar *tell-user-when-done* nil 1306 1347 "If T, system will print ...DONE at the end of an operation") 1348 1307 1349 (defvar *oos-verbose* nil 1308 1350 "Operate on System Verbose Mode") 1351 1309 1352 (defvar *oos-test* nil 1310 1353 "Operate on System Test Mode") 1354 1311 1355 (defvar *load-source-if-no-binary* nil 1312 1356 "If T, system will try loading the source if the binary is missing") 1357 1313 1358 (defvar *bother-user-if-no-binary* t 1314 1359 "If T, the system will ask the user whether to load the source if 1315 1360 the binary is missing") 1361 1316 1362 (defvar *load-source-instead-of-binary* nil 1317 1363 "If T, the system will load the source file instead of the binary.") 1364 1318 1365 (defvar *compile-during-load* :query 1319 1366 "If T, the system will compile source files during load if the 1320 binary file is missing. If :query, it will ask the user for 1321 permission first.") 1367 binary file is missing. If :query, it will ask the user for 1368 permission first.") 1369 1322 1370 (defvar *minimal-load* nil 1323 1371 "If T, the system tries to avoid reloading files that were already loaded 1324 and up to date.")1372 and up to date.") 1325 1373 1326 1374 (defvar *files-missing-is-an-error* t 1327 1375 "If both the source and binary files are missing, signal a continuable … … 1333 1381 or by another defsystem form.") 1334 1382 1335 1383 ;;; Particular to CMULisp 1384 1336 1385 (defvar *compile-error-file-type* "err" 1337 1386 "File type of compilation error file in cmulisp") 1387 1338 1388 (defvar *cmu-errors-to-terminal* t 1339 1389 "Argument to :errors-to-terminal in compile-file in cmulisp") 1390 1340 1391 (defvar *cmu-errors-to-file* t 1341 1392 "If T, cmulisp will write an error file during compilation") 1342 1393 1394 1343 1395 ;;; ******************************** 1344 1396 ;;; Global Variables *************** 1345 1397 ;;; ******************************** … … 1356 1408 (pushnew :ibm-rt-pc *features*)) 1357 1409 ) 1358 1410 1411 1359 1412 ;;; *filename-extensions* is a cons of the source and binary extensions. 1360 1413 (defvar *filename-extensions* 1361 1414 (car `(#+(and Symbolics Lispm) ("lisp" . "bin") 1362 1415 #+(and dec common vax (not ultrix)) ("LSP" . "FAS") 1363 1416 #+(and dec common vax ultrix) ("lsp" . "fas") 1364 1417 #+ACLPC ("lsp" . "fsl") 1365 #+CLISP ("l sp". "fas")1418 #+CLISP ("lisp" . "fas") 1366 1419 #+KCL ("lsp" . "o") 1367 #+ECL ("lsp" . "so")1420 ;;#+ECL ("lsp" . "so") 1368 1421 #+IBCL ("lsp" . "o") 1369 1422 #+Xerox ("lisp" . "dfasl") 1370 1423 ;; Lucid on Silicon Graphics … … 1402 1455 1403 1456 ;; Otherwise, 1404 1457 ("lisp" . ,(pathname-type (compile-file-pathname "foo.lisp"))))) 1405 "Filename extensions for Common Lisp. A cons of the form 1406 (Source-Extension . Binary-Extension). If the system is 1407 unknown (as in *features* not known), defaults to lisp and fasl.") 1458 "Filename extensions for Common Lisp. 1459 A cons of the form (Source-Extension . Binary-Extension). If the 1460 system is unknown (as in *features* not known), defaults to lisp and 1461 fasl.") 1408 1462 1409 1463 (defvar *system-extension* 1410 1464 ;; MS-DOS systems can only handle three character extensions. … … 1412 1466 #+ACLPC "sys" 1413 1467 "The filename extension to use with systems.") 1414 1468 1469 1415 1470 ;;; The above variables and code should be extended to allow a list of 1416 1471 ;;; valid extensions for each lisp implementation, instead of a single 1417 1472 ;;; extension. When writing a file, the first extension should be used. … … 1428 1483 ;;; Note that in any event, the toplevel system (defined with defsystem) 1429 1484 ;;; will have its dependencies delayed. Not having dependencies delayed 1430 1485 ;;; might be useful if we define several systems within one defsystem. 1486 1431 1487 (defvar *system-dependencies-delayed* t 1432 1488 "If T, system dependencies are expanded at run time") 1433 1489 1490 1434 1491 ;;; Replace this with consp, dammit! 1435 1492 (defun non-empty-listp (list) 1436 1493 (and list (listp list))) 1437 1494 1495 1438 1496 ;;; ******************************** 1439 1497 ;;; Component Operation Definition * 1440 1498 ;;; ******************************** 1441 1499 (eval-when (:compile-toplevel :load-toplevel :execute) 1500 1442 1501 (defvar *version-dir* nil 1443 1502 "The version subdir. bound in operate-on-system.") 1503 1444 1504 (defvar *version-replace* nil 1445 1505 "The version replace. bound in operate-on-system.") 1506 1446 1507 (defvar *version* nil 1447 1508 "Default version.")) 1448 1509 1449 1510 (defvar *component-operations* (make-hash-table :test #'equal) 1450 1511 "Hash table of (operation-name function) pairs.") 1512 1451 1513 (defun component-operation (name &optional operation) 1452 1514 (if operation 1453 1515 (setf (gethash name *component-operations*) operation) 1454 1516 (gethash name *component-operations*))) 1455 1517 1518 1456 1519 ;;; ******************************** 1457 1520 ;;; AFS @sys immitator ************* 1458 1521 ;;; ******************************** … … 1470 1533 (declare (ignore char arg)) 1471 1534 `(afs-binary-directory ,(read stream t nil t))))) 1472 1535 1536 1473 1537 (defvar *find-irix-version-script* 1474 1538 "\"1,4 d\\ 1475 1539 s/^[^M]*IRIX Execution Environment 1, *[a-zA-Z]* *\\([^ ]*\\)/\\1/p\\ 1476 1540 /./,$ d\\ 1477 1541 \"") 1478 1542 1543 1479 1544 (defun operating-system-version () 1480 1545 #+(and :sgi :excl) 1481 1546 (let* ((full-version (software-version)) … … 1517 1582 #-(or (and :excl :sgi) (and :cmu :sgi) (and :lispworks :irix)) 1518 1583 (software-type)) 1519 1584 1585 1520 1586 (defun compiler-version () 1521 1587 #+:lispworks (concatenate 'string 1522 1588 "lispworks" " " (lisp-implementation-version)) … … 1544 1610 #+gclisp "gclisp" 1545 1611 ) 1546 1612 1613 1547 1614 (defun afs-binary-directory (root-directory) 1548 1615 ;; Function for obtaining the directory AFS's @sys feature would have 1549 1616 ;; chosen when we're not in AFS. This function is useful as the argument … … 1582 1649 root-directory 1583 1650 (and version-flag (translate-version *version*)))) 1584 1651 1652 1585 1653 (defun null-string (s) 1586 1654 (when (stringp s) 1587 1655 (string-equal s ""))) 1588 1656 1657 1589 1658 (defun ensure-trailing-slash (dir) 1590 1659 (if (and dir 1591 1660 (not (null-string dir)) … … 1599 1668 (concatenate 'string dir "/") 1600 1669 dir)) 1601 1670 1671 1602 1672 (defun afs-component (machine software &optional lisp) 1603 1673 (format nil "~@[~A~]~@[_~A~]~@[_~A~]" 1604 1674 machine 1605 1675 (or software "mach") 1606 1676 lisp)) 1607 1677 1678 1608 1679 (defvar *machine-type-alist* (make-hash-table :test #'equal) 1609 1680 "Hash table for retrieving the machine-type") 1681 1610 1682 (defun machine-type-translation (name &optional operation) 1611 1683 (if operation 1612 1684 (setf (gethash (string-upcase name) *machine-type-alist*) operation) 1613 1685 (gethash (string-upcase name) *machine-type-alist*))) 1614 1686 1687 1615 1688 (machine-type-translation "IBM RT PC" "rt") 1616 1689 (machine-type-translation "DEC 3100" "pmax") 1617 1690 (machine-type-translation "DEC VAX-11" "vax") … … 1652 1725 1653 1726 (defvar *software-type-alist* (make-hash-table :test #'equal) 1654 1727 "Hash table for retrieving the software-type") 1728 1655 1729 (defun software-type-translation (name &optional operation) 1656 1730 (if operation 1657 1731 (setf (gethash (string-upcase name) *software-type-alist*) operation) 1658 1732 (gethash (string-upcase name) *software-type-alist*))) 1659 1733 1734 1660 1735 (software-type-translation "BSD UNIX" "mach") ; "unix" 1661 1736 (software-type-translation "Ultrix" "mach") ; "ultrix" 1662 1737 (software-type-translation "SunOS" "SunOS") … … 1684 1759 #+:lcl4.0 "4.0" 1685 1760 #+(and :lcl3.0 (not :lcl4.0)) "3.0") 1686 1761 1762 1687 1763 (defvar *compiler-type-alist* (make-hash-table :test #'equal) 1688 1764 "Hash table for retrieving the Common Lisp type") 1765 1689 1766 (defun compiler-type-translation (name &optional operation) 1690 1767 (if operation 1691 1768 (setf (gethash (string-upcase name) *compiler-type-alist*) operation) 1692 1769 (gethash (string-upcase name) *compiler-type-alist*))) 1693 1770 1771 1694 1772 (compiler-type-translation "lispworks 3.2.1" "lispworks") 1695 1773 (compiler-type-translation "lispworks 3.2.60 beta 6" "lispworks") 1696 1774 (compiler-type-translation "lispworks 4.2.0" "lispworks") 1697 1775 1776 1698 1777 #+allegro 1699 1778 (eval-when (:compile-toplevel :load-toplevel :execute) 1700 1779 (unless (or (find :case-sensitive common-lisp:*features*) … … 1721 1800 (compiler-type-translation "cmu 17e" "cmu") 1722 1801 (compiler-type-translation "cmu 17d" "cmu") 1723 1802 1803 1724 1804 ;;; ******************************** 1725 1805 ;;; System Names ******************* 1726 1806 ;;; ******************************** 1727 1807 1728 1808 ;;; If you use strings for system names, be sure to use the same case 1729 1809 ;;; as it appears on disk, if the filesystem is case sensitive. 1810 1730 1811 (defun canonicalize-system-name (name) 1731 1812 ;; Originally we were storing systems using GET. This meant that the 1732 1813 ;; name of a system had to be a symbol, so we interned the symbols … … 1739 1820 (intern (string-upcase (string name)) "KEYWORD"))||# 1740 1821 (if (stringp name) (string-upcase name) (string-upcase (string name)))) 1741 1822 1823 1742 1824 (defvar *defined-systems* (make-hash-table :test #'equal) 1743 1825 "Hash table containing the definitions of all known systems.") 1744 1826 1827 1745 1828 (defun get-system (name) 1746 1829 "Returns the definition of the system named NAME." 1747 1830 (gethash (canonicalize-system-name name) *defined-systems*)) 1748 1831 1832 1749 1833 (defsetf get-system (name) (value) 1750 1834 `(setf (gethash (canonicalize-system-name ,name) *defined-systems*) ,value)) 1751 1835 1836 1752 1837 (defun undefsystem (name) 1753 1838 "Removes the definition of the system named NAME." 1754 ( setf (get-system name) nil))1839 (remhash (canonicalize-system-name name) *defined-systems*)) 1755 1840 1841 1756 1842 (defun defined-systems () 1757 1843 "Returns a list of defined systems." 1758 1844 (let ((result nil)) … … 1762 1848 *defined-systems*) 1763 1849 result)) 1764 1850 1851 1852 (defun defined-names-and-systems () 1853 "Returns a a-list of defined systems along with their names." 1854 (loop for sname being the hash-keys of *defined-systems* 1855 using (hash-value s) 1856 collect (cons sname s))) 1857 1858 1765 1859 ;;; ******************************** 1766 1860 ;;; Directory Pathname Hacking ***** 1767 1861 ;;; ******************************** … … 1826 1920 (rel-directory (directory-to-list (pathname-directory rel-dir))) 1827 1921 (rel-keyword (when (keywordp (car rel-directory)) 1828 1922 (pop rel-directory))) 1829 #-(or :MCL :sbcl :clisp) (rel-file (file-namestring rel-dir)) 1923 ;; rtoy: Why should any Lisp want rel-file? Shouldn't using 1924 ;; rel-name and rel-type work for every Lisp? 1925 #-(or :MCL :sbcl :clisp :cmu) (rel-file (file-namestring rel-dir)) 1830 1926 ;; Stig (July 2001); 1831 1927 ;; These values seems to help clisp as well 1832 #+(or :MCL :sbcl :clisp ) (rel-name (pathname-name rel-dir))1833 #+(or :MCL :sbcl :clisp ) (rel-type (pathname-type rel-dir))1928 #+(or :MCL :sbcl :clisp :cmu) (rel-name (pathname-name rel-dir)) 1929 #+(or :MCL :sbcl :clisp :cmu) (rel-type (pathname-type rel-dir)) 1834 1930 (directory nil)) 1835 1931 1836 1932 ;; TI Common Lisp pathnames can return garbage for file names because … … 1883 1979 :directory 1884 1980 directory 1885 1981 :name 1886 #-(or :sbcl :MCL :clisp ) rel-file1887 #+(or :sbcl :MCL :clisp ) rel-name1982 #-(or :sbcl :MCL :clisp :cmu) rel-file 1983 #+(or :sbcl :MCL :clisp :cmu) rel-name 1888 1984 1889 #+(or :sbcl :MCL :clisp ) :type1890 #+(or :sbcl :MCL :clisp ) rel-type1985 #+(or :sbcl :MCL :clisp :cmu) :type 1986 #+(or :sbcl :MCL :clisp :cmu) rel-type 1891 1987 )))) 1892 1988 1989 1893 1990 (defun directory-to-list (directory) 1894 1991 ;; The directory should be a list, but nonstandard implementations have 1895 1992 ;; been known to use a vector or even a string. … … 1930 2027 nil "/baz/barf.lisp" 1931 2028 nil nil)) 1932 2029 2030 1933 2031 (defun test-new-append-directories (&optional (test-dirs *append-dirs-tests*)) 1934 2032 (do* ((dir-list test-dirs (cddr dir-list)) 1935 2033 (abs-dir (car dir-list) (car dir-list)) … … 1938 2036 (format t "~&ABS: ~S ~18TREL: ~S ~41TResult: ~S" 1939 2037 abs-dir rel-dir (new-append-directories abs-dir rel-dir)))) 1940 2038 2039 1941 2040 #|| 1942 2041 <cl> (test-new-append-directories) 1943 2042 … … 2001 2100 #-(or :VMS :macl1.3.2) 2002 2101 (new-append-directories absolute-directory relative-directory))))) 2003 2102 2103 2004 2104 #+:logical-pathnames-mk 2005 2105 (defun append-logical-directories-mk (absolute-dir relative-dir) 2006 2106 (lp:append-logical-directories absolute-dir relative-dir)) … … 2026 2126 (translate-logical-pathname 2027 2127 (merge-pathnames relative-dir absolute-dir))) 2028 2128 2129 2029 2130 #| Old version 2002-03-02 2030 2131 #+(and (and allegro-version>= (version>= 4 1)) 2031 2132 (not :logical-pathnames-mk)) … … 2113 2214 (pathname-logical-p namestring)) 2114 2215 ||# 2115 2216 2217 2218 #|| This is incorrect, as it strives to keep strings around, when it 2219 shouldn't. MERGE-PATHNAMES already DTRT. 2116 2220 (defun append-logical-pnames (absolute relative) 2117 2221 (declare (type (or null string pathname) absolute relative)) 2118 2222 (let ((abs (if absolute … … 2129 2233 (setq abs (concatenate 'string abs ";"))) 2130 2234 ;; Return the concatenate pathnames 2131 2235 (concatenate 'string abs rel))) 2236 ||# 2132 2237 2238 2239 (defun append-logical-pnames (absolute relative) 2240 (declare (type (or null string pathname) absolute relative)) 2241 (let ((abs (if absolute 2242 (pathname absolute) 2243 (make-pathname :directory (list :absolute) 2244 :name nil 2245 :type nil) 2246 )) 2247 (rel (if relative 2248 (pathname relative) 2249 (make-pathname :directory (list :relative) 2250 :name nil 2251 :type nil) 2252 )) 2253 ) 2254 ;; The following is messed up because CMUCL and LW use different 2255 ;; defaults for host (in particular LW uses NIL). Thus 2256 ;; MERGE-PATHNAMES has legitimate different behaviors on both 2257 ;; implementations. Of course this is disgusting, but that is the 2258 ;; way it is and the rest tries to circumvent this crap. 2259 (etypecase abs 2260 (logical-pathname 2261 (etypecase rel 2262 (logical-pathname 2263 (namestring (merge-pathnames rel abs))) 2264 (pathname 2265 ;; The following potentially translates the logical pathname 2266 ;; very early, but we cannot avoid it. 2267 (namestring (merge-pathnames rel (translate-logical-pathname abs)))) 2268 )) 2269 (pathname 2270 (namestring (merge-pathnames rel abs))) 2271 ))) 2272 2133 2273 #|| 2134 2274 ;;; This was a try at appending a subdirectory onto a directory. 2135 2275 ;;; It failed. We're keeping this around to prevent future mistakes … … 2210 2350 ;;; ******************************** 2211 2351 ;;; Component Defstruct ************ 2212 2352 ;;; ******************************** 2353 2213 2354 (defvar *source-pathname-default* nil 2214 2355 "Default value of :source-pathname keyword in DEFSYSTEM. Set this to 2215 2356 \"\" to avoid having to type :source-pathname \"\" all the time.") … … 2217 2358 (defvar *binary-pathname-default* nil 2218 2359 "Default value of :binary-pathname keyword in DEFSYSTEM.") 2219 2360 2220 ;;; Removed TIME slot, which has been made unnecessary by the new definition2221 ;;; of topological-sort.2222 2361 2223 2362 (defstruct (topological-sort-node (:conc-name topsort-)) 2224 2363 (color :white :type (member :gray :black :white)) 2225 ;; time2226 2364 ) 2227 2365 2366 2367 (defparameter *component-evaluated-slots* 2368 '(:source-root-dir :source-pathname :source-extension 2369 :binary-root-dir :binary-pathname :binary-extension)) 2370 2371 2372 (defparameter *component-form-slots* 2373 '(:initially-do :finally-do :compile-form :load-form)) 2374 2375 2228 2376 (defstruct (component (:include topological-sort-node) 2229 2377 (:print-function print-component)) 2230 2378 (type :file ; to pacify the CMUCL compiler (:type is alway supplied) … … 2283 2431 ; one. 2284 2432 proclamations ; Compiler options, such as 2285 2433 ; '(optimize (safety 3)). 2286 initially-do; Form to evaluate before the2434 (initially-do (lambda () nil)) ; Form to evaluate before the 2287 2435 ; operation. 2288 finally-do; Form to evaluate after the operation.2289 compile-form; For foreign libraries.2290 load-form; For foreign libraries.2436 (finally-do (lambda () nil)) ; Form to evaluate after the operation. 2437 (compile-form (lambda () nil)) ; For foreign libraries. 2438 (load-form (lambda () nil)) ; For foreign libraries. 2291 2439 2292 2440 ;; load-time ; The file-write-date of the 2293 2441 ; binary/source file loaded. … … 2313 2461 (banner nil :type (or null string)) 2314 2462 2315 2463 (documentation nil :type (or null string)) ; Optional documentation slot 2464 (long-documentation nil :type (or null string)) ; Optional long documentation slot 2465 2466 ;; Added AUTHOR, MAINTAINER, VERSION and LICENCE slots. 2467 (author nil :type (or null string)) 2468 (licence nil :type (or null string)) 2469 (maintainer nil :type (or null string)) 2470 (version nil :type (or null string)) 2471 2472 ;; Added NON-REQUIRED-P slot. Useful for optional items. 2473 (non-required-p nil :type boolean) ; If T a missing file or 2474 ; sub-directory will not cause 2475 ; an error. 2316 2476 ) 2317 2477 2318 2478 … … 2340 2500 (component :reader missing-component-component 2341 2501 :initarg :component) 2342 2502 ) 2343 (:default-initargs :component nil)2503 #-gcl (:default-initargs :component nil) 2344 2504 (:report (lambda (mmc stream) 2345 2505 (format stream "MK:DEFSYSTEM: missing component ~S for ~S." 2346 2506 (missing-component-name mmc) … … 2366 2526 2367 2527 2368 2528 (defvar *file-load-time-table* (make-hash-table :test #'equal) 2369 "Hash table of file-write-dates for the system definitions and 2370 files in the system definitions.") 2529 "Hash table of file-write-dates for the system definitions and files in the system definitions.") 2530 2531 2371 2532 (defun component-load-time (component) 2372 2533 (when component 2373 2534 (etypecase component … … 2445 2606 ;;; compute-system-path -- 2446 2607 2447 2608 (defun compute-system-path (module-name definition-pname) 2448 (let* ((file-pathname 2449 (make-pathname :name (etypecase module-name 2450 (symbol (string-downcase 2451 (string module-name))) 2452 (string module-name)) 2609 (let* ((module-string-name 2610 (etypecase module-name 2611 (symbol (string-downcase 2612 (string module-name))) 2613 (string module-name))) 2614 2615 (file-pathname 2616 (make-pathname :name module-string-name 2453 2617 :type *system-extension*)) 2618 2454 2619 (lib-file-pathname 2455 (make-pathname :directory (list :relative module-name) 2456 :name (etypecase module-name 2457 (symbol (string-downcase 2458 (string module-name))) 2459 (string module-name)) 2620 (make-pathname :directory (list :relative module-string-name) 2621 :name module-string-name 2460 2622 :type *system-extension*)) 2461 2623 ) 2462 2624 (or (when definition-pname ; given pathname for system def … … 2466 2628 (cond (*central-registry* 2467 2629 (if (listp *central-registry*) 2468 2630 (dolist (registry *central-registry*) 2469 (let ((file (or (probe-file 2470 (append-directories (if (consp registry) 2471 (eval registry) 2472 registry) 2473 file-pathname)) 2474 (probe-file 2475 (append-directories (if (consp registry) 2476 (eval registry) 2477 registry) 2478 lib-file-pathname)) 2479 )) 2480 ) 2631 (let* ((reg-path (registry-pathname registry)) 2632 (file (or (probe-file 2633 (append-directories 2634 reg-path file-pathname)) 2635 (probe-file 2636 (append-directories 2637 reg-path lib-file-pathname))))) 2481 2638 (when file (return file)))) 2482 2639 (or (probe-file (append-directories *central-registry* 2483 2640 file-pathname)) … … 2497 2654 (let ((system (ignore-errors (find-system system-name :error)))) 2498 2655 (if system 2499 2656 (let ((system-def-pathname 2500 (make-pathname :type "system" 2501 :defaults (pathname (component-full-pathname system :source)))) 2657 (make-pathname 2658 :type "system" 2659 :defaults (pathname (component-full-pathname system :source)))) 2502 2660 ) 2503 2661 (values system-def-pathname 2504 2662 (probe-file system-def-pathname))) 2505 2663 (values nil nil)))) 2506 2507 2508 2664 2509 2665 2666 2667 2510 2668 #| 2511 2669 2512 (defun compute-system-path (module-name definition-pname)2670 (defun compute-system-path (module-name definition-pname) 2513 2671 (let* ((filename (format nil "~A.~A" 2514 2672 (if (symbolp module-name) 2515 2673 (string-downcase (string module-name)) … … 2523 2681 (if (listp *central-registry*) 2524 2682 (dolist (registry *central-registry*) 2525 2683 (let ((file (probe-file 2526 (append-directories (if (consp registry) 2527 (eval registry) 2528 registry) 2529 filename)))) 2684 (append-directories 2685 (registry-pathname registry) filename)))) 2530 2686 (when file (return file)))) 2531 2687 (probe-file (append-directories *central-registry* 2532 2688 filename)))) … … 2563 2719 (error 'missing-system :name system-name))) 2564 2720 (:load-or-nil 2565 2721 (let ((system (get-system system-name))) 2722 ;; (break "System ~S ~S." system-name system) 2566 2723 (or (unless *reload-systems-from-disk* system) 2567 2724 ;; If SYSTEM-NAME is a symbol, it will lowercase the 2568 2725 ;; symbol's string. … … 2570 2727 ;; string. So if case matters in the filename, use strings, not 2571 2728 ;; symbols, wherever the system is named. 2572 2729 (when (foreign-system-p system) 2573 (warn "Foreign system ~S cannot be reloaded by MK:DEFSYSTEM." system) 2730 (warn "Foreign system ~S cannot be reloaded by MK:DEFSYSTEM." 2731 system) 2574 2732 (return-from find-system nil)) 2575 2733 (let ((path (compute-system-path system-name definition-pname))) 2576 2734 (when (and path … … 2592 2750 (:load 2593 2751 (or (unless *reload-systems-from-disk* (get-system system-name)) 2594 2752 (when (foreign-system-p (get-system system-name)) 2595 (warn "Foreign system ~S cannot be reloaded by MK:DEFSYSTEM." system-name) 2753 (warn "Foreign system ~S cannot be reloaded by MK:DEFSYSTEM." 2754 (get-system system-name)) 2596 2755 (return-from find-system nil)) 2597 2756 (or (find-system system-name :load-or-nil definition-pname) 2598 2757 (error "Can't find system named ~s." system-name)))))) … … 2616 2775 ~@[~& Package: ~A~]~ 2617 2776 ~& Source: ~@[~A~] ~@[~A~] ~@[~A~]~ 2618 2777 ~& Binary: ~@[~A~] ~@[~A~] ~@[~A~]~ 2619 ~@[~& Depends On: ~A ~]~& Components: ~{~15T~A~&~}"2778 ~@[~& Depends On: ~A ~]~& Components:~{~15T~A~&~}" 2620 2779 (component-type system) 2621 2780 (component-name system) 2622 2781 (component-host system) … … 2635 2794 (describe-system component stream recursive)))||# 2636 2795 system)) 2637 2796 2797 2638 2798 (defun canonicalize-component-name (component) 2639 2799 ;; Within the component, the name is a string. 2640 2800 (if (typep (component-name component) 'string) … … 2646 2806 (setf (component-name component) 2647 2807 (string-downcase (string (component-name component)))))) 2648 2808 2809 2649 2810 (defun component-pathname (component type) 2650 2811 (when component 2651 2812 (ecase type 2652 2813 (:source (component-source-pathname component)) 2653 2814 (:binary (component-binary-pathname component)) 2654 2815 (:error (component-error-pathname component))))) 2816 2817 2655 2818 (defun component-error-pathname (component) 2656 2819 (let ((binary (component-pathname component :binary))) 2657 2820 (new-file-type binary *compile-error-file-type*))) 2821 2658 2822 (defsetf component-pathname (component type) (value) 2659 2823 `(when ,component 2660 2824 (ecase ,type 2661 2825 (:source (setf (component-source-pathname ,component) ,value)) 2662 2826 (:binary (setf (component-binary-pathname ,component) ,value))))) 2663 2827 2828 2664 2829 (defun component-root-dir (component type) 2665 2830 (when component 2666 2831 (ecase type 2667 2832 (:source (component-source-root-dir component)) 2668 2833 ((:binary :error) (component-binary-root-dir component)) 2669 2834 ))) 2835 2670 2836 (defsetf component-root-dir (component type) (value) 2671 2837 `(when ,component 2672 2838 (ecase ,type 2673 2839 (:source (setf (component-source-root-dir ,component) ,value)) 2674 2840 (:binary (setf (component-binary-root-dir ,component) ,value))))) 2675 2841 2842 2676 2843 (defvar *source-pathnames-table* (make-hash-table :test #'equal) 2677 2844 "Table which maps from components to full source pathnames.") 2845 2846 2678 2847 (defvar *binary-pathnames-table* (make-hash-table :test #'equal) 2679 2848 "Table which maps from components to full binary pathnames.") 2849 2850 2680 2851 (defparameter *reset-full-pathname-table* t 2681 "If T, clears the full-pathname tables before each call to 2682 OPERATE-ON-SYSTEM. Setting this to NIL may yield faster performance 2683 after multiple calls to LOAD-SYSTEM and COMPILE-SYSTEM, but could 2684 result in changes to system and language definitions to not take 2685 effect, and so should be used with caution.") 2852 "If T, clears the full-pathname tables before each call to OPERATE-ON-SYSTEM. 2853 Setting this to NIL may yield faster performance after multiple calls 2854 to LOAD-SYSTEM and COMPILE-SYSTEM, but could result in changes to 2855 system and language definitions to not take effect, and so should be 2856 used with caution.") 2857 2858 2686 2859 (defun clear-full-pathname-tables () 2687 2860 (clrhash *source-pathnames-table*) 2688 2861 (clrhash *binary-pathnames-table*)) 2689 2862 2863 2690 2864 (defun component-full-pathname (component type &optional (version *version*)) 2691 2865 (when component 2692 2866 (case type … … 2705 2879 (otherwise 2706 2880 (component-full-pathname-i component type version))))) 2707 2881 2708 (defun component-full-pathname-i (component type &optional (version *version*) 2882 2883 (defun component-full-pathname-i (component type 2884 &optional (version *version*) 2709 2885 &aux version-dir version-replace) 2710 2886 ;; If the pathname-type is :binary and the root pathname is null, 2711 2887 ;; distribute the binaries among the sources (= use :source pathname). … … 2715 2891 (multiple-value-setq (version-dir version-replace) 2716 2892 (translate-version version)) 2717 2893 (setq version-dir *version-dir* version-replace *version-replace*)) 2894 ;; (format *trace-output* "~&>>>> VERSION COMPUTED ~S ~S~%" version-dir version-replace) 2718 2895 (let ((pathname 2719 2896 (append-directories 2720 2897 (if version-replace … … 2740 2917 ;; :name argument to the MAKE-PATHNAME in the MERGE-PATHNAMES 2741 2918 ;; beacuse of possible null names (e.g. :defsystem components) 2742 2919 ;; causing problems with the subsequenct call to NAMESTRING. 2920 ;; (format *trace-output* "~&>>>> PATHNAME is ~S~%" pathname) 2921 2922 ;; 20050309 Marco Antoniotti 2923 ;; The treatment of PATHNAME-HOST and PATHNAME-DEVICE in the call 2924 ;; to MAKE-PATHNAME in the T branch is bogus. COMPONENT-DEVICE 2925 ;; and COMPONENT-HOST must respect the ANSI definition, hence, 2926 ;; they cannot be PATHNAMEs. The simplification of the code is 2927 ;; useful. SCL compatibility may be broken, but I doubt it will. 2928 2929 ;; 20050310 Marco Antoniotti 2930 ;; After a suggestion by David Tolpin, the code is simplified even 2931 ;; more, and the logic should be now more clear: use the user 2932 ;; supplied pieces of the pathname if non nil. 2933 2934 ;; 20050613 Marco Antoniotti 2935 ;; Added COMPONENT-NAME extraction to :NAME part, in case the 2936 ;; PATHNAME-NAME is NIL. 2937 2743 2938 (cond ((pathname-logical-p pathname) ; See definition of test above. 2744 2939 (setf pathname 2745 2940 (merge-pathnames pathname … … 2747 2942 :name (component-name component) 2748 2943 :type (component-extension component 2749 2944 type)))) 2750 ;;(format t "new path = ~A~%" pathname)2751 2945 (namestring (translate-logical-pathname pathname))) 2752 2946 (t 2753 2947 (namestring 2754 (make-pathname :host (when (component-host component) 2755 ;; MCL2.0b1 and ACLPC cause an error on 2756 ;; (pathname-host nil) 2757 (pathname-host (component-host component) 2758 #+scl :case #+scl :common 2759 )) 2948 (make-pathname :host (or (component-host component) 2949 (pathname-host pathname)) 2950 2760 2951 :directory (pathname-directory pathname 2761 #+scl :case #+scl :common 2762 ) 2763 ;; Use :directory instead of :defaults 2764 :name (pathname-name pathname 2765 #+scl :case #+scl :common 2766 ) 2767 :type #-scl (component-extension component type) 2768 #+scl (string-upcase 2769 (component-extension component type)) 2952 #+scl :case 2953 #+scl :common 2954 ) 2955 2956 :name (or (pathname-name pathname 2957 #+scl :case 2958 #+scl :common 2959 ) 2960 (component-name component)) 2961 2962 :type 2963 #-scl (component-extension component type) 2964 #+scl (string-upcase 2965 (component-extension component type)) 2966 2770 2967 :device 2771 2968 #+sbcl 2772 2969 :unspecific 2773 2970 #-(or :sbcl) 2774 (let ((dev (component-device component))) 2775 (if dev 2776 (pathname-device dev 2777 #+scl :case #+scl :common 2778 ) 2779 (pathname-device pathname 2780 #+scl :case #+scl :common 2781 ))) 2971 (or (component-device component) 2972 (pathname-device pathname 2973 #+scl :case 2974 #+scl :common 2975 )) 2782 2976 ;; :version :newest 2783 2977 )))))) 2784 2978 2785 ;;; What about CMU17 :device :unspecific in the above?2786 2979 2980 #-lispworks 2787 2981 (defun translate-version (version) 2788 2982 ;; Value returns the version directory and whether it replaces 2789 2983 ;; the entire root (t) or is a subdirectory. … … 2803 2997 (values version t)) 2804 2998 (t (error "~&; Illegal version ~S" version)))) 2805 2999 3000 3001 ;;; Looks like LW has a bug in MERGE-PATHNAMES. 3002 ;;; 3003 ;;; (merge-pathnames "" "LP:foo;bar;") ==> "LP:" 3004 ;;; 3005 ;;; Which is incorrect. 3006 ;;; The change here ensures that the result of TRANSLATE-VERSION is 3007 ;;; appropriate. 3008 3009 #+lispworks 3010 (defun translate-version (version) 3011 ;; Value returns the version directory and whether it replaces 3012 ;; the entire root (t) or is a subdirectory. 3013 ;; Version may be nil to signify no subdirectory, 3014 ;; a symbol, such as alpha, beta, omega, :alpha, mark, which 3015 ;; specifies a subdirectory of the root, or 3016 ;; a string, which replaces the root. 3017 (cond ((null version) 3018 (values (pathname "") nil)) 3019 ((symbolp version) 3020 (values (let ((sversion (string version))) 3021 (if (find-if #'lower-case-p sversion) 3022 (pathname sversion) 3023 (pathname (string-downcase sversion)))) 3024 nil)) 3025 ((stringp version) 3026 (values (pathname version) t)) 3027 (t (error "~&; Illegal version ~S" version)))) 3028 3029 2806 3030 (defun component-extension (component type &key local) 2807 3031 (ecase type 2808 3032 (:source (or (component-source-extension component) 2809 3033 (unless local 2810 (default-source-extension component)))) ; system default 3034 (default-source-extension component)) ; system default 3035 ;; (and (component-language component)) 3036 )) 2811 3037 (:binary (or (component-binary-extension component) 2812 3038 (unless local 2813 (default-binary-extension component)))) ; system default 3039 (default-binary-extension component)) ; system default 3040 ;; (and (component-language component)) 3041 )) 2814 3042 (:error *compile-error-file-type*))) 3043 3044 2815 3045 (defsetf component-extension (component type) (value) 2816 3046 `(ecase ,type 2817 3047 (:source (setf (component-source-extension ,component) ,value)) 2818 3048 (:binary (setf (component-binary-extension ,component) ,value)) 2819 3049 (:error (setf *compile-error-file-type* ,value)))) 2820 3050 3051 2821 3052 ;;; ******************************** 2822 3053 ;;; System Definition ************** 2823 3054 ;;; ******************************** 3055 2824 3056 (defun create-component (type name definition-body &optional parent (indent 0)) 2825 3057 (let ((component (apply #'make-component 2826 3058 :type type 2827 3059 :name name 2828 :indent indent definition-body))) 3060 :indent indent 3061 definition-body))) 2829 3062 ;; Set up :load-only attribute 2830 3063 (unless (find :load-only definition-body) 2831 3064 ;; If the :load-only attribute wasn't specified, … … 2868 3101 2869 3102 ;; Type specific setup: 2870 3103 (when (or (eq type :defsystem) (eq type :system) (eq type :subsystem)) 2871 (setf (get-system name) component)) 3104 (setf (get-system name) component) 3105 #|(unless (component-language component) 3106 (setf (component-language component) :lisp))|#) 2872 3107 2873 3108 ;; Set up the component's pathname 2874 3109 (create-component-pathnames component parent) … … 2891 3126 component)) 2892 3127 2893 3128 3129 ;;; preprocess-component-definition -- 3130 ;;; New function introduced to manipulate the "evaluated" slots as per 3131 ;;; SDS' suggestions. 3132 ;;; 20050824 3133 3134 (defun preprocess-component-definition (definition-body) 3135 `(list* ,@(loop for slot in *component-evaluated-slots* 3136 for value = (getf definition-body slot) 3137 when value 3138 do (remf definition-body slot) 3139 and nconc `(,slot ,value)) 3140 ,@(loop for slot in *component-form-slots* 3141 for form = (getf definition-body slot) 3142 do (remf definition-body slot) 3143 nconc `(,slot (lambda () ,form))) 3144 ',definition-body)) 3145 3146 2894 3147 ;;; defsystem -- 2895 3148 ;;; The main macro. 2896 3149 ;;; … … 2905 3158 (unless (find :source-pathname definition-body) 2906 3159 (setf definition-body 2907 3160 (list* :source-pathname 2908 '(when *load-pathname* 2909 (make-pathname :name nil 2910 :type nil 2911 :defaults *load-pathname*)) 3161 '(when #-gcl *load-pathname* #+gcl si::*load-pathname* 3162 (make-pathname :name nil 3163 :type nil 3164 :defaults 3165 #-gcl *load-pathname* 3166 #+gcl si::*load-pathname* 3167 )) 2912 3168 definition-body))) 2913 `(create-component :defsystem ',name ',definition-body nil 0)) 3169 `(create-component :defsystem ',name 3170 ,(preprocess-component-definition definition-body) 3171 nil 3172 0)) 2914 3173 3174 2915 3175 (defun create-component-pathnames (component parent) 2916 3176 ;; Set up language-specific defaults 3177 2917 3178 (setf (component-language component) 2918 3179 (or (component-language component) ; for local defaulting 2919 3180 (when parent ; parent's default 2920 3181 (component-language parent)))) 3182 2921 3183 (setf (component-compiler component) 2922 3184 (or (component-compiler component) ; for local defaulting 2923 3185 (when parent ; parent's default … … 2939 3201 (setf (component-pathname component :binary) 2940 3202 (eval (component-pathname component :binary))) 2941 3203 3204 2942 3205 ;; Pass along the host and devices 2943 3206 (setf (component-host component) 2944 3207 (or (component-host component) 2945 (when parent (component-host parent)))) 3208 (when parent (component-host parent)) 3209 (pathname-host *default-pathname-defaults*))) 2946 3210 (setf (component-device component) 2947 3211 (or (component-device component) 2948 3212 (when parent (component-device parent)))) 2949 3213 2950 3214 ;; Set up extension defaults 2951 3215 (setf (component-extension component :source) 2952 (or (component-extension component :source :local t) ; local default 3216 (or (component-extension component :source 3217 :local #| (component-language component) |# 3218 t 3219 ) ; local default 3220 (when (component-language component) 3221 (default-source-extension component)) 2953 3222 (when parent ; parent's default 2954 3223 (component-extension parent :source)))) 2955 3224 (setf (component-extension component :binary) 2956 (or (component-extension component :binary :local t) ; local default 3225 (or (component-extension component :binary 3226 :local #| (component-language component) |# 3227 t 3228 ) ; local default 3229 (when (component-language component) 3230 (default-binary-extension component)) 2957 3231 (when parent ; parent's default 2958 3232 (component-extension parent :binary)))) 2959 3233 … … 2963 3237 (generate-component-pathname component parent :source) 2964 3238 (generate-component-pathname component parent :binary)) 2965 3239 2966 ;; maybe file's inheriting of pathnames should be moved elsewhere? 3240 3241 ;;; generate-component-pathnames -- 3242 ;;; maybe file's inheriting of pathnames should be moved elsewhere? 3243 2967 3244 (defun generate-component-pathname (component parent pathname-type) 2968 3245 ;; Pieces together a pathname for the component based on its component-type. 2969 3246 ;; Assumes source defined first. … … 3010 3287 ;; When the binary-pathname is nil use source. 3011 3288 (component-pathname component :source)) 3012 3289 (or (when (component-pathname component pathname-type) 3013 ;(pathname-name )3290 ;; (pathname-name ) 3014 3291 (component-pathname component pathname-type)) 3015 3292 (component-name component))))) 3016 3293 ((:module :subsystem) ; Pathname relative to parent. … … 3059 3336 indent)) 3060 3337 definitions))))) 3061 3338 ||# 3062 ;; new version 3339 3340 ;;; new version 3063 3341 (defun expand-component-components (component &optional (indent 0)) 3064 3342 (let ((definitions (component-components component))) 3065 3343 (if (eq (car definitions) :serial) … … 3069 3347 (setf (component-components component) 3070 3348 (expand-component-definitions definitions component indent))))) 3071 3349 3350 3072 3351 (defun expand-component-definitions (definitions parent &optional (indent 0)) 3073 3352 (let ((components nil)) 3074 3353 (dolist (definition definitions) … … 3076 3355 (when new (push new components)))) 3077 3356 (nreverse components))) 3078 3357 3358 3079 3359 (defun expand-serial-component-chain (definitions parent &optional (indent 0)) 3080 3360 (let ((previous nil) 3081 3361 (components nil)) … … 3101 3381 recognizes absolute pathnames and treats them as files of type 3102 3382 :private-file instead of type :file. Defaults to NIL, because I 3103 3383 haven't tested this.") 3384 3385 3104 3386 (defun absolute-file-namestring-p (string) 3105 3387 ;; If a FILE namestring starts with a slash, or is a logical pathname 3106 3388 ;; as implied by the existence of a colon in the filename, assume it … … 3109 3391 (and (not (null-string string)) 3110 3392 (char= (char string 0) #\/)))) 3111 3393 3394 3112 3395 (defun expand-component-definition (definition parent &optional (indent 0)) 3113 3396 ;; Should do some checking for malformed definitions here. 3114 3397 (cond ((null definition) nil) … … 3118 3401 (absolute-file-namestring-p definition)) 3119 3402 ;; Special hack for Straz 3120 3403 (create-component :private-file definition nil parent indent) 3121 ;; Normal behavior3122 (create-component :file definition nil parent indent)))3404 ;; Normal behavior 3405 (create-component :file definition nil parent indent))) 3123 3406 ((and (listp definition) 3124 3407 (not (member (car definition) 3125 3408 '(:defsystem :system :subsystem 3126 :module :file :private-file))))3409 :module :file :private-file)))) 3127 3410 ;; Lists whose first element is not a component type 3128 3411 ;; are assumed to be of type :file 3129 3412 (create-component :file 3130 (car definition) 3131 (cdr definition) 3413 (first definition) 3414 ;; (preprocess-component-definition (rest definition)) ; Not working. 3415 (rest definition) 3132 3416 parent 3133 3417 indent)) 3134 3418 ((listp definition) 3135 3419 ;; Otherwise, it is (we hope) a normal form definition 3136 (create-component (car definition) ; type 3137 (cadr definition) ; name 3138 (cddr definition) ; definition body 3420 (create-component (first definition) ; type 3421 (second definition) ; name 3422 3423 ;; definition body 3424 ;; (preprocess-component-definition (cddr definition)) ; Not working. 3425 (cddr definition) 3426 3139 3427 parent ; parent 3140 3428 indent) ; indent 3141 3429 ))) 3142 3430 3431 3143 3432 (defun link-component-depends-on (components) 3144 3433 (dolist (component components) 3145 3434 (unless (and *system-dependencies-delayed* … … 3156 3445 3157 3446 (component-depends-on component)))))) 3158 3447 3448 3159 3449 ;;; ******************************** 3160 3450 ;;; Topological Sort the Graph ***** 3161 3451 ;;; ******************************** … … 3164 3454 ;;; this version avoids the call to sort, in practice it isn't faster. It 3165 3455 ;;; does, however, eliminate the need to have a TIME slot in the 3166 3456 ;;; topological-sort-node defstruct. 3457 3167 3458 (defun topological-sort (list &aux (sorted-list nil)) 3168 3459 (labels ((dfs-visit (znode) 3169 (setf (topsort-color znode) :gray)3170 (unless (and *system-dependencies-delayed*3171 (eq (component-type znode) :system))3172 (dolist (child (component-depends-on znode))3173 (cond ((eq (topsort-color child) :white)3174 (dfs-visit child))3175 ((eq (topsort-color child) :gray)3176 (format t "~&Detected cycle containing ~A" child)))))3177 (setf (topsort-color znode) :black)3178 (push znode sorted-list)))3460 (setf (topsort-color znode) :gray) 3461 (unless (and *system-dependencies-delayed* 3462 (eq (component-type znode) :system)) 3463 (dolist (child (component-depends-on znode)) 3464 (cond ((eq (topsort-color child) :white) 3465 (dfs-visit child)) 3466 ((eq (topsort-color child) :gray) 3467 (format t "~&Detected cycle containing ~A" child))))) 3468 (setf (topsort-color znode) :black) 3469 (push znode sorted-list))) 3179 3470 (dolist (znode list) 3180 3471 (setf (topsort-color znode) :white)) 3181 3472 (dolist (znode list) … … 3230 3521 ;; probably should remove the ",1" entirely. But AKCL 1.243 dies on it 3231 3522 ;; because of an AKCL bug. 3232 3523 ;; KGK suggests using an 8 instead, but 1 does nicely. 3524 3233 3525 (defun prompt-string (component) 3234 3526 (format nil "; ~:[~;TEST:~]~V,1@T " 3235 3527 *oos-test* … … 3265 3557 (format stream "~%~A ~A" prompt content))))))) 3266 3558 (finish-output stream)) 3267 3559 3560 3268 3561 (defun tell-user (what component &optional type no-dots force) 3269 3562 (when (or *oos-verbose* force) 3270 3563 (format-justified-string (prompt-string component) … … 3294 3587 (and *tell-user-when-done* 3295 3588 (not no-dots)))))) 3296 3589 3590 3297 3591 (defun tell-user-done (component &optional force no-dots) 3298 3592 ;; test is no longer really used, but we're leaving it in. 3299 3593 (when (and *tell-user-when-done* … … 3302 3596 (prompt-string component) (not no-dots)) 3303 3597 (finish-output *standard-output*))) 3304 3598 3599 3305 3600 (defmacro with-tell-user ((what component &optional type no-dots force) &body body) 3306 3601 `(progn 3307 3602 (tell-user ,what ,component ,type ,no-dots ,force) 3308 3603 ,@body 3309 3604 (tell-user-done ,component ,force ,no-dots))) 3310 3605 3606 3311 3607 (defun tell-user-no-files (component &optional force) 3312 3608 (when (or *oos-verbose* force) 3313 3609 (format-justified-string (prompt-string component) … … 3317 3613 (or *load-source-if-no-binary* *load-source-instead-of-binary*) 3318 3614 (component-full-pathname component :binary))))) 3319 3615 3616 3320 3617 (defun tell-user-require-system (name parent) 3321 3618 (when *oos-verbose* 3322 3619 (format t "~&; ~:[~;TEST:~] - System ~A requires ~S" 3323 3620 *oos-test* (component-name parent) name) 3324 3621 (finish-output *standard-output*))) 3325 3622 3623 3326 3624 (defun tell-user-generic (string) 3327 3625 (when *oos-verbose* 3328 3626 (format t "~&; ~:[~;TEST:~] - ~A" 3329 3627 *oos-test* string) 3330 3628 (finish-output *standard-output*))) 3331 3629 3630 3332 3631 ;;; ******************************** 3333 3632 ;;; Y-OR-N-P-WAIT ****************** 3334 3633 ;;; ******************************** … … 3353 3652 Lisps, this allows other processes to continue while we busy-wait. If 3354 3653 0, skips call to SLEEP.") 3355 3654 3655 3356 3656 (defun internal-real-time-in-seconds () 3357 3657 (get-universal-time)) 3358 3658 3659 3359 3660 (defun read-char-wait (&optional (timeout 20) input-stream 3360 3661 (eof-error-p t) eof-value 3361 3662 &aux peek) … … 3368 3669 (unless (zerop *sleep-amount*) 3369 3670 (sleep *sleep-amount*)))) 3370 3671 3672 3371 3673 ;;; Lots of lisps, especially those that run on top of UNIX, do not get 3372 3674 ;;; their input one character at a time, but a whole line at a time because 3373 3675 ;;; of the buffering done by the UNIX system. This causes y-or-n-p-wait … … 3422 3724 (y-or-n-p-wait #\y 10 "1? ") 3423 3725 (y-or-n-p-wait #\n 10 "2? ")) 3424 3726 ||# 3727 3728 ;;;=========================================================================== 3729 ;;; Running the operations. 3730 3731 (defvar %%component%% nil) 3732 3733 (export '(%%component%%)) ; Just a placeholder. Move it to the export list. 3734 3735 3736 (defmacro with-special-component-vars ((c) &body forms) 3737 `(let ((%%component%% ,c)) 3738 (declare (special %%component%%)) 3739 ,@forms)) 3740 3741 3425 3742 ;;; ******************************** 3426 3743 ;;; Operate on System ************** 3427 3744 ;;; ******************************** … … 3466 3783 (declare #-(or :cltl2 :ansi-cl) (ignore override-compilation-unit)) 3467 3784 (unwind-protect 3468 3785 ;; Protect the undribble. 3469 (#+( or :cltl2 :ansi-cl) with-compilation-unit3470 #+( or :cltl2 :ansi-cl) (:override override-compilation-unit)3471 #-( or :cltl2 :ansi-cl) progn3786 (#+(and (or :cltl2 :ansi-cl) (not :gcl)) with-compilation-unit 3787 #+(and (or :cltl2 :ansi-cl) (not :gcl)) (:override override-compilation-unit) 3788 #-(and (or :cltl2 :ansi-cl) (not :gcl)) progn 3472 3789 (when *reset-full-pathname-table* (clear-full-pathname-tables)) 3473 3790 (when dribble (dribble dribble)) 3474 3791 (when test (setq verbose t)) … … 3506 3823 (*load-source-instead-of-binary* load-source-instead-of-binary) 3507 3824 (*minimal-load* minimal-load) 3508 3825 (system (if (and (component-p name) 3509 (member (component-type name) '(:system :defsystem :subsystem))) 3826 (member (component-type name) 3827 '(:system :defsystem :subsystem))) 3510 3828 name 3511 3829 (find-system name :load)))) 3512 3830 #-(or CMU CLISP :sbcl :lispworks :cormanlisp scl) … … 3516 3834 #-openmcl (optimize (inhibit-warnings 3))) 3517 3835 (unless (component-operation operation) 3518 3836 (error "Operation ~A undefined." operation)) 3837 3519 3838 (operate-on-component system operation force)))) 3520 3839 (when dribble (dribble)))) 3521 3840 … … 3614 3933 :verbose verbose 3615 3934 :dribble dribble)) 3616 3935 3936 3937 ;;; ensure-external-system-def-loaded component -- 3938 ;;; Let's treat definition clauses of the form 3939 ;;; 3940 ;;; (:system "name") 3941 ;;; i.e. 3942 ;;; 3943 ;;; (:system "name" :components nil) 3944 ;;; 3945 ;;; in a special way. 3946 ;;; When encountered, MK:DEFSYSTEM tries to FIND-SYSTEM 3947 ;;; the system named "name" (by forcing a reload from disk). 3948 ;;; This may be more "natural". 3949 3950 (defun ensure-external-system-def-loaded (component) 3951 (assert (member (component-type component) 3952 '(:subsystem :system))) 3953 (when (null (component-components component)) 3954 (let* ((cname (component-name component))) 3955 (declare (ignorable cname)) 3956 ;; First we ensure that we reload the system definition. 3957 (undefsystem cname) 3958 (let* ((*reload-systems-from-disk* t) 3959 (system-component 3960 (find-system (component-name component) 3961 :load 3962 3963 ;; Let's not supply the def-pname 3964 ;; yet. 3965 #+not-yet 3966 (merge-pathname 3967 (make-pathname :name cname 3968 :type "system" 3969 :directory ()) 3970 (component-full-pathname component 3971 :source)) 3972 3973 3974 )) 3975 ) 3976 ;; Now we have a problem. 3977 ;; We have just ensured that a system definition is 3978 ;; loaded, however, the COMPONENT at hand is different 3979 ;; from SYSTEM-COMPONENT. 3980 ;; To fix this problem we just use the following 3981 ;; kludge. This should prevent re-entering in this 3982 ;; code branch, while actually preparing the COMPONENT 3983 ;; for operation. 3984 (setf (component-components component) 3985 (list system-component)) 3986 )))) 3987 3988 3617 3989 (defun operate-on-component (component operation force &aux changed) 3618 3990 ;; Returns T if something changed and had to be compiled. 3619 3991 (let ((type (component-type component)) … … 3646 4018 (let ((package (find-package (component-package component)))) 3647 4019 (when package 3648 4020 (setf *package* package))))) 3649 #+mk-original 3650 (when (eq type :defsystem) ; maybe :system too? 3651 (operate-on-system-dependencies component operation force)) 4021 4022 ;; Marco Antoniotti 20040609 4023 ;; New feature. Try to FIND-SYSTEM :system components if 4024 ;; they have no local :components definition. 4025 ;; OPERATE-ON-SYSTEM-DEPENDENCIES should still work as 4026 ;; advertised, given the small change made there. 4027 4028 (when (or (eq type :system) (eq type :subsystem)) 4029 (ensure-external-system-def-loaded component)) 4030 3652 4031 (when (or (eq type :defsystem) (eq type :system)) 3653 4032 (operate-on-system-dependencies component operation force)) 3654 4033 … … 3656 4035 (when (component-proclamations component) 3657 4036 (tell-user-generic (format nil "Doing proclamations for ~A" 3658 4037 (component-name component))) 3659 ( or*oos-test*3660 (proclaim (component-proclamations component))))4038 (unless *oos-test* 4039 (proclaim (component-proclamations component)))) 3661 4040 3662 4041 ;; Do any initial actions 3663 4042 (when (component-initially-do component) 3664 4043 (tell-user-generic (format nil "Doing initializations for ~A" 3665 4044 (component-name component))) 3666 (or *oos-test* 3667 (eval (component-initially-do component)))) 4045 (unless *oos-test* 4046 (with-special-component-vars (component) 4047 (let ((initially-do (component-initially-do component))) 4048 (if (functionp initially-do) 4049 (funcall initially-do) 4050 (eval initially-do)))) 4051 )) 3668 4052 3669 4053 ;; If operation is :compile and load-only is T, this would change 3670 4054 ;; the operation to load. Only, this would mean that a module would … … 3692 4076 (when (component-finally-do component) 3693 4077 (tell-user-generic (format nil "Doing finalizations for ~A" 3694 4078 (component-name component))) 3695 (or *oos-test* 3696 (eval (component-finally-do component)))) 4079 (unless *oos-test* 4080 (with-special-component-vars (component) 4081 (let ((finally-do (component-finally-do component))) 4082 (if (functionp finally-do) 4083 (funcall finally-do) 4084 (eval finally-do)))) 4085 )) 3697 4086 3698 4087 ;; add the banner if needed 3699 4088 #+(or cmu scl) … … 3737 4126 ;; to load it (needed since we may be depending on a lisp 3738 4127 ;; dependent package). 3739 4128 ;; Explores the system tree in a DFS manner. 3740 (cond ((and *operations-propagate-to-subsystems*3741 (not (listp system))3742 ;; The subsystem is a defined system.3743 (find-system system :load-or-nil))3744 ;; Call OOS on it. Since *system-dependencies-delayed* is3745 ;; T, the :depends-on slot is filled with the names of3746 ;; systems, not defstructs.3747 ;; Aside from system, operation, force, for everything else3748 ;; we rely on the globals.3749 (unless (and *providing-blocks-load-propagation*3750 ;; If *providing-blocks-load-propagation* is T,3751 ;; the system dependency must not exist in the3752 ;; *modules* for it to be loaded. Note that3753 ;; the dependencies are implicitly systems.3754 (find operation '(load :load))3755 ;; (or (eq force :all) (eq force t))3756 (find (canonicalize-system-name system)3757 *modules* :test #'string-equal))3758 3759 (operate-on-system system operation :force force)))3760 4129 3761 ((listp system) 4130 ;; Do not try to do anything with non system components. 4131 (cond ((and *operations-propagate-to-subsystems* 4132 (not (listp system)) 4133 (or (stringp system) (symbolp system)) 4134 ;; The subsystem is a defined system. 4135 (find-system system :load-or-nil)) 4136 ;; Call OOS on it. Since *system-dependencies-delayed* is 4137 ;; T, the :depends-on slot is filled with the names of 4138 ;; systems, not defstructs. 4139 ;; Aside from system, operation, force, for everything else 4140 ;; we rely on the globals. 4141 (unless (and *providing-blocks-load-propagation* 4142 ;; If *providing-blocks-load-propagation* is T, 4143 ;; the system dependency must not exist in the 4144 ;; *modules* for it to be loaded. Note that 4145 ;; the dependencies are implicitly systems. 4146 (find operation '(load :load)) 4147 ;; (or (eq force :all) (eq force t)) 4148 (find (canonicalize-system-name system) 4149 *modules* :test #'string-equal)) 4150 4151 (operate-on-system system operation :force force))) 4152 4153 ((listp system) 3762 4154 ;; If the SYSTEM is a list then its contents are as follows. 3763 4155 ;; 3764 ;; (<name> <definition-pathname> <action> <version>)4156 ;; (<name> <definition-pathname> <action> &optional <version>) 3765 4157 ;; 3766 (tell-user-require-system3767 (cond ((and (null (first system)) (null (second system)))3768 (third system))3769 (t system))3770 component)3771 (or *oos-test* (new-require (first system)3772 nil3773 (eval (second system))3774 (third system)3775 (or (fourth system)3776 *version*))))3777 (t3778 (tell-user-require-system system component)3779 (or *oos-test* (new-require system))))))))3780 4158 4159 (destructuring-bind (system-name definition-pathname action 4160 &optional version) 4161 system 4162 (tell-user-require-system 4163 (if (and (null system-name) 4164 (null definition-pathname)) 4165 action 4166 system) 4167 component) 4168 (or *oos-test* (new-require system-name 4169 nil 4170 (eval definition-pathname) 4171 action 4172 (or version *version*))))) 4173 ((and (component-p system) 4174 (not (member (component-type system) 4175 '(:defsystem :subsystem :system)))) 4176 ;; Do nothing for non system components. 4177 ) 4178 (t 4179 (tell-user-require-system system component) 4180 (or *oos-test* (new-require system)))) 4181 )))) 4182 3781 4183 ;;; Modules can depend only on siblings. If a module should depend 3782 4184 ;;; on an uncle, then the parent module should depend on that uncle 3783 4185 ;;; instead. Likewise a module should depend on a sibling, not a niece … … 3815 4217 (push module changed))) 3816 4218 (case operation 3817 4219 ((compile :compile) 3818 (eval (component-compile-form component))) 4220 (with-special-component-vars (component) 4221 (let ((compile-form (component-compile-form component))) 4222 (if (functionp compile-form) 4223 (funcall compile-form) 4224 (eval compile-form))))) 3819 4225 ((load :load) 3820 (eval (component-load-form component)))))) 4226 (with-special-component-vars (component) 4227 (let ((load-form (component-load-form component))) 4228 (if (functionp load-form) 4229 (funcall load-form) 4230 (eval load-form))) 4231 ))))) 3821 4232 ;; This is only used as a boolean. 3822 4233 changed) 3823 4234 … … 3847 4258 (version *version*)) 3848 4259 ;; If the pathname is present, this behaves like the old require. 3849 4260 (unless (and module-name 4261 ;; madhu: Allegro cannot coerce pathnames to strings 4262 ;; via (string #p"foo") and module-name turns out to be 4263 ;; a pathname when REQUIRE is used internally to load 4264 ;; internal modules. 4265 #+allegro 4266 (and (pathnamep module-name) 4267 (setq module-name (namestring module-name))) 3850 4268 (find (string module-name) 3851 4269 *modules* :test #'string=)) 3852 4270 (handler-case … … 3880 4298 ||# 3881 4299 (error 'missing-system :name module-name))) 3882 4300 (missing-module (mmc) (signal mmc)) ; Resignal. 4301 ;; madhu 080902 a missing-system is incorrectly signalled when 4302 ;; mk:oos throws an error. 4303 #+nil 3883 4304 (error (e) 3884 4305 (declare (ignore e)) 3885 4306 ;; Signal a (maybe wrong) MISSING-SYSTEM. … … 3910 4331 #+:lispworks 'system:::require 3911 4332 #+(and :excl :allegro-v4.0) 'cltl1:require)) 3912 4333 3913 (let (#+ (or :CCL :openmcl)(ccl:*warn-if-redefine-kernel* nil))4334 (let (#+:CCL (ccl:*warn-if-redefine-kernel* nil)) 3914 4335 ;; Note that lots of lisps barf if we redefine a function from 3915 4336 ;; the LISP package. So what we do is define a macro with an 3916 4337 ;; unused name, and use (setf macro-function) to redefine … … 3937 4358 (unless *old-require* 3938 4359 (setf *old-require* 3939 4360 (symbol-function 3940 #-(or (and :excl :allegro-v4.0) :mcl : openmcl :sbcl :lispworks) 'lisp:require4361 #-(or (and :excl :allegro-v4.0) :mcl :sbcl :lispworks) 'lisp:require 3941 4362 #+(and :excl :allegro-v4.0) 'cltl1:require 3942 4363 #+:sbcl 'cl:require 3943 4364 #+:lispworks3.1 'common-lisp::require … … 3947 4368 )) 3948 4369 3949 4370 (unless *dont-redefine-require* 3950 (let (#+(or :mcl :openmcl(and :CCL (not :lispworks)))4371 (let (#+(or :mcl (and :CCL (not :lispworks))) 3951 4372 (ccl:*warn-if-redefine-kernel* nil)) 3952 4373 #-(or (and allegro-version>= (version>= 4 1)) :lispworks) 3953 4374 (setf (symbol-function 3954 #-(or (and :excl :allegro-v4.0) :mcl : openmcl :sbcl :lispworks) 'lisp:require4375 #-(or (and :excl :allegro-v4.0) :mcl :sbcl :lispworks) 'lisp:require 3955 4376 #+(and :excl :allegro-v4.0) 'cltl1:require 3956 4377 #+:lispworks3.1 'common-lisp::require 3957 4378 #+:sbcl 'cl:require … … 3976 4397 (symbol-function 'new-require)))))) 3977 4398 ) 3978 4399 4400 4401 ;;; Well, let's add some more REQUIRE hacking; specifically for SBCL, 4402 ;;; and, eventually, for CMUCL. 4403 4404 #+sbcl 4405 (eval-when (:compile-toplevel :load-toplevel :execute) 4406 4407 (defun sbcl-mk-defsystem-module-provider (name) 4408 ;; Let's hope things go smoothly. 4409 (let ((module-name (string-downcase (string name)))) 4410 (when (mk:find-system module-name :load-or-nil) 4411 (mk:load-system module-name 4412 :compile-during-load t 4413 :verbose nil)))) 4414 4415 (pushnew 'sbcl-mk-defsystem-module-provider sb-ext:*module-provider-functions*) 4416 ) 4417 4418 #+#.(cl:if (cl:and (cl:find-package "EXT") (cl:find-symbol "*MODULE-PROVIDER-FUNCTIONS*" "EXT")) '(and) '(or)) 4419 (progn 4420 (defun cmucl-mk-defsystem-module-provider (name) 4421 (let ((module-name (string-downcase (string name)))) 4422 (when (mk:find-system module-name :load-or-nil) 4423 (mk:load-system module-name 4424 :compile-during-load t 4425 :verbose nil)))) 4426 4427 (pushnew 'cmucl-mk-defsystem-module-provider ext:*module-provider-functions*) 4428 ) 4429 4430 4431 4432 3979 4433 ;;; ******************************** 3980 4434 ;;; Language-Dependent Characteristics 3981 4435 ;;; ******************************** … … 4106 4560 (error "MK::RUN-UNIX-PROGRAM: this does not seem to be a UN*X system.") 4107 4561 ) 4108 4562 4563 4564 ;;; This is inspired by various versions - all very UNIX/Linux 4565 ;;; dependent - appearing in ASDF and UFFI. The original versions and Copyrights 4566 ;;; are by Dan Barlow, Kevin Rosenberg and many others. 4567 ;;; This version should be more liberal. 4568 4569 (defvar *default-shell* "/bin/sh") 4570 4571 #+(or windows ms-windows win32) 4572 (eval-when (:load-toplevel :execute) 4573 ;; Lets assume a "standard" Cygwin installation. 4574 (if (probe-file (pathname "C:\\cygwin\\bin\\sh.exe")) 4575 (setf *default-shell* "C:\\cygwin\\bin\\sh.exe") 4576 (setf *default-shell* nil))) 4577 4578 4579 (defun run-shell-command (command-control-string 4580 arguments 4581 &key 4582 (output *trace-output*) 4583 (shell *default-shell*) 4584 ) 4585 "Executes a shell 'command' in an underlying process. 4586 RUN-SHELL-COMMAND interpolate ARGS into CONTROL-STRING as if by FORMAT, and 4587 synchronously execute the result using a Bourne-compatible shell, with 4588 output to *trace-output*. Returns the shell's exit code." 4589 4590 (declare (ignorable shell)) 4591 4592 (let ((command (apply #'format nil command-control-string arguments))) 4593 #+sbcl 4594 (sb-impl::process-exit-code 4595 (sb-ext:run-program shell 4596 (list "-c" command) 4597 :input nil 4598 :output output)) 4599 4600 #+(or cmu scl) 4601 (ext:process-exit-code 4602 (ext:run-program shell 4603 (list "-c" command) 4604 :input nil 4605 :output output)) 4606 4607 #+allegro 4608 (excl:run-shell-command command :input nil :output output) 4609 4610 #+(and lispworks win32) 4611 (system:call-system-showing-output (format nil "cmd /c ~A" command) 4612 :output-stream output) 4613 4614 #+(and lispworks (not win32)) 4615 (system:call-system-showing-output command 4616 :shell-type shell 4617 :output-stream output) 4618 4619 #+clisp ;XXX not exactly *trace-output*, I know 4620 (ext:run-shell-command command :output :terminal :wait t) 4621 4622 #+openmcl 4623 (nth-value 1 4624 (ccl:external-process-status 4625 (ccl:run-program shell 4626 (list "-c" command) 4627 :input nil 4628 :output output 4629 :wait t))) 4630 4631 #-(or openmcl clisp lispworks allegro scl cmu sbcl) 4632 (error "RUN-SHELL-PROGRAM not implemented for this Lisp") 4633 )) 4634 4635 4109 4636 #|| 4110 4637 (defun c-compile-file (filename &rest args &key output-file error-file) 4111 4638 ;; gcc -c foo.c -o foo.o … … 4219 4746 fatal-error))))) 4220 4747 4221 4748 4749 ;;; C Language definitions. 4750 4222 4751 (defun c-compile-file (filename &rest args 4223 4752 &key 4224 4753 (output-file t) … … 4278 4807 #+:allegro #'load 4279 4808 #+(or :cmu :scl) #'alien:load-foreign 4280 4809 #+:sbcl #'sb-alien:load-foreign 4281 #+(and :lispworks :unix (not :linux)) #'link-load:read-foreign-modules 4282 #+(and :lispworks (or (not :unix) :linux)) #'fli:register-module 4810 #+(and :lispworks :unix (not :linux) (not :macosx)) #'link-load:read-foreign-modules 4811 #+(and :lispworks :unix (or :linux :macosx)) #'fli:register-module 4812 #+(and :lispworks :win32) #'fli:register-module 4283 4813 #+(or :ecl :gcl :kcl) #'load ; should be enough. 4284 4814 #-(or :lucid 4285 4815 :allegro … … 4297 4827 :source-extension "c" 4298 4828 :binary-extension "o") 4299 4829 4300 #||4301 ;;; FDMM's changes, which we've replaced.4302 (defvar *compile-file-function* #'cl-compile-file)4303 4830 4304 #+(or :clos :pcl) 4305 (defmethod set-language ((lang (eql :common-lisp))) 4306 (setq *compile-file-function* #'cl-compile-file)) 4831 ;;; Fortran Language definitions. 4832 ;;; From Matlisp. 4307 4833 4308 #+(or :clos :pcl) 4309 (defmethod set-language ((lang (eql :scheme))) 4310 (setq *compile-file-function #'scheme-compile-file)) 4311 ||# 4834 (export '(*fortran-compiler* *fortran-options*)) 4312 4835 4836 (defparameter *fortran-compiler* "g77") 4837 (defparameter *fortran-options* '("-O")) 4838 4839 (defun fortran-compile-file (filename &rest args 4840 &key output-file error-file 4841 &allow-other-keys) 4842 (declare (ignore error-file args)) 4843 (let ((arg-list 4844 (append *fortran-options* 4845 `("-c" ,filename ,@(if output-file `("-o" ,output-file)))))) 4846 (run-unix-program *fortran-compiler* arg-list))) 4847 4848 4849 (mk:define-language :fortran 4850 :compiler #'fortran-compile-file 4851 :loader #'identity 4852 :source-extension "f" 4853 :binary-extension "o") 4854 4855 4856 ;;; AR support. 4857 ;; How to create a library (archive) of object files 4858 4859 (export '(*ar-program* build-lib)) 4860 4861 (defparameter *ar-program* "ar") 4862 4863 (defun build-lib (libname directory) 4864 (let ((args (list "rv" (truename libname)))) 4865 (format t ";;; Building archive ~A~%" libname) 4866 (run-unix-program *ar-program* 4867 (append args 4868 (mapcar #'truename (directory directory)))))) 4869 4870 4313 4871 ;;; ******************************** 4314 4872 ;;; Component Operations *********** 4315 4873 ;;; ******************************** 4316 4874 ;;; Define :compile/compile and :load/load operations 4317 (eval-when ( load eval)4875 (eval-when (:load-toplevel :execute) 4318 4876 (component-operation :compile 'compile-and-load-operation) 4319 4877 (component-operation 'compile 'compile-and-load-operation) 4320 4878 (component-operation :load 'load-file-operation) 4321 4879 (component-operation 'load 'load-file-operation) 4322 4880 ) 4323 4881 4882 4324 4883 (defun compile-and-load-operation (component force) 4325 4884 ;; FORCE was CHANGED. this caused defsystem during compilation to only 4326 4885 ;; load files that it immediately compiled. … … 4335 4894 (and (load-file-operation component force) ; FORCE was CHANGED ??? 4336 4895 changed)))) 4337 4896 4897 4338 4898 (defun unmunge-lucid (namestring) 4339 4899 ;; Lucid's implementation of COMPILE-FILE is non-standard, in that 4340 4900 ;; when the :output-file is a relative pathname, it tries to munge … … 4353 4913 ;; Ugly, but seems to fix the problem. 4354 4914 (concatenate 'string "./" namestring)))) 4355 4915 4916 #+gcl 4917 (defun ensure-directories-exist (arg0 &key verbose) 4918 (declare (ignore arg0 verbose)) 4919 ()) 4920 4921 4356 4922 (defun compile-file-operation (component force) 4357 4923 ;; Returns T if the file had to be compiled. 4358 4924 (let ((must-compile … … 4362 4928 (or (find force '(:all :new-source-all t) :test #'eq) 4363 4929 (and (find force '(:new-source :new-source-and-dependents) 4364 4930 :test #'eq) 4365 (needs-compilation component )))))4931 (needs-compilation component nil))))) 4366 4932 (source-pname (component-full-pathname component :source))) 4367 4933 4368 4934 (cond ((and must-compile (probe-file source-pname)) … … 4389 4955 source-pname 4390 4956 :output-file 4391 4957 output-file 4392 #+(or :cmu :scl) :error-file 4393 #+(or :cmu :scl) (and *cmu-errors-to-file* 4394 (component-full-pathname component 4395 :error)) 4396 #+CMU 4958 4959 #+(or :cmu :scl) 4960 :error-file 4961 4962 #+(or :cmu :scl) 4963 (and *cmu-errors-to-file* 4964 (component-full-pathname component :error)) 4965 4966 #+cmu 4397 4967 :error-output 4398 #+ CMU4968 #+cmu 4399 4969 *cmu-errors-to-terminal* 4970 4400 4971 (component-compiler-options component) 4401 4972 )))) 4402 4973 must-compile) … … 4406 4977 nil) 4407 4978 (t nil)))) 4408 4979 4409 (defun needs-compilation (component) 4980 4981 ;;; compiled-file-p -- 4982 ;;; See CLOCC/PORT/sys.lisp:compiled-file-p 4983 4984 (eval-when (:load-toplevel :execute :compile-toplevel) 4985 (when (find-package "PORT") 4986 (import (find-symbol "COMPILED-FILE-P" "PORT")))) 4987 4988 (unless (fboundp 'compiled-file-p) 4989 (defun compiled-file-p (file-name) 4990 "Return T if the FILE-NAME is a filename designator for a valid compiled. 4991 Signal an error when it is not a filename designator. 4992 Return NIL when the file does not exist, or is not readable, 4993 or does not contain valid compiled code." 4994 #+clisp 4995 (with-open-file (in file-name :direction :input :if-does-not-exist nil) 4996 (handler-bind ((error (lambda (c) (declare (ignore c)) 4997 (return-from compiled-file-p nil)))) 4998 (and in (char= #\( (peek-char nil in nil #\a)) 4999 (let ((form (read in nil nil))) 5000 (and (consp form) 5001 (eq (car form) 'SYSTEM::VERSION) 5002 (null (eval form))))))) 5003 #-clisp (declare (ignorable file-name)) 5004 #-clisp t)) 5005 5006 5007 (defun needs-compilation (component force) 4410 5008 ;; If there is no binary, or it is older than the source 4411 5009 ;; file, then the component needs to be compiled. 4412 5010 ;; Otherwise we only need to recompile if it depends on a file that changed. 5011 (declare (ignore force)) 4413 5012 (let ((source-pname (component-full-pathname component :source)) 4414 (binary-pname (component-full-pathname component :binary)))5013 (binary-pname (component-full-pathname component :binary))) 4415 5014 (and 4416 5015 ;; source must exist 4417 5016 (probe-file source-pname) 4418 5017 (or 5018 ;; We force recompilation. 5019 #|(find force '(:all :new-source-all) :test #'eq)|# 4419 5020 ;; no binary 4420 5021 (null (probe-file binary-pname)) 4421 5022 ;; old binary 4422 5023 (< (file-write-date binary-pname) 4423 (file-write-date source-pname)))))) 5024 (file-write-date source-pname)) 5025 ;; invalid binary 5026 (not (compiled-file-p binary-pname)))))) 4424 5027 5028 4425 5029 (defun needs-loading (component &optional (check-source t) (check-binary t)) 4426 5030 ;; Compares the component's load-time against the file-write-date of 4427 5031 ;; the files on disk. … … 4457 5061 ;; needs-compilation has an implicit source-exists in it. 4458 5062 (needs-compilation (if (component-load-only component) 4459 5063 source-needs-loading 4460 (needs-compilation component )))5064 (needs-compilation component force))) 4461 5065 (check-for-new-source 4462 5066 ;; If force is :new-source*, we're checking for files 4463 5067 ;; whose source is newer than the compiled versions. … … 4470 5074 (and load-binary (component-load-only component)) 4471 5075 (and check-for-new-source needs-compilation))) 4472 5076 (compile-and-load 4473 (and needs-compilation (or load-binary check-for-new-source) 4474 (compile-and-load-source-if-no-binary component)))) 5077 (and needs-compilation 5078 (or load-binary check-for-new-source) 5079 (compile-and-load-source-if-no-binary component))) 5080 ) 4475 5081 ;; When we're trying to minimize the files loaded to only those 4476 5082 ;; that need be, restrict the values of load-source and load-binary 4477 5083 ;; so that we only load the component if the files are newer than 4478 5084 ;; the load-time. 4479 (when *minimal-load* 5085 (when (and *minimal-load* 5086 (not (find force '(:all :new-source-all) 5087 :test #'eq))) 4480 5088 (when load-source (setf load-source source-needs-loading)) 4481 5089 (when load-binary (setf load-binary binary-needs-loading))) 4482 5090 … … 4497 5105 (or *load-source-instead-of-binary* 4498 5106 (component-load-only component) 4499 5107 (not *compile-during-load*))) 4500 (and load-binary (not binary-exists) 5108 (and load-binary 5109 (not binary-exists) 4501 5110 (load-source-if-no-binary component)))) 4502 5111 ;; Load the source if the source exists and: 4503 5112 ;; o we're loading binary and it doesn't exist … … 4543 5152 (and (find force '(:new-source :new-source-and-dependents 4544 5153 :new-source-all) 4545 5154 :test #'eq) 4546 (needs-compilation component )))5155 (needs-compilation component nil))) 4547 5156 (let ((binary-pname (component-full-pathname component :binary))) 4548 5157 (when (probe-file binary-pname) 4549 5158 (with-tell-user ("Deleting binary" component :binary) … … 4593 5202 (setq *compile-during-load* 4594 5203 (y-or-n-p-wait 4595 5204 #\y 30 4596 "~A- Should I compile and load or not? "5205 "~A- Should I compile while loading the system? " 4597 5206 prompt))) ; was compile-source, then t 4598 5207 compile-source)) 4599 5208 (*compile-during-load*) … … 4759 5368 (when (setq changed 4760 5369 (or (find force '(:all t) :test #'eq) 4761 5370 (and (not (non-empty-listp force)) 4762 (needs-compilation component ))))5371 (needs-compilation component nil)))) 4763 5372 (setq result 4764 5373 (list component)))) 4765 5374 ((:module :system :subsystem :defsystem) … … 4796 5405 4797 5406 ;;; Should this conditionalization be (or :mcl (and :CCL (not :lispworks)))? 4798 5407 #| 4799 #+:ccl4800 (defun edit-operation (component force)4801 "Always returns nil, i.e. component not changed."4802 (declare (ignore force))4803 ;;4804 (let* ((full-pathname (make::component-full-pathname component :source))4805 (already-editing\? #+:mcl (dolist (w (CCL:windows :class4806 'fred-window))4807 (when (equal (CCL:window-filename w)4808 full-pathname)4809 (return w)))4810 #-:mcl nil))4811 (if already-editing\?4812 #+:mcl (CCL:window-select already-editing\?) #-:mcl nil4813 (ed full-pathname)))4814 nil)5408 #+:ccl 5409 (defun edit-operation (component force) 5410 "Always returns nil, i.e. component not changed." 5411 (declare (ignore force)) 5412 ;; 5413 (let* ((full-pathname (make::component-full-pathname component :source)) 5414 (already-editing\? #+:mcl (dolist (w (CCL:windows :class 5415 'fred-window)) 5416 (when (equal (CCL:window-filename w) 5417 full-pathname) 5418 (return w))) 5419 #-:mcl nil)) 5420 (if already-editing\? 5421 #+:mcl (CCL:window-select already-editing\?) #-:mcl nil 5422 (ed full-pathname))) 5423 nil) 4815 5424 4816 #+:allegro4817 (defun edit-operation (component force)4818 "Edit a component - always returns nil, i.e. component not changed."4819 (declare (ignore force))4820 (let ((full-pathname (component-full-pathname component :source)))4821 (ed full-pathname))4822 nil)5425 #+:allegro 5426 (defun edit-operation (component force) 5427 "Edit a component - always returns nil, i.e. component not changed." 5428 (declare (ignore force)) 5429 (let ((full-pathname (component-full-pathname component :source))) 5430 (ed full-pathname)) 5431 nil) 4823 5432 4824 #+(or :ccl :allegro)4825 (make::component-operation :edit 'edit-operation)4826 #+(or :ccl :allegro)4827 (make::component-operation 'edit 'edit-operation)4828 |#5433 #+(or :ccl :allegro) 5434 (make::component-operation :edit 'edit-operation) 5435 #+(or :ccl :allegro) 5436 (make::component-operation 'edit 'edit-operation) 5437 |# 4829 5438 4830 5439 ;;; *** Hardcopy System *** 4831 5440 (defparameter *print-command* "enscript -2Gr" ; "lpr"
