Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable cross-compilation between both Darwin platforms #256590

Closed
wants to merge 151 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
d69895c
darwin.stdenv: build llvmPackages.libunwind along with libc++ and lib…
reckenrode Apr 9, 2024
0d3552a
darwin.configd: remove dependency on CF for private headers
reckenrode Apr 14, 2024
9292f39
darwin.libdispatch: 442.1.4 -> 703.50.37
reckenrode Apr 9, 2024
0aafebf
darwin.Libsystem: use lib.getDev instead of assuming the output exists
reckenrode Apr 14, 2024
cf34f31
ld-wrapper: use a temporary file for reponse file
reckenrode Apr 14, 2024
32e6a73
libtapi: 1100.0.11 -> 1500.0.12.3
reckenrode Apr 6, 2024
75f187f
ld64: init at 951.9
reckenrode Apr 9, 2024
98b073f
cctools: 973.0.1 -> 1010.6
reckenrode Apr 8, 2024
50e9069
fixDarwinDylibNames: use darwin.binutils not GNU binutils
reckenrode Apr 14, 2024
2454bab
binutils-wrapper: drop postLinkSignHook
reckenrode Apr 14, 2024
2bc87bf
libredirect: use llvmPackages unconditionally
reckenrode Apr 16, 2024
b8c9a83
darwin.stdenv: update for updated cctools and ld64 and cleanup
reckenrode Apr 14, 2024
7d6f457
darwin.cctools: delete in favor of top-level cctools
reckenrode Apr 30, 2024
802d326
balena-cli: use top-level cctools
reckenrode Apr 16, 2024
a792beb
base16-builder: use top-level cctools
reckenrode Apr 16, 2024
b48b08a
bazel_{5,6,7}: use top-level cctools and ld64
reckenrode Apr 16, 2024
71f22bf
bitwarden-cli: use top-level cctools
reckenrode Apr 16, 2024
0e59cfd
build-npm-package: use top-level cctools
reckenrode Apr 16, 2024
6f09a4d
catboost: use top-level cctools
reckenrode May 1, 2024
7d182cb
chez: use top-level cctools
reckenrode Apr 16, 2024
e29f1f4
chez-racket: use top-level cctools
reckenrode Apr 16, 2024
b3e4d1e
clightning: use top-level cctools
reckenrode Apr 16, 2024
5a58567
code-server: use top-level cctools
reckenrode Apr 16, 2024
2840b2c
curl-impersonate: use top-level cctools
reckenrode Apr 16, 2024
c38321d
cyclone: use top-level cctools
reckenrode Apr 16, 2024
3d3a9eb
dart: use top-level cctools
reckenrode Apr 16, 2024
fc06820
darwin.Libsytem: use top-level cctools
reckenrode Apr 15, 2024
8df1699
darwin.binutilsDualAs: use top-level cctools
reckenrode Apr 15, 2024
38801a6
darwin.sigtool: use top-level cctools
reckenrode Apr 16, 2024
955350a
defaultGemConfig: use top-level cctools
reckenrode Apr 16, 2024
b7805d4
dl-librescore: use top-level cctools
reckenrode Apr 16, 2024
89f325c
dotnet: get dwarfdump from ld64
reckenrode Apr 16, 2024
e2b2de2
elmPackages.nodejs: use top-level cctools
reckenrode Apr 16, 2024
8cca4ee
ethercalc: use top-level cctools
reckenrode Apr 16, 2024
e0e8ac0
frankenphp: use top-level cctools
reckenrode Apr 16, 2024
9de7437
freeimage: use top-level cctools
reckenrode Apr 16, 2024
9a8bcb3
hsd: use top-level cctools
reckenrode Apr 16, 2024
5df78a5
gargoyle: use top-level cctools
reckenrode Apr 16, 2024
08f4e9e
gcc: use top-level cctools
reckenrode Apr 16, 2024
37bacdb
gcc: update reference to replacement package
reckenrode Apr 16, 2024
aef921b
ghc-standalone-archive: use top-level cctools
reckenrode Apr 16, 2024
ba1034c
gn: use top-level cctools
reckenrode Apr 16, 2024
95d0423
gobject-introspection: use top-level cctools
reckenrode Apr 16, 2024
982469d
google-amber: use top-level cctools
reckenrode Apr 16, 2024
b6e9e80
homepage-dashboard: use top-level cctools
reckenrode Apr 16, 2024
471fa93
gstreamer: enable libunwind on Darwin
reckenrode Apr 16, 2024
bb44688
iosevka: use top-level cctools
reckenrode Apr 16, 2024
89002d8
llvmPackages_{12,13,14,15,16,17,18,git}.libunwind: provide .pc files
reckenrode Apr 17, 2024
2f35f54
libmcrypt: use top-level cctools
reckenrode Apr 16, 2024
22c7d1e
libplacebo: enable libunwind on Darwin
reckenrode Apr 16, 2024
143b1f5
libplacebo_5: use top-level cctools
reckenrode Apr 16, 2024
fd367dc
libunwind: use llvmPackages.libunwind on Darwin
reckenrode Apr 16, 2024
a6c5150
liquid-dsp: use top-level cctools
reckenrode Apr 16, 2024
ee7137c
live555: use top-level cctools
reckenrode Apr 16, 2024
4fb7db0
lp_solve: use top-level cctools
reckenrode Apr 16, 2024
2520e95
macdylibbundler: use top-level cctools
reckenrode Apr 16, 2024
8627f6f
macvim: use top-level libunwind
reckenrode Apr 16, 2024
d2e8666
mailpit: use top-level cctools
reckenrode Apr 16, 2024
9261663
make-bootstrap-tools: fix for cctools and ld64 updates
reckenrode Apr 16, 2024
1db832d
mariadb: use top-level cctools
reckenrode Apr 16, 2024
fc2ddce
mkl: use top-level cctools
reckenrode Apr 16, 2024
19eb020
mongodb-{5_0,6_0}: use top-level cctools
reckenrode Apr 16, 2024
48c8364
moreutils: use top-level cctools
reckenrode Apr 16, 2024
aed3fb9
mysql80: use top-level cctools
reckenrode Apr 16, 2024
ec6c9c5
mysql-shell: use top-level cctools
reckenrode Apr 16, 2024
019fee8
mx-puppet-discord: use top-level cctools
reckenrode Apr 16, 2024
a4b9eb7
n8n: use top-level cctools
reckenrode Apr 16, 2024
ec48a3b
netbsd.compat: use top-level cctools
reckenrode May 1, 2024
12c5824
netlify-cli: use top-level cctools
reckenrode Apr 16, 2024
e984284
nodePackages: use top-level cctools
reckenrode Apr 16, 2024
d22e009
nodehun: use top-level cctools
reckenrode Apr 16, 2024
7351ccb
nss: use top-level cctools
reckenrode Apr 16, 2024
001c7fc
onlykey: use top-level cctools
reckenrode Apr 16, 2024
c991dbd
openvscode-server: use top-level cctools
reckenrode Apr 16, 2024
a06917a
ponyc: use top-level cctools
reckenrode Apr 16, 2024
b8dc9a4
protoc-gen-js: use top-level cctools
reckenrode Apr 16, 2024
91529e4
petsc: use top-level cctools
reckenrode Apr 16, 2024
8889b02
playwright-test: use top-level cctools
reckenrode Apr 16, 2024
89f7bed
python: use top-level libunwind
reckenrode Apr 16, 2024
33affc7
python3Packages.jaxlib-build: use top-level cctools
reckenrode Apr 16, 2024
47ca7d7
python3Packages.miniupnpc: use top-level cctools
reckenrode Apr 16, 2024
10ef50d
python3Packages.tensorflow: use top-level cctools
reckenrode Apr 16, 2024
bdf594e
python3Packages.tensorflow-probability: use top-level cctools
reckenrode Apr 16, 2024
a9dc113
qt5: use top-level cctools and libunwind
reckenrode Apr 16, 2024
bb910ca
qt6: use top-level cctools and libunwind
reckenrode Apr 16, 2024
c49b518
rethinkdb: use top-level cctools
reckenrode Apr 16, 2024
c138998
rPackages.pbdZMQ: use top-level cctools
reckenrode Apr 16, 2024
3ff9dca
ruby: use top-level libunwind
reckenrode Apr 16, 2024
fbe2e9b
scummvm: use top-level cctools
reckenrode Apr 16, 2024
b450909
semantic-release: use top-level cctools
reckenrode Apr 16, 2024
92ab679
shaderc: use top-level cctools
reckenrode Apr 16, 2024
291d7e8
swift: use top-level cctools
reckenrode Apr 16, 2024
55a9d9f
thelounge: use top-level cctools
reckenrode Apr 16, 2024
f087df1
unicorn: use top-level cctools
reckenrode Apr 16, 2024
43fe178
valgrind: use top-level cctools
reckenrode Apr 16, 2024
b485212
xcbuild: use top-level cctools
reckenrode Apr 16, 2024
d057f76
xorg-xserver: fix build with LLVM libunwind
reckenrode May 18, 2024
d470622
darwin.binutils: refactor and clean up
reckenrode May 2, 2024
66a6915
darwin.{cctools,ld64,libtapi}: remove and add to darwin-aliases
reckenrode May 2, 2024
482de00
darwin.libunwind: remove and add to darwin-alaises
reckenrode Apr 16, 2024
00e7bbc
ghc: use unwrapped bintools on all platforms
reckenrode Apr 17, 2024
23f9bf3
rcodesign: disable impure tests
reckenrode Apr 18, 2024
7451d4d
darwin.AvailabilityVersions: init at 140.1
reckenrode Apr 19, 2024
8ebf5e6
darwin.Libsystem: get headers from AvailabilityVersions
reckenrode Apr 19, 2024
253339f
python3Packages.cffi: fix build with Darwin bootstrap clang
reckenrode Apr 22, 2024
0a91a4d
python3: enable LTO on Darwin
reckenrode Apr 22, 2024
7180ed0
cocotb: enable LTO on Darwin
reckenrode Apr 22, 2024
8b07d74
python3Packages.levenshtein: enable LTO on Darwin
reckenrode Apr 22, 2024
ab0340b
python3Packages.rapidfuzz: enable LTO on Darwin
reckenrode Apr 22, 2024
10be9ec
rubyPackages.sassc: enable LTO on Darwin
reckenrode Apr 22, 2024
575dc36
tracy: enable LTO on Darwin
reckenrode Apr 22, 2024
e665978
rgbds: enable LTO on Darwin
reckenrode Apr 22, 2024
46e4aa5
eduke32: enable LTO on Darwin
reckenrode Apr 22, 2024
447d4b5
stockfish: enable LTO on Darwin
reckenrode Apr 22, 2024
92a797a
firebird-emu: enable LTO on Darwin
reckenrode Apr 22, 2024
006e12e
timeloop: enable LTO on Darwin
reckenrode Apr 22, 2024
9f8f9f6
rvvm: enable LTO on Darwin
reckenrode Apr 22, 2024
6cc0ead
git: fix Darwin SDK check
reckenrode Apr 24, 2024
18d6b1e
SDL2: fix Darwin SDK checks
reckenrode Apr 24, 2024
d606172
darwin.apple_sdk.frameworks.CoreFoundation: drop hook
reckenrode Jan 28, 2024
e76e403
darwin.apple_sdk: drop NIX_COREFOUNDATION_RPATH
reckenrode Apr 25, 2024
e86e420
stdenv: set NIX_DONT_SET_RPATH_FOR_TARGET on Darwin
reckenrode Apr 25, 2024
48d4a06
bacula: fix build on Darwin
reckenrode Jan 28, 2024
b91f1eb
librsvg: use libobjc on both Darwin architectures
reckenrode Jan 30, 2024
20bc5c6
meson: fix extraframework dependencies on case-sensitive APFS
reckenrode Apr 5, 2024
58f2647
darwin.stdenv: prepare for Libsystem changes
reckenrode May 1, 2024
dd4623b
darwin.stdenvBootstrap: add for building Libsystem
reckenrode Sep 20, 2023
1333b24
darwin.apple_sdk_10_12: use stdenvNoCC instead of stdenv
reckenrode Dec 16, 2023
a475e61
darwin.configd: fix cross-compilation
reckenrode Sep 16, 2023
5ef7c65
darwin.Csu: fix cross-compilation
reckenrode Sep 16, 2023
5c8a532
darwin.Csu: don’t override startup object deployment targets
reckenrode May 19, 2024
4256013
darwin.libresolv: fix cross-compilation
reckenrode Sep 16, 2023
2566f1e
darwin.LibsystemCross: define on x86_64-darwin
reckenrode Sep 16, 2023
09ff165
darwin.Libsystem: add feature flag compatibility with 10.12 SDK
reckenrode Sep 20, 2023
c636f65
darwin.Libsystem: fix cross-builds and cleanup
reckenrode Sep 16, 2023
f410a82
darwin.objc4: use stdenvNoCF to support Darwin cross
reckenrode Sep 17, 2023
37a87d0
darwin.xnu: fix cross-compilation and cleanup
reckenrode Sep 16, 2023
ad4f254
fixDarwinDylibNames: fix targetPrefix when cross-compiling
reckenrode May 1, 2024
ec3e875
llvmPackages_16: fix Darwin cross-compilation
reckenrode May 1, 2024
b66e9be
swift-corelibs: use stdenvNoCF to support cross-compilation
reckenrode Sep 17, 2023
390fa12
swift-corelibs: enable static builds of CF
reckenrode Sep 17, 2023
942d34d
stdenv: use darwin.CF with Darwin cross-compilation
reckenrode Sep 17, 2023
4da4326
darwin.stdenv: propagate sdkRoot via extraBuildInputs
reckenrode May 1, 2024
f39ee74
abseil-cpp: only build for the host architecture
reckenrode May 4, 2024
2342d1f
boost: fix Darwin cross-compilation
reckenrode May 24, 2024
3fde4e2
boost-build: fix aarch64 clang cross-compilation
reckenrode May 25, 2024
9de03e5
curl: enable static builds on x86_64-darwin
reckenrode May 17, 2024
597aa1d
http-parser: fix cross-compilation
reckenrode May 24, 2024
6d7cab7
libpsl: fix cross-compilation
reckenrode May 24, 2024
5ad18d1
meson: use _accumFlagsArray
reckenrode May 19, 2024
d03d15d
python3: fix static builds on Darwin
reckenrode May 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pkgs/applications/blockchains/clightning/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ lib
, stdenv
, cctools
, darwin
, fetchurl
, autoconf
Expand Down Expand Up @@ -29,11 +30,11 @@ stdenv.mkDerivation rec {
sha256 = "sha256-KQS/4VmUxJkNpvPcxL5Up9f25leiPzvi2AiKuzRQmDo=";
};

