From a891ae41b36604e20c9ec130940728d673f5ad30 Mon Sep 17 00:00:00 2001 From: Andreas Fuchs Date: Wed, 26 Aug 2020 20:37:35 -0400 Subject: [PATCH] emacs: Set native-comp library path as linker flags instead Since Darwin's linker does not understand LIBRARY_PATH, we have to set the library path as explicit linker flags: This requires a very recent feature/native-comp emacs revision, but it runs on Darwin and correctly compiles files at runtime. --- pkgs/applications/editors/emacs/generic.nix | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkgs/applications/editors/emacs/generic.nix b/pkgs/applications/editors/emacs/generic.nix index 8e2c34988b9b..dcbefb884317 100644 --- a/pkgs/applications/editors/emacs/generic.nix +++ b/pkgs/applications/editors/emacs/generic.nix @@ -67,18 +67,18 @@ in stdenv.mkDerivation { # Make native compilation work both inside and outside of nix build (lib.optionalString nativeComp (let - libPath = lib.concatStringsSep ":" [ - "${lib.getLib libgccjit}/lib/gcc/${targetPlatform.config}/${libgccjit.version}" - "${lib.getLib stdenv.cc.cc}/lib" - "${lib.getLib stdenv.libc}/lib" - ]; + libPath = (lib.concatStringsSep " " + (builtins.map (x: ''\"-L${x}\"'') [ + "${lib.getLib libgccjit}/lib" + "${lib.getLib libgccjit}/lib/gcc/${targetPlatform.config}/${libgccjit.version}" + "${lib.getLib stdenv.cc.cc}/lib" + "${lib.getLib stdenv.libc}/lib" + ])); in '' substituteInPlace lisp/emacs-lisp/comp.el --replace \ - "(defcustom comp-async-env-modifier-form nil" \ - "(defcustom comp-async-env-modifier-form '((setenv \"LIBRARY_PATH\" (string-join (seq-filter (lambda (v) (null (eq v nil))) (list (getenv \"LIBRARY_PATH\") \"${libPath}\")) \":\")))" - + "(defcustom comp-native-driver-options nil" \ + "(defcustom comp-native-driver-options '(${libPath})" '')) - "" ];