diff --git a/Makefile.am b/Makefile.am index db55caa..7e9ee1c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ roslispdir = $(sysconfdir)/$(PACKAGE) -proslispdir = $(sysconfdir)/$(PACKAGE)/patch +roslisppatchdir = $(sysconfdir)/$(PACKAGE)/patch SUBDIRS = src if MANUAL_INSTALL @@ -83,7 +83,7 @@ LISPS = helper.el \ which.ros roslisp_DATA = $(LISPS:%=lisp/%) -#proslisp_DATA = clisp.patch sbcl-1.3.11.patch sbcl-posix-tests.patch +roslisppatch_DATA = patch/sbcl-1.3.11.patch patch/sbcl-posix-tests.patch src/gend.h: FORCE printf '#define ROS_COMPILE_ENVIRONMENT "%s"\n' "`$(CC) --version|head -n 1`" > $@.tmp diff --git a/lisp/install-sbcl.lisp b/lisp/install-sbcl.lisp index a5069fd..5238d36 100644 --- a/lisp/install-sbcl.lisp +++ b/lisp/install-sbcl.lisp @@ -120,17 +120,25 @@ (format o "~S~%" v)))))) (cons (not (opt "until-extract")) argv)) -(defun sbcl-patch (argv) +(defvar *sbcl-patch-list-cache* nil) +(defun sbcl-patch-list () + (or *sbcl-patch-list-cache* + (setf *sbcl-patch-list-cache* + (loop for i in (list + #+darwin "sbcl-posix-tests.patch" + #+linux "sbcl-1.3.11.patch") + collect (merge-pathnames (format nil "patch/~A" i) (opt "lispdir")))))) + +(defun sbcl-patch (argv &key revert (src (opt "src"))) (unless (opt "sbcl.patchless") - (let ((file (merge-pathnames "tmp/sbcl.patch" (homedir)))) - (dolist (uri (list - #+darwin (sbcl-patch1-uri) - #+linux (sbcl-patch2-uri))) - (format t "~&Downloading patch: ~A~%" uri) - (download uri file) - (chdir (opt "src")) - (format t "~%Applying patch:~%") - (uiop/run-program:run-program "patch -p0 -N" :output t :input file :ignore-error-status t)))) + (dolist (patch (sbcl-patch-list)) + (format t "~%Applying patch:~A~%" (file-namestring patch)) + (chdir src) + (uiop/run-program:run-program + (if revert + "patch -p0 -R -r -" + "patch -p0 -N -r -") + :output t :input patch :ignore-error-status t))) (cons t argv)) (defun sbcl-config (argv) diff --git a/lisp/locations.lisp b/lisp/locations.lisp index d490d46..5f22513 100644 --- a/lisp/locations.lisp +++ b/lisp/locations.lisp @@ -28,8 +28,6 @@ (defuri sigsegv-uri "http://ftpmirror.gnu.org/libsigsegv/") (defuri msys2-uri "http://kent.dl.sourceforge.net/project/") -(defuri sbcl-patch1-uri "https://gist.githubusercontent.com/snmsts/e8e4fd4bd5e458ac45e8/raw/bb7f1cd2e8e9a914f4e9b1b5acf889ecf75dfe0c/posix-tests.patch") -(defuri sbcl-patch2-uri "https://gist.githubusercontent.com/snmsts/14ca6f57b1730a4c30312e394eb7e914/raw/c55b6176f92038c7573d6d9e4e222861b84158ee/sbcl-1.3.11.patch") (defuri clisp-patch1-uri "https://raw.githubusercontent.com/Homebrew/homebrew/2fb8cb1a2279f80dc89900b3ebaca9e5afc90494/Library/Formula/clisp.rb") (defuri asdf-git-version-uri "https://github.com/roswell/asdf/releases.atom") diff --git a/patch/sbcl-1.3.11.patch b/patch/sbcl-1.3.11.patch new file mode 100644 index 0000000..9ee921d --- /dev/null +++ b/patch/sbcl-1.3.11.patch @@ -0,0 +1,35 @@ +--- ++++ make-genesis-2.sh +@@ -1,3 +1,3 @@ + #!/bin/sh +-set -em ++set -e + +--- ++++ make-host-1.sh +@@ -1,3 +1,3 @@ + #!/bin/sh +-set -em ++set -e + +--- ++++ make-host-2.sh +@@ -1,3 +1,3 @@ + #!/bin/sh +-set -em ++set -e + +--- ++++ make-target-1.sh +@@ -1,3 +1,3 @@ + #!/bin/sh +-set -em ++set -e + +--- ++++ make-target-2.sh +@@ -1,3 +1,3 @@ + #!/bin/sh +-set -em ++set -e + diff --git a/patch/sbcl-posix-tests.patch b/patch/sbcl-posix-tests.patch new file mode 100644 index 0000000..bb7f1cd --- /dev/null +++ b/patch/sbcl-posix-tests.patch @@ -0,0 +1,11 @@ +--- ++++ contrib/sb-posix/posix-tests.lisp +@@ -536,7 +536,7 @@ + nil) + + (deftest readdir.1 +- (let ((dir (sb-posix:opendir "/"))) ++ (let ((dir (sb-posix:opendir "/")) (sb-alien::*default-c-string-external-format* :utf-8)) + (unwind-protect + (block dir-loop + (loop for dirent = (sb-posix:readdir dir)