[staging-next] various: fix ld64 darwin build issues (#537396)

This commit is contained in:
Emily
2026-07-01 15:48:09 +00:00
committed by GitHub
5 changed files with 62 additions and 9 deletions
+16 -5
View File
@@ -116,6 +116,8 @@
# test
callPackage,
# TODO: Clean up on `staging`
llvmPackages,
}:
assert (withGTK3 && !withNS && variant != "macport") -> withX || withPgtk;
@@ -252,7 +254,11 @@ stdenv.mkDerivation (finalAttrs: {
autoreconfHook
]
++ lib.optionals (withPgtk || withX && (withGTK3 || withXwidgets)) [ wrapGAppsHook3 ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ sigtool ];
++ lib.optionals stdenv.hostPlatform.isDarwin [
sigtool
# TODO: Clean up on `staging`
llvmPackages.lld
];
buildInputs = [
gnutls
@@ -418,10 +424,15 @@ stdenv.mkDerivation (finalAttrs: {
NATIVE_FULL_AOT = "1";
LIBRARY_PATH = lib.concatStringsSep ":" libGccJitLibraryPaths;
}
// lib.optionalAttrs (variant == "macport") {
# Fixes intermittent segfaults when compiled with LLVM >= 7.0.
# See https://github.com/NixOS/nixpkgs/issues/127902
NIX_CFLAGS_COMPILE = "-isystem ${./macport-noescape-noop}";
// lib.optionalAttrs stdenv.hostPlatform.isDarwin {
# workaround for ld64 hardening issue
#
# TODO: Clean up on `staging`
NIX_CFLAGS_COMPILE =
"-fuse-ld=lld"
# Fixes intermittent segfaults when compiled with LLVM >= 7.0.
# See https://github.com/NixOS/nixpkgs/issues/127902
+ lib.optionalString (variant == "macport") " -isystem ${./macport-noescape-noop}";
};
enableParallelBuilding = true;
+13
View File
@@ -14,6 +14,8 @@
url = "https://raw.githubusercontent.com/archlinux/svntogit-packages/68f6d131750aa778807119e03eed70286a17b1cb/trunk/archlinux.vim";
sha256 = "18ifhv5q9prd175q3vxbqf6qyvkk6bc7d2lhqdk0q78i68kv9y0c";
},
# TODO: Clean up on `staging`
llvmPackages,
}:
let
@@ -37,6 +39,10 @@ stdenv.mkDerivation {
nativeBuildInputs = [
gettext
pkg-config
]
# TODO: Clean up on `staging`.
++ lib.optionals stdenv.hostPlatform.isDarwin [
llvmPackages.lld
];
buildInputs = [
ncurses
@@ -44,6 +50,13 @@ stdenv.mkDerivation {
gawk
];
# workaround for ld64 hardening issue
#
# TODO: Clean up on `staging`
env = lib.optionalAttrs stdenv.hostPlatform.isDarwin {
NIX_CFLAGS_COMPILE = "-fuse-ld=lld";
};
strictDeps = true;
configureFlags = [
+10 -2
View File
@@ -48,6 +48,9 @@
darwinSupport ? config.vim.darwin or false, # Enable Darwin support
ftNixSupport ? config.vim.ftNix or true, # Add nix indentation support from vim-nix (not needed for basic syntax highlighting)
sodiumSupport ? config.vim.sodium or true, # Enable sodium based encryption
# TODO: Clean up on `staging`
llvmPackages,
}:
let
@@ -169,7 +172,9 @@ stdenv.mkDerivation {
++ lib.optional nlsSupport gettext
++ lib.optional perlSupport perl
++ lib.optional (guiSupport == "gtk3") wrapGAppsHook3
++ lib.optional waylandSupport wayland-scanner;
++ lib.optional waylandSupport wayland-scanner
# TODO: Clean up on `staging`
++ lib.optional stdenv.hostPlatform.isDarwin llvmPackages.lld;
buildInputs = [
ncurses
@@ -196,7 +201,10 @@ stdenv.mkDerivation {
++ lib.optional sodiumSupport libsodium;
# error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-fdeclspec";
# workaround for ld64 hardening issue
#
# TODO: Clean up on `staging`
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-fdeclspec -fuse-ld=lld";
preConfigure = lib.optionalString ftNixSupport ''
cp ${vimPlugins.vim-nix.src}/ftplugin/nix.vim runtime/ftplugin/nix.vim
+6 -1
View File
@@ -17,6 +17,8 @@
# This can be set to one of the `darwin.xcode_*` packages as well.
# If set, this should be a path to Xcode.app, e.g. `"/Applications/Xcode.app"`.
withXcodePath ? null,
# TODO: Clean up on `staging`
llvmPackages,
}:
# Try to match MacVim's documented script interface compatibility
@@ -48,6 +50,8 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [
pkg-config
# TODO: Clean up on `staging`
llvmPackages.lld
];
buildInputs = [
# MacVim references up to MAC_OS_VERSION_14_0 in its source
@@ -188,7 +192,8 @@ stdenv.mkDerivation (finalAttrs: {
# macvim obj-c log macro triggers -Wformat-security (seems like a bug? it's a string literal!)
hardeningDisable = common.hardeningDisable ++ [ "format" ];
# os_log also enables -Werror,-Wformat by default
env.NIX_CFLAGS_COMPILE = "-DOS_LOG_FORMAT_WARNINGS";
# TODO: Clean up on `staging`
env.NIX_CFLAGS_COMPILE = "-DOS_LOG_FORMAT_WARNINGS -fuse-ld=lld";
# We rely on the user's Xcode install to build. It may be located in an arbitrary place, and
# it's not clear what system-level components it may require, so for now we'll just allow full
+17 -1
View File
@@ -58,6 +58,8 @@
broadwaySupport ? true,
wayland-scanner,
testers,
# TODO: Clean up on `staging`
llvmPackages,
}:
let
@@ -142,6 +144,10 @@ stdenv.mkDerivation (finalAttrs: {
]
++ lib.optionals waylandSupport [
wayland-scanner
]
# TODO: Clean up on `staging`
++ lib.optionals stdenv.hostPlatform.isDarwin [
llvmPackages.lld
];
buildInputs =
@@ -213,7 +219,17 @@ stdenv.mkDerivation (finalAttrs: {
# These are the defines that'd you'd get with --enable-debug=minimum (default).
# See: https://developer.gnome.org/gtk3/stable/gtk-building.html#extra-configuration-options
env.NIX_CFLAGS_COMPILE = "-DG_ENABLE_DEBUG -DG_DISABLE_CAST_CHECKS";
env = {
NIX_CFLAGS_COMPILE = "-DG_ENABLE_DEBUG -DG_DISABLE_CAST_CHECKS";
}
// lib.optionalAttrs stdenv.hostPlatform.isDarwin {
# workaround for ld64 hardening issue
#
# TODO: Clean up on `staging`
CC_LD = "lld";
OBJC_LD = "lld";
};
postPatch = ''
# See https://github.com/NixOS/nixpkgs/issues/132259