~ubuntu-branches/ubuntu/wily/cl-asdf/wily-proposed

« back to all changes in this revision

Viewing changes to uiop/lisp-build.lisp

  • Committer: Package Import Robot
  • Author(s): François-René Rideau
  • Date: 2015-07-18 16:51:50 UTC
  • mfrom: (1.1.34)
  • Revision ID: package-import@ubuntu.com-20150718165150-dk11eugi59ncz7iy
Tags: 2:3.1.5-1
Bug fix and portability release:
* Add immutable-system support (thanks to Dave Cooper).  This support
  should be regarded as preliminary and subject to change.
* Substantially improved operation on Windows: many bugfixes and improve-
  ments to UIOP functions that interface with the operating system.
* Add CLASP support.
* Many miscellaneous fixes for issues on individual implementations,
  notably UIOP incompatibility introduced by SBCL 1.2.12, support for
  LispWorks 7 character types, fixes to chdir on ABCL, improvements
  to run-program on Windows.
* Added OS-COND to UIOP to paper over some incompatibilities about when
  and how operating system can be detected on different implementations.
  Made OS predicates run test at runtime so you can bind *features* from
  a target system and determine its OS.
* Fixes to XDG configuration directory handling.  Try to stick to the
  XDG spec, rather than guessing what it should be on different platforms.
  To recognize this, change UIOP functions about XDG files to "XDG-"
  prefixes.
* Documentation improvements.

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
        #+clozure '(ccl::*nx-speed* ccl::*nx-space* ccl::*nx-safety*
68
68
                    ccl::*nx-debug* ccl::*nx-cspeed*)
69
69
        #+(or cmu scl) '(c::*default-cookie*)
70
 
        #+ecl (unless (use-ecl-byte-compiler-p) '(c::*speed* c::*space* c::*safety* c::*debug*))
 
70
        #+(and ecl (not clasp)) (unless (use-ecl-byte-compiler-p) '(c::*speed* c::*space* c::*safety* c::*debug*))
 
71
        #+clasp '()
71
72
        #+gcl '(compiler::*speed* compiler::*space* compiler::*compiler-new-safety* compiler::*debug*)
72
73
        #+lispworks '(compiler::*optimization-level*)
73
74
        #+mkcl '(si::*speed* si::*space* si::*safety* si::*debug*)
74
75
        #+sbcl '(sb-c::*policy*)))
