init-asdf.lisp 8.55 KB
Newer Older
1 2 3 4 5 6 7
;;;; -*- mode:lisp;coding:utf-8 -*-
;;;;**************************************************************************
;;;;FILE:               compile-with-asdf.lisp
;;;;LANGUAGE:           Common-Lisp
;;;;SYSTEM:             Common-Lisp
;;;;USER-INTERFACE:     NONE
;;;;DESCRIPTION
8
;;;;
Pascal J. Bourguignon's avatar
Pascal J. Bourguignon committed
9
;;;;    Register the com.informatimago.common-lisp systems with ASDF.
10
;;;;
11 12 13 14 15 16
;;;;AUTHORS
;;;;    <PJB> Pascal J. Bourguignon <pjb@informatimago.com>
;;;;MODIFICATIONS
;;;;    2010-11-01 <PJB> Created.
;;;;BUGS
;;;;LEGAL
17
;;;;    AGPL3
18
;;;;
19
;;;;    Copyright Pascal J. Bourguignon 2010 - 2016
20
;;;;
21 22 23 24
;;;;    This program is free software: you can redistribute it and/or modify
;;;;    it under the terms of the GNU Affero General Public License as published by
;;;;    the Free Software Foundation, either version 3 of the License, or
;;;;    (at your option) any later version.
25
;;;;
26 27 28 29
;;;;    This program is distributed in the hope that it will be useful,
;;;;    but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;;;    GNU Affero General Public License for more details.
30
;;;;
31
;;;;    You should have received a copy of the GNU Affero General Public License
32
;;;;    along with this program.  If not, see <http://www.gnu.org/licenses/>
33
;;;;**************************************************************************
34 35 36
(eval-when (:compile-toplevel :load-toplevel :execute)
  (setf *readtable* (copy-readtable nil)))
(in-package "COMMON-LISP-USER")
37 38

(defvar *asdf-source*
Pascal J. Bourguignon's avatar
Pascal J. Bourguignon committed
39 40
  (truename (merge-pathnames (make-pathname :name "ASDF" :type "LISP" :case :common)
                             *load-pathname*)))
41