# when building on darwin we need dawin.cctools to provide the correct libtool
# when building on darwin we need cctools to provide the correct libtool
# as libwally-core detects the host as darwin and tries to add the -static
# option to libtool, also we have to add the modified gsed package.
nativeBuildInputs = [ autoconf autogen automake gettext libtool lowdown protobuf py3 unzip which ]
++ lib.optionals stdenv.isDarwin [ darwin.cctools darwin.autoSignDarwinBinariesHook ];
++ lib.optionals stdenv.isDarwin [ cctools darwin.autoSignDarwinBinariesHook ];

buildInputs = [ gmp libsodium sqlite zlib ];

Expand Down
3 changes: 2 additions & 1 deletion pkgs/applications/editors/vim/macvim.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
, luajit
, darwin
, libiconv
, libunwind
, python3
}:

Expand Down Expand Up @@ -127,7 +128,7 @@ stdenv.mkDerivation {
--replace "PERL_CFLAGS =" "PERL_CFLAGS = -I${darwin.libutil}/include" \
--replace " -L${stdenv.cc.libc}/lib" "" \
--replace " -L${darwin.libobjc}/lib" "" \
--replace " -L${darwin.libunwind}/lib" "" \
--replace " -L${libunwind}/lib" "" \
--replace " -L${libiconv}/lib" ""

# All the libraries we stripped have -osx- in their name as of this time.
Expand Down
3 changes: 0 additions & 3 deletions pkgs/applications/emulators/firebird-emu/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ stdenv.mkDerivation rec {
hash = "sha256-ZptjlnOiF+hKuKYvBFJL95H5YQuR99d4biOco/MVEmE=";
};

# work around https://github.com/NixOS/nixpkgs/issues/19098
env.NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.cc.isClang && stdenv.isDarwin) "-fno-lto";

