diff --git a/pkgs/applications/editors/emacs/generic.nix b/pkgs/applications/editors/emacs/generic.nix index 7b71fccd6b8a..4cad0f12cffe 100644 --- a/pkgs/applications/editors/emacs/generic.nix +++ b/pkgs/applications/editors/emacs/generic.nix @@ -62,9 +62,17 @@ assert withXwidgets -> withGTK3 && webkitgtk != null; assert withTreeSitter -> tree-sitter != null; +let + libGccJitLibraryPaths = [ + "${lib.getLib libgccjit}/lib/gcc" + "${lib.getLib stdenv.cc.libc}/lib" + ] ++ lib.optionals (stdenv.cc?cc.libgcc) [ + "${lib.getLib stdenv.cc.cc.libgcc}/lib" + ]; +in (if withMacport then llvmPackages_6.stdenv else stdenv).mkDerivation (finalAttrs: (lib.optionalAttrs nativeComp { NATIVE_FULL_AOT = "1"; - LIBRARY_PATH = "${lib.getLib stdenv.cc.libc}/lib"; + LIBRARY_PATH = lib.concatStringsSep ":" libGccJitLibraryPaths; } // { pname = pname + lib.optionalString ( !withX && !withNS && !withMacport && !withGTK2 && !withGTK3 ) "-nox"; inherit version; @@ -75,17 +83,15 @@ assert withTreeSitter -> tree-sitter != null; then ./native-comp-driver-options-28.patch else ./native-comp-driver-options.patch; backendPath = (lib.concatStringsSep " " - (builtins.map (x: ''"-B${x}"'') [ + (builtins.map (x: ''"-B${x}"'') ([ # Paths necessary so the JIT compiler finds its libraries: "${lib.getLib libgccjit}/lib" - "${lib.getLib libgccjit}/lib/gcc" - "${lib.getLib stdenv.cc.libc}/lib" - + ] ++ libGccJitLibraryPaths ++ [ # Executable paths necessary for compilation (ld, as): "${lib.getBin stdenv.cc.cc}/bin" "${lib.getBin stdenv.cc.bintools}/bin" "${lib.getBin stdenv.cc.bintools.bintools}/bin" - ])); + ]))); }) ]; diff --git a/pkgs/build-support/emacs/wrapper.nix b/pkgs/build-support/emacs/wrapper.nix index 3f6a224fa6cd..bd7702ebb916 100644 --- a/pkgs/build-support/emacs/wrapper.nix +++ b/pkgs/build-support/emacs/wrapper.nix @@ -67,10 +67,12 @@ runCommand # Store all paths we want to add to emacs here, so that we only need to add # one path to the load lists deps = runCommand "emacs-packages-deps" - { + ({ inherit explicitRequires lndir emacs; nativeBuildInputs = lib.optional nativeComp gcc; - } + } // lib.optionalAttrs nativeComp { + inherit (emacs) LIBRARY_PATH; + }) '' findInputsOld() { local pkg="$1"; shift