open intervals and type derivation
[sbcl.git] / tools-for-build / wxs.lisp
index b6d4faa..1374799 100644 (file)
 
 (defvar *indent-level* 0)
 
+(defvar *sbcl-source-root*
+  (truename
+   (merge-pathnames (make-pathname :directory (list :relative :up))
+                    (make-pathname :name nil :type nil :defaults *load-truename*))))
+
 (defun print-xml (sexp &optional (stream *standard-output*))
   (destructuring-bind (tag &optional attributes &body children) sexp
     (when attributes (assert (evenp (length attributes))))
   (loop for flag in (directory "../contrib/*/test-passed")
         collect (car (last (pathname-directory flag)))))
 
+(defvar *id-char-substitutions* '((#\\ . #\_)
+                                  (#\/ . #\_)
+                                  (#\: . #\.)
+                                  (#\- . #\.)))
+
 (defun id (string)
   ;; Mangle a string till it can be used as an Id. A-Z, a-z, 0-9, and
   ;; _ are ok, nothing else is.
-  (nsubstitute #\_ #\-
-               (nsubstitute #\. #\:
-                            (nsubstitute #\. #\/
-                                         (substitute #\. #\\ string)))))
+  (map 'string (lambda (c)
+                 (or (cdr (assoc c *id-char-substitutions*))
+                     c))
+       string))
 
 (defun directory-id (name)
-  (id (format nil "Directory_~A" (enough-namestring name))))
+  (id (format nil "Directory_~A" (enough-namestring name *sbcl-source-root*))))
 
 (defun directory-names (pathname)
   (let ((name (car (last (pathname-directory pathname)))))
         (list "Name" name))))
 
 (defun file-id (pathname)
-  (id (format nil "File_~A" (enough-namestring pathname))))
+  (id (format nil "File_~A" (enough-namestring pathname *sbcl-source-root*))))
 
 (defparameter *ignored-directories* '("CVS" ".svn"))
 
     ("fasl" . "fas")
     ("SBCL" . "txt") ; README.SBCL -> README.txt
     ("texinfo" . "tfo")
-    ("lisp-temp" . "lmp")))
+    ("lisp-temp" . "lmp")
+    ("html" . "htm")))
 
 (defun file-names (pathname)
   (if (or (< 8 (length (pathname-name pathname)))
 (defparameter *components* nil)
 
 (defun component-id (pathname)
-  (let ((id (id (format nil "Contrib_~A" (enough-namestring pathname)))))
+  (let ((id (id (format nil "Contrib_~A" (enough-namestring pathname *sbcl-source-root*)))))
     (push id *components*)
     id))
 
                             "Name" "PATH"
                             "Part" "first"
                             "Value" "[INSTALLDIR]"))
-            ,(make-extension "fasl" "application/x-lisp-fasl")
-            ,(make-extension "lisp" "text/x-lisp-source")
+            ;; If we want to associate files with SBCL, this
+            ;; is how it's done -- but doing this by default
+            ;; and without asking the user for permission Is
+            ;; Bad. Before this is enabled we need to figure out
+            ;; how to make WiX ask for permission for this...
+            ;; ,(make-extension "fasl" "application/x-lisp-fasl")
+            ;; ,(make-extension "lisp" "text/x-lisp-source")
             ("File" ("Id" "sbcl.exe"
                      "Name" "sbcl.exe"
                      "Source" "../src/runtime/sbcl.exe")