75
76
  (defun get-optimization-settings ()
76
77
    "Get current compiler optimization settings, ready to PROCLAIM again"
77
 
    #-(or abcl allegro clisp clozure cmu ecl lispworks mkcl sbcl scl xcl)
 
78
    #-(or abcl allegro clasp clisp clozure cmu ecl lispworks mkcl sbcl scl xcl)
78
79
    (warn "~S does not support ~S. Please help me fix that."
79
80
          'get-optimization-settings (implementation-type))
80
 
    #+(or abcl allegro clisp clozure cmu ecl lispworks mkcl sbcl scl xcl)
 
81
    #+(or abcl allegro clasp clisp clozure cmu ecl lispworks mkcl sbcl scl xcl)
81
82
    (let ((settings '(speed space safety debug compilation-speed #+(or cmu scl) c::brevity)))
82
83
      #.`(loop #+(or allegro clozure)
83
84
               ,@'(:with info = #+allegro (sys:declaration-information 'optimize)
84
85
                   #+clozure (ccl:declaration-information 'optimize nil))
85
86
               :for x :in settings
86
 
               ,@(or #+(or abcl ecl gcl mkcl xcl) '(:for v :in +optimization-variables+))
 
87
               ,@(or #+(or abcl clasp ecl gcl mkcl xcl) '(:for v :in +optimization-variables+))
87
88
               :for y = (or #+(or allegro clozure) (second (assoc x info)) ; normalize order
88
89
                            #+clisp (gethash x system::*optimize* 1)
89
 
                            #+(or abcl ecl mkcl xcl) (symbol-value v)
 
90
                            #+(or abcl clasp ecl mkcl xcl) (symbol-value v)
90
91
                            #+(or cmu scl) (slot-value c::*default-cookie*
91
92
                                                       (case x (compilation-speed 'c::cspeed)
92
93
                                                             (otherwise x)))
93
94
                            #+lispworks (slot-value compiler::*optimization-level* x)
94
 
                            #+sbcl (cdr (assoc x sb-c::*policy*)))
 
95
                            #+sbcl (sb-c::policy-quality sb-c::*policy* x))
95
96
               :when y :collect (list x y))))
96
97
  (defun proclaim-optimization-settings ()
97
98
    "Proclaim the optimization settings in *OPTIMIZATION-SETTINGS*"
610
611
  (defun compile-file-type (&rest keys)
611
612
    "pathname TYPE for lisp FASt Loading files"
612
613
    (declare (ignorable keys))
613
 
    #-(or ecl mkcl) (load-time-value (pathname-type (compile-file-pathname "foo.lisp")))
614
 
    #+(or ecl mkcl) (pathname-type (apply 'compile-file-pathname "foo" keys)))
 
614
    #-(or clasp ecl mkcl) (load-time-value (pathname-type (compile-file-pathname "foo.lisp")))
 
615
    #+(or clasp ecl mkcl) (pathname-type (apply 'compile-file-pathname "foo" keys)))
615
616
 
616
617
  (defun call-around-hook (hook function)
617
618
    "Call a HOOK around the execution of FUNCTION"
636
637
 
637
638
  (defun* (compile-file*) (input-file &rest keys
638
639
                                      &key (compile-check *compile-check*) output-file warnings-file
639
 
                                      #+clisp lib-file #+(or ecl mkcl) object-file #+sbcl emit-cfasl
 
640
                                      #+clisp lib-file #+(or clasp ecl mkcl) object-file #+sbcl emit-cfasl
640
641
                                      &allow-other-keys)
641
642
    "This function provides a portable wrapper around COMPILE-FILE.
642
643
It ensures that the OUTPUT-FILE value is only returned and
656
657
On ECL or MKCL, it creates both the linkable object and loadable fasl files.
657
658
On implementations that erroneously do not recognize standard keyword arguments,
658
659
it will filter them appropriately."
659
 
    #+ecl (when (and object-file (equal (compile-file-type) (pathname object-file)))
 
660
    #+(or clasp ecl) (when (and object-file (equal (compile-file-type) (pathname object-file)))
660
661
            (format t "Whoa, some funky ASDF upgrade switched ~S calling convention for ~S and ~S~%"
661
662
                    'compile-file* output-file object-file)
662
663
            (rotatef output-file object-file))
663
664
    (let* ((keywords (remove-plist-keys
664
665
                      `(:output-file :compile-check :warnings-file
665
 
                                     #+clisp :lib-file #+(or ecl mkcl) :object-file) keys))
 
666
                                     #+clisp :lib-file #+(or clasp ecl mkcl) :object-file) keys))
666
667
           (output-file
667
668
             (or output-file
668
669
                 (apply 'compile-file-pathname* input-file :output-file output-file keywords)))
669
 
           #+ecl
 
670
           #+(or clasp ecl)
670
671
           (object-file
671
672
             (unless (use-ecl-byte-compiler-p)
672
673
               (or object-file
673
 
                   (compile-file-pathname output-file :type :object))))
 
674
                   #+ecl(compile-file-pathname output-file :type :object)
 
675
                   #+clasp (compile-file-pathname output-file :output-type :object)
 
676
                   )))
674
677
           #+mkcl
675
678
           (object-file
676
679
             (or object-file
690
693
          (with-enough-pathname (input-file :defaults *base-build-directory*)
691
694
            (with-saved-deferred-warnings (warnings-file :source-namestring (namestring input-file))
692
695
              (with-muffled-compiler-conditions ()
693
 
                (or #-(or ecl mkcl)
 
696
                (or #-(or clasp ecl mkcl)
694
697
                    (apply 'compile-file input-file :output-file tmp-file
695
698
                           #+sbcl (if emit-cfasl (list* :emit-cfasl tmp-cfasl keywords) keywords)
696
699
                           #-sbcl keywords)
697
700
                    #+ecl (apply 'compile-file input-file :output-file
698
 
                                 (if object-file
699
 
                                     (list* object-file :system-p t keywords)
700
 
                                     (list* tmp-file keywords)))
 
701
                                (if object-file
 
702
                                    (list* object-file :system-p t keywords)
 
703
                                    (list* tmp-file keywords)))
 
704
                    #+clasp (apply 'compile-file input-file :output-file
 
705
                                  (if object-file
 
706
                                      (list* object-file :output-type :object #|:system-p t|# keywords)
 
707
                                      (list* tmp-file keywords)))
701
708
                    #+mkcl (apply 'compile-file input-file
702
709
                                  :output-file object-file :fasl-p nil keywords)))))
703
710
        (cond
707
714
                  (and (check-flag failure-p *compile-file-failure-behaviour*)
708
715
                       (check-flag warnings-p *compile-file-warnings-behaviour*)))
709
716
                (progn
710
 
                  #+(or ecl mkcl)
711
 
                  (when (and #+ecl object-file)
 
717
                  #+(or clasp ecl mkcl)
 
718
                  (when (and #+(or clasp ecl) object-file)
712
719
                    (setf output-truename
713
 
                          (compiler::build-fasl
714
 
                           tmp-file #+ecl :lisp-files #+mkcl :lisp-object-files
715
 
                                    (list object-file))))
 
720
                          (compiler::build-fasl tmp-file
 
721
                           #+(or clasp ecl) :lisp-files #+mkcl :lisp-object-files (list object-file))))
716
722
                  (or (not compile-check)
717
 
                      (apply compile-check input-file :output-file tmp-file keywords))))
 
723
                      (apply compile-check input-file
 
724
                             :output-file #-(or clasp ecl) output-file #+(or clasp ecl) tmp-file
 
725
                             keywords))))
718
726
           (delete-file-if-exists output-file)
719
727
           (when output-truename
 
728
             #+clasp (when output-truename (rename-file-overwriting-target tmp-file output-truename))
720
729
             #+clisp (when lib-file (rename-file-overwriting-target tmp-lib lib-file))
721
730
             #+sbcl (when cfasl-file (rename-file-overwriting-target tmp-cfasl cfasl-file))
722
731
             (rename-file-overwriting-target output-truename output-file)
723
732
             (setf output-truename (truename output-file)))
 
733
           #+clasp (delete-file-if-exists tmp-file)
724
734
           #+clisp (delete-file-if-exists tmp-lib))
725
735
          (t ;; error or failed check
726
736
           (delete-file-if-exists output-truename)
779
789
             (scm:concatenate-system output :fasls-to-concatenate))
780
790
        (loop :for f :in fasls :do (ignore-errors (delete-file f)))
781
791
        (ignore-errors (lispworks:delete-system :fasls-to-concatenate))))))
782