Merge pull request #203787 from leungbk/emacs-substitute-in-place

emacs: change `substituteInPlace` invocation to an aligning patch

authored by

Mario Rodas and committed by
GitHub
017dafba 8c88a47a

+55 -21
+20 -21
pkgs/applications/editors/emacs/generic.nix
··· 7 7 , patches ? _: [ ] 8 8 , macportVersion ? null 9 9 }: 10 - { stdenv, llvmPackages_6, lib, fetchurl, fetchpatch, ncurses, xlibsWrapper, libXaw, libXpm 10 + { stdenv, llvmPackages_6, lib, fetchurl, fetchpatch, substituteAll, ncurses, xlibsWrapper, libXaw, libXpm 11 11 , Xaw3d, libXcursor, pkg-config, gettext, libXft, dbus, libpng, libjpeg, giflib 12 12 , libtiff, librsvg, libwebp, gconf, libxml2, imagemagick, gnutls, libselinux 13 13 , alsa-lib, cairo, acl, gpm, m17n_lib, libotf ··· 67 67 pname = pname + lib.optionalString ( !withX && !withNS && !withMacport && !withGTK2 && !withGTK3 ) "-nox"; 68 68 inherit version; 69 69 70 - patches = patches fetchpatch; 70 + patches = patches fetchpatch ++ lib.optionals nativeComp [ 71 + (substituteAll { 72 + src = if lib.versionOlder version "29" 73 + then ./native-comp-driver-options-28.patch 74 + else ./native-comp-driver-options.patch; 75 + backendPath = (lib.concatStringsSep " " 76 + (builtins.map (x: ''"-B${x}"'') [ 77 + # Paths necessary so the JIT compiler finds its libraries: 78 + "${lib.getLib libgccjit}/lib" 79 + "${lib.getLib libgccjit}/lib/gcc" 80 + "${lib.getLib stdenv.cc.libc}/lib" 81 + 82 + # Executable paths necessary for compilation (ld, as): 83 + "${lib.getBin stdenv.cc.cc}/bin" 84 + "${lib.getBin stdenv.cc.bintools}/bin" 85 + "${lib.getBin stdenv.cc.bintools.bintools}/bin" 86 + ])); 87 + }) 88 + ]; 71 89 72 90 src = if macportVersion != null then fetchFromBitbucket { 73 91 owner = "mituharu"; ··· 112 130 done 113 131 '' 114 132 115 - # Make native compilation work both inside and outside of nix build 116 - (lib.optionalString nativeComp (let 117 - backendPath = (lib.concatStringsSep " " 118 - (builtins.map (x: ''\"-B${x}\"'') [ 119 - # Paths necessary so the JIT compiler finds its libraries: 120 - "${lib.getLib libgccjit}/lib" 121 - "${lib.getLib libgccjit}/lib/gcc" 122 - "${lib.getLib stdenv.cc.libc}/lib" 123 - 124 - # Executable paths necessary for compilation (ld, as): 125 - "${lib.getBin stdenv.cc.cc}/bin" 126 - "${lib.getBin stdenv.cc.bintools}/bin" 127 - "${lib.getBin stdenv.cc.bintools.bintools}/bin" 128 - ])); 129 - in '' 130 - substituteInPlace lisp/emacs-lisp/comp.el --replace \ 131 - "(defcustom native-comp-driver-options nil" \ 132 - "(defcustom native-comp-driver-options '(${backendPath})" 133 - '')) 134 133 "" 135 134 ]; 136 135
+16
pkgs/applications/editors/emacs/native-comp-driver-options-28.patch
··· 1 + diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el 2 + index a5ab12ae38..e33e71cb55 100644 3 + --- a/lisp/emacs-lisp/comp.el 4 + +++ b/lisp/emacs-lisp/comp.el 5 + @@ -178,7 +178,7 @@ native-comp-compiler-options 6 + :type '(repeat string) 7 + :version "28.1") 8 + 9 + -(defcustom native-comp-driver-options nil 10 + +(defcustom native-comp-driver-options '(@backendPath@) 11 + "Options passed verbatim to the native compiler's back-end driver. 12 + Note that not all options are meaningful; typically only the options 13 + affecting the assembler and linker are likely to be useful. 14 + -- 15 + 2.37.3 16 +
+19
pkgs/applications/editors/emacs/native-comp-driver-options.patch
··· 1 + diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el 2 + index 2c9b79334b..50c6b5ac85 100644 3 + --- a/lisp/emacs-lisp/comp.el 4 + +++ b/lisp/emacs-lisp/comp.el 5 + @@ -178,8 +178,9 @@ native-comp-compiler-options 6 + :type '(repeat string) 7 + :version "28.1") 8 + 9 + -(defcustom native-comp-driver-options (when (eq system-type 'darwin) 10 + - '("-Wl,-w")) 11 + +(defcustom native-comp-driver-options (append (when (eq system-type 'darwin) 12 + + '("-Wl,-w")) 13 + + '(@backendPath@)) 14 + "Options passed verbatim to the native compiler's back-end driver. 15 + Note that not all options are meaningful; typically only the options 16 + affecting the assembler and linker are likely to be useful. 17 + -- 18 + 2.37.3 19 +