Merge pull request #94637 from antifuchs/gccemacs-on-darwin
emacs: Make gccemacs build on darwin
This commit is contained in:
commit
6fc3562432
@ -11,7 +11,7 @@
|
|||||||
, libtiff, librsvg, gconf, libxml2, imagemagick, gnutls, libselinux
|
, libtiff, librsvg, gconf, libxml2, imagemagick, gnutls, libselinux
|
||||||
, alsaLib, cairo, acl, gpm, AppKit, GSS, ImageIO, m17n_lib, libotf
|
, alsaLib, cairo, acl, gpm, AppKit, GSS, ImageIO, m17n_lib, libotf
|
||||||
, jansson, harfbuzz
|
, jansson, harfbuzz
|
||||||
, libgccjit, targetPlatform, binutils, binutils-unwrapped, makeWrapper # native-comp params
|
, libgccjit, targetPlatform, makeWrapper # native-comp params
|
||||||
, systemd ? null
|
, systemd ? null
|
||||||
, withX ? !stdenv.isDarwin
|
, withX ? !stdenv.isDarwin
|
||||||
, withNS ? stdenv.isDarwin
|
, withNS ? stdenv.isDarwin
|
||||||
@ -67,18 +67,23 @@ in stdenv.mkDerivation {
|
|||||||
|
|
||||||
# Make native compilation work both inside and outside of nix build
|
# Make native compilation work both inside and outside of nix build
|
||||||
(lib.optionalString nativeComp (let
|
(lib.optionalString nativeComp (let
|
||||||
libPath = lib.concatStringsSep ":" [
|
backendPath = (lib.concatStringsSep " "
|
||||||
"${lib.getLib libgccjit}/lib/gcc/${targetPlatform.config}/${libgccjit.version}"
|
(builtins.map (x: ''\"-B${x}\"'') [
|
||||||
"${lib.getLib stdenv.cc.cc}/lib"
|
# Paths necessary so the JIT compiler finds its libraries:
|
||||||
"${lib.getLib stdenv.glibc}/lib"
|
"${lib.getLib libgccjit}/lib"
|
||||||
];
|
"${lib.getLib libgccjit}/lib/gcc"
|
||||||
|
"${lib.getLib stdenv.cc.libc}/lib"
|
||||||
|
|
||||||
|
# Executable paths necessary for compilation (ld, as):
|
||||||
|
"${lib.getBin stdenv.cc.cc}"
|
||||||
|
"${lib.getBin stdenv.cc.bintools}"
|
||||||
|
"${lib.getBin stdenv.cc.bintools.bintools}"
|
||||||
|
]));
|
||||||
in ''
|
in ''
|
||||||
substituteInPlace lisp/emacs-lisp/comp.el --replace \
|
substituteInPlace lisp/emacs-lisp/comp.el --replace \
|
||||||
"(defcustom comp-async-env-modifier-form nil" \
|
"(defcustom comp-native-driver-options 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 '(${backendPath})"
|
||||||
|
|
||||||
''))
|
''))
|
||||||
|
|
||||||
""
|
""
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -156,11 +161,6 @@ in stdenv.mkDerivation {
|
|||||||
"$out/bin/emacs"
|
"$out/bin/emacs"
|
||||||
patchelf --add-needed "libXcursor.so.1" "$out/bin/emacs"
|
patchelf --add-needed "libXcursor.so.1" "$out/bin/emacs"
|
||||||
'')
|
'')
|
||||||
|
|
||||||
(lib.optionalString nativeComp ''
|
|
||||||
wrapProgram $out/bin/emacs-* --prefix PATH : "${lib.makeBinPath [ binutils binutils-unwrapped ]}"
|
|
||||||
'')
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
|
@ -184,7 +184,7 @@ stdenv.mkDerivation ({
|
|||||||
|
|
||||||
preConfigure = import ../common/pre-configure.nix {
|
preConfigure = import ../common/pre-configure.nix {
|
||||||
inherit (stdenv) lib;
|
inherit (stdenv) lib;
|
||||||
inherit version hostPlatform gnatboot langAda langGo;
|
inherit version hostPlatform gnatboot langAda langGo langJit;
|
||||||
};
|
};
|
||||||
|
|
||||||
dontDisableStatic = true;
|
dontDisableStatic = true;
|
||||||
|
@ -261,7 +261,7 @@ postInstall() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if type "install_name_tool"; then
|
if type "install_name_tool"; then
|
||||||
for i in "${!outputLib}"/lib/*.*.dylib; do
|
for i in "${!outputLib}"/lib/*.*.dylib "${!outputLib}"/lib/*.so.[0-9]; do
|
||||||
install_name_tool -id "$i" "$i" || true
|
install_name_tool -id "$i" "$i" || true
|
||||||
for old_path in $(otool -L "$i" | grep "$out" | awk '{print $1}'); do
|
for old_path in $(otool -L "$i" | grep "$out" | awk '{print $1}'); do
|
||||||
new_path=`echo "$old_path" | sed "s,$out,${!outputLib},"`
|
new_path=`echo "$old_path" | sed "s,$out,${!outputLib},"`
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
, gnatboot ? null
|
, gnatboot ? null
|
||||||
, langAda ? false
|
, langAda ? false
|
||||||
, langJava ? false
|
, langJava ? false
|
||||||
|
, langJit ? false
|
||||||
, langGo }:
|
, langGo }:
|
||||||
|
|
||||||
assert langJava -> lib.versionOlder version "7";
|
assert langJava -> lib.versionOlder version "7";
|
||||||
@ -49,3 +50,11 @@ lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) ''
|
|||||||
+ lib.optionalString (hostPlatform.isDarwin) ''
|
+ lib.optionalString (hostPlatform.isDarwin) ''
|
||||||
export ac_cv_func_aligned_alloc=no
|
export ac_cv_func_aligned_alloc=no
|
||||||
''
|
''
|
||||||
|
|
||||||
|
# In order to properly install libgccjit on macOS Catalina, strip(1)
|
||||||
|
# upon installation must not remove external symbols, otherwise the
|
||||||
|
# install step errors with "symbols referenced by indirect symbol
|
||||||
|
# table entries that can't be stripped".
|
||||||
|
+ lib.optionalString (hostPlatform.isDarwin && langJit) ''
|
||||||
|
export STRIP='strip -x'
|
||||||
|
''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user