nativeBuildInputs = [ wrapQtAppsHook qmake ];

buildInputs = [ qtbase qtdeclarative qtquickcontrols ];
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/networking/irc/thelounge/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
, fixup-yarn-lock
, python3
, npmHooks
, darwin
, cctools
, sqlite
, srcOnly
, buildPackages
Expand Down Expand Up @@ -38,7 +38,7 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-MM6SgVT7Pjdu96A4eWRucEzT7uNPxBqUDgHKl8mH2C0=";
};

nativeBuildInputs = [ nodejs yarn fixup-yarn-lock python3 npmHooks.npmInstallHook ] ++ lib.optional stdenv.isDarwin darwin.cctools;
nativeBuildInputs = [ nodejs yarn fixup-yarn-lock python3 npmHooks.npmInstallHook ] ++ lib.optional stdenv.isDarwin cctools;
buildInputs = [ sqlite ];

configurePhase = ''
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/networking/n8n/node-composition.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let
nodeEnv = import ./node-env.nix {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
inherit pkgs nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
libtool = if pkgs.stdenv.isDarwin then pkgs.cctools else null;
};
in
import ./node-packages.nix {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ stdenv.mkDerivation rec {

enableParallelBuilding = true;

#link-time optimization fails on darwin
#see https://github.com/NixOS/nixpkgs/issues/19098
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-fno-lto";

postPatch = ''
# Fix gcc-13 build failure due to missing includes:
sed -e '1i #include <cstdint>' -i \
Expand Down
2 changes: 2 additions & 0 deletions pkgs/applications/version-management/git/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ stdenv.mkDerivation (finalAttrs: {
./git-sh-i18n.patch
./git-send-email-honor-PATH.patch
./installCheck-path.patch
# The source-based SDK uses a newer version of AvailabilityMacros.h that causes git to misdetect the SDK version.
./use-version-based-SDK-check.patch
] ++ lib.optionals withSsh [
./ssh-path.patch
];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 619cc16f0395f70315138cadaa16d2cf813a8603 Mon Sep 17 00:00:00 2001
From: Randy Eckenrode <[email protected]>
Date: Tue, 23 Apr 2024 21:36:17 -0400
Subject: [PATCH] Use version-based SDK check

---
compat/fsmonitor/fsm-listen-darwin.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compat/fsmonitor/fsm-listen-darwin.c b/compat/fsmonitor/fsm-listen-darwin.c
index 2fc67442eb..53851e1789 100644
--- a/compat/fsmonitor/fsm-listen-darwin.c
+++ b/compat/fsmonitor/fsm-listen-darwin.c
@@ -5,7 +5,7 @@
#include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h>

-#ifndef AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 101300
/*
* This enum value was added in 10.13 to:
*
--
2.42.0

5 changes: 1 addition & 4 deletions pkgs/applications/virtualization/rvvm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ stdenv.mkDerivation rec {

makeFlags = [ "PREFIX=$(out)" ]
++ lib.optional enableSDL "USE_SDL=2" # Use SDL2 instead of SDL1
++ lib.optional (!enableSDL && !enableX11) "USE_FB=0"

# work around https://github.com/NixOS/nixpkgs/issues/19098
++ lib.optional (stdenv.cc.isClang && stdenv.isDarwin) "CFLAGS=-fno-lto";
++ lib.optional (!enableSDL && !enableX11) "USE_FB=0";

meta = with lib; {
homepage = "https://github.com/LekKit/RVVM";
Expand Down
23 changes: 1 addition & 22 deletions pkgs/build-support/bintools-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@
# - static armv7l, where compilation fails.
&& !(targetPlatform.isAarch && targetPlatform.isStatic)
) "pie"

# Darwin code signing support utilities
, postLinkSignHook ? null, signingUtils ? null
}:

assert propagateDoc -> bintools ? man;
Expand Down Expand Up @@ -352,7 +349,7 @@ stdenvNoCC.mkDerivation {
##

# TODO(@sternenseemann): make a generic strip wrapper?
+ optionalString (bintools.isGNU or false) ''
+ optionalString (bintools.isGNU or false || bintools.isCCTools or false) ''
wrap ${targetPrefix}strip ${./gnu-binutils-strip-wrapper.sh} \
"${bintools_bin}/bin/${targetPrefix}strip"
''
Expand Down Expand Up @@ -391,24 +388,6 @@ stdenvNoCC.mkDerivation {
''
)

##
## Code signing on Apple Silicon
##
+ optionalString (targetPlatform.isDarwin && targetPlatform.isAarch64) ''
echo 'source ${postLinkSignHook}' >> $out/nix-support/post-link-hook

export signingUtils=${signingUtils}

wrap \
${targetPrefix}install_name_tool \
${./darwin-install_name_tool-wrapper.sh} \
"${bintools_bin}/bin/${targetPrefix}install_name_tool"

wrap \
${targetPrefix}strip ${./darwin-strip-wrapper.sh} \
"${bintools_bin}/bin/${targetPrefix}strip"
''

##
## Extra custom steps
##
Expand Down
17 changes: 7 additions & 10 deletions pkgs/build-support/bintools-wrapper/ld-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,6 @@ if [[ "$NIX_DONT_SET_RPATH_@suffixSalt@" != 1 && "$linkType" != static-pie ]]; t

fi

# This is outside the DONT_SET_RPATH branch because it's more targeted and we
# usually want it (on Darwin) even if DONT_SET_RPATH is set.
if [ -n "${NIX_COREFOUNDATION_RPATH:-}" ]; then
extraAfter+=(-rpath $NIX_COREFOUNDATION_RPATH)
fi

# Only add --build-id if this is a final link. FIXME: should build gcc
# with --enable-linker-build-id instead?
#
Expand All @@ -257,10 +251,13 @@ PATH="$path_backup"
# Old bash workaround, see above.

if (( "${NIX_LD_USE_RESPONSE_FILE:-@use_response_file_by_default@}" >= 1 )); then
@prog@ @<(printf "%q\n" \
${extraBefore+"${extraBefore[@]}"} \
${params+"${params[@]}"} \
${extraAfter+"${extraAfter[@]}"})
responseFile=$(mktemp "${TMPDIR:-/tmp}/ld-params.XXXXXX")
trap 'rm -f -- "$responseFile"' EXIT
printf "%q\n" \
${extraBefore+"${extraBefore[@]}"} \
${params+"${params[@]}"} \
${extraAfter+"${extraAfter[@]}"} > "$responseFile"
@prog@ "@$responseFile"
else
@prog@ \
${extraBefore+"${extraBefore[@]}"} \
Expand Down
19 changes: 6 additions & 13 deletions pkgs/build-support/libredirect/default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
{ lib, stdenv, bintools-unwrapped, llvmPackages, llvmPackages_13, coreutils }:

let
# aarch64-darwin needs a clang that can build arm64e binaries, so make sure a version of LLVM
# is used that can do that, but prefer the stdenv one if it is new enough.
llvmPkgs = if (lib.versionAtLeast (lib.getVersion llvmPackages.clang) "13")
then llvmPackages
else llvmPackages_13;
in
{ lib, stdenv, bintools-unwrapped, llvmPackages, coreutils }:

if stdenv.hostPlatform.isStatic
then throw ''
libredirect is not available on static builds.
Expand Down Expand Up @@ -46,11 +39,11 @@ else stdenv.mkDerivation rec {
# and the library search directory for libdl.
# We can't build this on x86_64, because the libSystem we point to doesn't
# like arm64(e).
PATH=${bintools-unwrapped}/bin:${llvmPkgs.clang-unwrapped}/bin:$PATH \
PATH=${bintools-unwrapped}/bin:${llvmPackages.clang-unwrapped}/bin:$PATH \
clang -arch x86_64 -arch arm64 -arch arm64e \
-isystem ${llvmPkgs.clang.libc}/include \
-isystem ${llvmPkgs.libclang.lib}/lib/clang/*/include \
-L${llvmPkgs.clang.libc}/lib \
-isystem ${llvmPackages.clang.libc}/include \
-isystem ${llvmPackages.libclang.lib}/lib/clang/*/include \
-L${llvmPackages.clang.libc}/lib \
-Wl,-install_name,$libName \
-Wall -std=c99 -O3 -fPIC libredirect.c \
-shared -o "$libName"
Expand Down
4 changes: 2 additions & 2 deletions pkgs/build-support/node/build-npm-package/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
, fetchNpmDeps
, buildPackages
, nodejs
, darwin
, cctools
} @ topLevelArgs:

{ name ? "${args.pname}-${args.version}"
Expand Down Expand Up @@ -76,7 +76,7 @@ stdenv.mkDerivation (args // {
(if npmInstallHook != null then npmInstallHook else npmHooks.npmInstallHook)
nodejs.python
]
++ lib.optionals stdenv.isDarwin [ darwin.cctools ];
++ lib.optionals stdenv.isDarwin [ cctools ];
buildInputs = buildInputs ++ [ nodejs ];

strictDeps = true;
Expand Down
4 changes: 2 additions & 2 deletions pkgs/by-name/bi/bitwarden-cli/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
, nodejs_18
, fetchFromGitHub
, python3
, darwin
, cctools
, nixosTests
}:

Expand All @@ -26,7 +26,7 @@ buildNpmPackage rec {
nativeBuildInputs = [
python3
] ++ lib.optionals stdenv.isDarwin [
darwin.cctools
cctools
];

makeCacheWritable = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
From 55b2a5fcc38eb62f53e155bd8c741481690f1c73 Mon Sep 17 00:00:00 2001
From: Randy Eckenrode <[email protected]>
Date: Wed, 10 Apr 2024 19:08:39 -0400
Subject: [PATCH 1/6] Fix build issues with misc/redo_prebinding.c

- Add missing headers; and
- Add missing arguments to `writeout`.
---
misc/redo_prebinding.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/misc/redo_prebinding.c b/misc/redo_prebinding.c
index a5a3c81..9d0f4c8 100644
--- a/misc/redo_prebinding.c
+++ b/misc/redo_prebinding.c
@@ -83,6 +83,7 @@
#include <mach-o/redo_prebinding.h>
#endif /* defined(LIBRARY_API) */

+#import <stdint.h>
#import <stdio.h>
#import <stdlib.h>
#import <string.h>
@@ -106,7 +107,7 @@
#import <stuff/hppa.h>
#import <stuff/execute.h>
#import <stuff/guess_short_name.h>
-//#import <stuff/seg_addr_table.h>
+#import <stuff/seg_addr_table.h>
#import <stuff/macosx_deployment_target.h>

#include <mach-o/dyld.h>
@@ -918,7 +919,7 @@ char *envp[])
if(write_to_stdout)
output_file = NULL;
writeout(archs, narchs, output_file, mode, TRUE, FALSE, FALSE,
- FALSE, NULL);
+ FALSE, FALSE, NULL);
if(errors){
if(write_to_stdout == FALSE)
unlink(output_file);
@@ -928,7 +929,7 @@ char *envp[])
else{
output_file = makestr(input_file, ".redo_prebinding", NULL);
writeout(archs, narchs, output_file, mode, TRUE, FALSE, FALSE,
- FALSE, NULL);
+ FALSE, FALSE, NULL);
if(errors){
unlink(output_file);
return(2);
--
2.44.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
From 645c61100ed6cc087237a645c6572931cbcd0d29 Mon Sep 17 00:00:00 2001
From: Randy Eckenrode <[email protected]>
Date: Wed, 10 Apr 2024 20:36:53 -0400
Subject: [PATCH 2/6] Rely on libcd_is_blob_a_linker_signature

---
libstuff/code_directory.c | 17 -----------------
1 file changed, 17 deletions(-)

diff --git a/libstuff/code_directory.c b/libstuff/code_directory.c
index 7c158fa..229e11a 100644
--- a/libstuff/code_directory.c
+++ b/libstuff/code_directory.c
@@ -146,22 +146,6 @@ static const char* format_version_xyz(uint32_t version)
*/
int codedir_is_linker_signed(const char* data, uint32_t size)
{
-#if 1
- // HACK: libcodedirectory.h is in both the macOS SDK in /usr/local/include, and in the tool chain at /usr/include.
- // but there is no way to control clang's search path to look in the toolchain first.
- // So, declare newer API locally. Once this new header is in all SDKs we can remove this.
- // Can't use real function name because it returns an enum type and we cannot define the enum
- // here because it will cause a duplicate definition when the header is updated.
- extern int my_libcd_is_blob_a_linker_signature(const uint8_t *buf, size_t buf_len, int *is_linker_signature) __asm("_libcd_is_blob_a_linker_signature");
- int ret;
- int linker_signed = 0;
-
- ret = my_libcd_is_blob_a_linker_signature((const uint8_t*)data,
- (size_t)size,
- &linker_signed);
- if ( (ret == 0) && linker_signed )
- return 1;
-#else
enum libcd_signature_query_ret ret = LIBCD_SIGNATURE_QUERY_SUCCESS;
int linker_signed = 0;

@@ -176,7 +160,6 @@ int codedir_is_linker_signed(const char* data, uint32_t size)
case LIBCD_SIGNATURE_QUERY_NOT_A_SIGNATURE:
;
}
-#endif
return 0;
}

--
2.44.0

Loading
Loading