Pascal J. Bourguignon's avatar
Pascal J. Bourguignon committed
42 43
;; (defvar *asdf-binary-locations-directory*
;;   #p"/data/lisp/packages/net/common-lisp/projects/asdf-binary-locations/asdf-binary-locations/")
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; ASDF
;;;

(unless (find-package :asdf)
  (handler-case (require :asdf)
    (error ()   (load (compile-file *asdf-source*)))))

(defun push-asdf-repository (path)
  (pushnew path asdf:*central-registry* :test #'equal))

(defun asdf-load (&rest systems)
  (mapcar (lambda (system) (asdf:operate 'asdf:load-op system))
          systems))

(defun asdf-delete-system (&rest systems)
  (mapc (lambda (system) (remhash (string-downcase system) asdf::*defined-systems*))
        systems)
  (values))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; ASDF-BINARY-LOCATIONS
;;;

(defun hostname ()
  (let ((outpath (format nil "/tmp/hostname-~8,'0X.txt" (random #x100000000))))
    (asdf:run-shell-command
     "( hostname --fqdn 2>/dev/null || hostname --long 2>/dev/null || hostname ) > ~A"
     outpath)
    (prog1 (with-open-file (hostname outpath)
             (read-line hostname))
      (delete-file outpath))))

(let ((sym (find-symbol "ENABLE-ASDF-BINARY-LOCATIONS-COMPATIBILITY" "ASDF")))
  (when (and sym (fboundp sym))
83
    (push :has-asdf-enable-asdf-binary-locations-compatibility *features*)))
84

85
#+has-asdf-enable-asdf-binary-locations-compatibility
86
(progn
Pascal J. Bourguignon's avatar
Pascal J. Bourguignon committed
87
  (format *trace-output* "~&enable-asdf-binary-locations-compatibility ~%")
88 89 90
  (asdf:enable-asdf-binary-locations-compatibility
   :centralize-lisp-binaries     t
   :default-toplevel-directory   (merge-pathnames (format nil ".cache/common-lisp/~A/" (hostname))
91
                                                  (truename (user-homedir-pathname)) nil)
92 93 94 95
   :include-per-user-information nil
   :map-all-source-files t
   :source-to-target-mappings    nil))

96 97 98
;; We need (truename (user-homedir-pathname)) because in cmucl (user-homedir-pathname)
;; is a search path, and that cannot be merged...

Pascal J. Bourguignon's avatar
Pascal J. Bourguignon committed
99 100 101 102
;; #-has-asdf-enable-asdf-binary-locations-compatibility
;; (progn
;;  (push-asdf-repository *asdf-binary-locations-directory*)
;;  (asdf-load :asdf-binary-locations))
103

104
#-has-asdf-enable-asdf-binary-locations-compatibility
105
(progn
Pascal J. Bourguignon's avatar
Pascal J. Bourguignon committed
106
  (format *trace-output* "~&enable-asdf-binary-locations-compatibility ~%")
107 108 109 110
  (setf asdf:*centralize-lisp-binaries*     t
        asdf:*include-per-user-information* nil
        asdf:*default-toplevel-directory*
        (merge-pathnames (format nil ".cache/common-lisp/~A/" (hostname))
111
                         (truename (user-homedir-pathname)) nil)
112 113 114 115
        asdf:*source-to-target-mappings* '()))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
Pascal J. Bourguignon's avatar
Pascal J. Bourguignon committed
116
;;; Registering com.informatimago.common-lisp systems.
117 118
;;;

119

120 121 122 123
(setf asdf:*central-registry*
      (append (remove-duplicates
               (mapcar (lambda (path)
                         (make-pathname :name nil :type nil :version nil :defaults path))
124 125 126
                       #-abcl
                       (directory "**/*.asd")
                       #+abcl
127
                       '(#p"/home/pjb/src/git/public/lisp/tools/com.informatimago.tools.make-depends.asd"
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
                         #p"/home/pjb/src/git/public/lisp/common-lisp/diagram/com.informatimago.common-lisp.diagram.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/html-base/com.informatimago.common-lisp.html-base.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/invoice/com.informatimago.common-lisp.invoice.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/arithmetic/com.informatimago.common-lisp.arithmetic.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/picture/com.informatimago.common-lisp.picture.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/lisp-text/com.informatimago.common-lisp.lisp-text.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/rfc3548/com.informatimago.common-lisp.rfc3548.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/lisp-sexp/com.informatimago.common-lisp.lisp-sexp.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/unix/com.informatimago.common-lisp.unix.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/parser/com.informatimago.common-lisp.parser.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/csv/com.informatimago.common-lisp.csv.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/bank/com.informatimago.common-lisp.bank.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/http/com.informatimago.common-lisp.http.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/lisp-reader/com.informatimago.common-lisp.lisp-reader.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/lisp/com.informatimago.common-lisp.lisp.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/graphviz/com.informatimago.common-lisp.graphviz.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/html-parser/com.informatimago.common-lisp.html-parser.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/ed/com.informatimago.common-lisp.ed.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/rfc2822/com.informatimago.common-lisp.rfc2822.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/html-generator/com.informatimago.common-lisp.html-generator.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/cxx/com.informatimago.common-lisp.cxx.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/interactive/com.informatimago.common-lisp.interactive.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/data-encoding/com.informatimago.common-lisp.data-encoding.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/cesarum/com.informatimago.common-lisp.cesarum.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/regexp/com.informatimago.common-lisp.regexp.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/heap/com.informatimago.common-lisp.heap.asd"
                         #p"/home/pjb/src/git/public/lisp/common-lisp/com.informatimago.common-lisp.asd"
                         #p"/home/pjb/src/git/public/lisp/sbcl/com.informatimago.sbcl.asd"
                         #p"/home/pjb/src/git/public/lisp/susv3/com.informatimago.susv3.asd"
                         #p"/home/pjb/src/git/public/lisp/clisp/com.informatimago.clisp.asd"
                         #p"/home/pjb/src/git/public/lisp/clext/com.informatimago.clext.asd"
                         #p"/home/pjb/src/git/public/lisp/clmisc/com.informatimago.clmisc.asd"
                         #p"/home/pjb/src/git/public/lisp/cl-posix/cliki/cliki.asd"
                         #p"/home/pjb/src/git/public/lisp/cl-posix/cliki/clposixcliki.asd"))
162 163 164 165 166 167 168 169
               :test (function equalp))
              asdf:*central-registry*))


;;;; THE END ;;;;