diff --git a/pkgs/development/lisp-modules/nix-cl.nix b/pkgs/development/lisp-modules/nix-cl.nix index 619a6144c5de..eb51c992dcbc 100644 --- a/pkgs/development/lisp-modules/nix-cl.nix +++ b/pkgs/development/lisp-modules/nix-cl.nix @@ -177,15 +177,23 @@ let asdf = "${asdfFasl}/asdf.${faslExt}"; }; - preConfigure = '' + configurePhase = '' + runHook preConfigure + source ${./setup-hook.sh} buildAsdfPath + + runHook postConfigure ''; buildPhase = optionalString (src != null) '' + runHook preBuild + export CL_SOURCE_REGISTRY=$CL_SOURCE_REGISTRY:$src// export ASDF_OUTPUT_TRANSLATIONS="$src:$(pwd):${storeDir}:${storeDir}" ${pkg}/bin/${program} ${toString flags} < $buildScript + + runHook postBuild ''; # Copy compiled files to store @@ -200,6 +208,8 @@ let concatMapStringsSep "\\|" (replaceStrings ["." "+"] ["[.]" "[+]"]) systems; in '' + runHook preInstall + mkdir -pv $out cp -r * $out @@ -207,6 +217,8 @@ let find $out -name "*.asd" \ | grep -v "/\(${mkSystemsRegex systems}\)\.asd$" \ | xargs rm -fv || true + + runHook postInstall ''; dontPatchShebangs = true; diff --git a/pkgs/development/lisp-modules/packages.nix b/pkgs/development/lisp-modules/packages.nix index 32467f4ac932..ea93ef4a4572 100644 --- a/pkgs/development/lisp-modules/packages.nix +++ b/pkgs/development/lisp-modules/packages.nix @@ -28,20 +28,29 @@ let build = (build-asdf-system (args' // { version = args'.version + "-build"; })) .overrideAttrs(o: { buildPhase = with builtins; '' + runHook preBuild + mkdir __fasls export ASDF_OUTPUT_TRANSLATIONS="$(pwd):$(pwd)/__fasls:${storeDir}:${storeDir}" export CL_SOURCE_REGISTRY=$CL_SOURCE_REGISTRY:$(pwd)// ${o.pkg}/bin/${o.program} ${toString (o.flags or [])} < ${o.buildScript} + + runHook postBuild ''; installPhase = '' + runHook preInstall + mkdir -pv $out rm -rf __fasls cp -r * $out + + runHook postInstall ''; }); in build-asdf-system (args' // { # Patches are already applied in `build` patches = []; + postPatch = ""; src = build; }); @@ -151,9 +160,15 @@ let cephes = build-with-compile-into-pwd { inherit (super.cephes) pname version src lispLibs; patches = [ ./patches/cephes-make.patch ]; + postPatch = '' + find \( -name '*.dll' -o -name '*.dylib' -o -name '*.so' \) -delete + ''; postConfigure = '' substituteAllInPlace cephes.asd ''; + postInstall = '' + find $out -name '*.o' -delete + ''; }; clx-truetype = build-asdf-system { diff --git a/pkgs/development/lisp-modules/patches/cephes-make.patch b/pkgs/development/lisp-modules/patches/cephes-make.patch index b67b5f70ad3c..10446972a115 100644 --- a/pkgs/development/lisp-modules/patches/cephes-make.patch +++ b/pkgs/development/lisp-modules/patches/cephes-make.patch @@ -1,22 +1,21 @@ --- a/cephes.asd +++ b/cephes.asd -@@ -5,7 +5,7 @@ - (defclass makefile (source-file) ((type :initform "m"))) - (defmethod perform ((o load-op) (c makefile)) t) - (defmethod perform ((o compile-op) (c makefile)) -- (let* ((lib-dir (system-relative-pathname "cephes" "scipy-cephes")) -+ (let* ((lib-dir #P"@out@/scipy-cephes") - (lib (make-pathname :directory `(:relative ,(namestring lib-dir)) - :name "libmd" - :type #+darwin "dylib" #+(and unix (not darwin)) "so" #+(or windows win32) "dll")) -@@ -14,7 +14,7 @@ - (format *error-output* "Library ~S exists, skipping build" lib) - (format *error-output* "Building ~S~%" lib)) - (unless built -- (chdir (native-namestring lib-dir)) -+ (chdir "scipy-cephes") - (run-program "make" :output t)))) +@@ -16,7 +16,7 @@ + (defclass makefile (source-file) ((type :initform "m"))) + (defmethod perform ((o load-op) (c makefile)) t) + (defmethod perform ((o compile-op) (c makefile)) +- (let* ((lib-dir (system-relative-pathname "cephes" "scipy-cephes/")) ++ (let* ((lib-dir #P"@out@/scipy-cephes/") + (lib (make-pathname :directory (pathname-directory lib-dir) + :name #+(or (and unix (not darwin)) windows win32) "libmd" + #+(and darwin arm64) "libmd-arm64" +@@ -30,7 +30,7 @@ + (format *error-output* "Library ~S exists, skipping build" lib) + (format *error-output* "Building ~S~%" lib)) + (unless built +- (chdir (native-namestring lib-dir)) ++ (chdir "scipy-cephes") + (run-program "make" :output t))))) (defsystem "cephes" -Diff finished. Thu Mar 28 08:13:30 2024