lib/systems: use Darwin architecture names for config and uname (#393213)
This commit is contained in:
@@ -53,6 +53,8 @@
|
||||
- The hand written `perlPackages.SearchXapian` bindings have been dropped in favor of the (mostly compatible)
|
||||
`perlPackages.Xapian`.
|
||||
|
||||
- The `config` triple for `aarch64-darwin` has been changed from `aarch64-apple-darwin` to `arm64-apple-darwin` to match the Apple toolchain and LLVM’s expectations.
|
||||
|
||||
- [testers.shellcheck](https://nixos.org/manual/nixpkgs/unstable/#tester-shellcheck) now warns when `name` is not provided.
|
||||
The `name` argument will become mandatory in a future release.
|
||||
|
||||
@@ -81,6 +83,8 @@
|
||||
|
||||
- `i3status-rust`-package no longer enables `notmuch` by default. It can be enabled via `withNotmuch`.
|
||||
|
||||
- All support for 32‐bit Darwin systems has been dropped.
|
||||
|
||||
- Default ICU version updated from 74 to 76
|
||||
|
||||
- Apache Kafka was updated to `>= 4.0.0`. Please note that this is the first release which operates
|
||||
|
||||
@@ -209,6 +209,8 @@ let
|
||||
"ppc${optionalString final.isLittleEndian "le"}"
|
||||
else if final.isMips64 then
|
||||
"mips64" # endianness is *not* included on mips64
|
||||
else if final.isDarwin then
|
||||
final.darwinArch
|
||||
else
|
||||
final.parsed.cpu.name;
|
||||
|
||||
@@ -329,12 +331,7 @@ let
|
||||
else
|
||||
final.parsed.cpu.name;
|
||||
|
||||
darwinArch =
|
||||
{
|
||||
armv7a = "armv7";
|
||||
aarch64 = "arm64";
|
||||
}
|
||||
.${final.parsed.cpu.name} or final.parsed.cpu.name;
|
||||
darwinArch = parse.darwinArch final.parsed.cpu;
|
||||
|
||||
darwinPlatform =
|
||||
if final.isMacOS then
|
||||
@@ -488,8 +485,8 @@ let
|
||||
}
|
||||
.${cpu.name} or cpu.name;
|
||||
vendor_ = final.rust.platform.vendor;
|
||||
# TODO: deprecate args.rustc in favour of args.rust after 23.05 is EOL.
|
||||
in
|
||||
# TODO: deprecate args.rustc in favour of args.rust after 23.05 is EOL.
|
||||
args.rust.rustcTarget or args.rustc.config or (
|
||||
# Rust uses `wasm32-wasip?` rather than `wasm32-unknown-wasi`.
|
||||
# We cannot know which subversion does the user want, and
|
||||
|
||||
@@ -12,9 +12,7 @@ let
|
||||
|
||||
# Darwin
|
||||
"x86_64-darwin"
|
||||
"i686-darwin"
|
||||
"aarch64-darwin"
|
||||
"armv7a-darwin"
|
||||
|
||||
# FreeBSD
|
||||
"i686-freebsd"
|
||||
|
||||
@@ -276,7 +276,7 @@ rec {
|
||||
#
|
||||
|
||||
iphone64 = {
|
||||
config = "aarch64-apple-ios";
|
||||
config = "arm64-apple-ios";
|
||||
# config = "aarch64-apple-darwin14";
|
||||
darwinSdkVersion = "14.3";
|
||||
xcodeVer = "12.3";
|
||||
@@ -284,15 +284,6 @@ rec {
|
||||
useiOSPrebuilt = true;
|
||||
};
|
||||
|
||||
iphone32 = {
|
||||
config = "armv7a-apple-ios";
|
||||
# config = "arm-apple-darwin10";
|
||||
darwinSdkVersion = "14.3";
|
||||
xcodeVer = "12.3";
|
||||
xcodePlatform = "iPhoneOS";
|
||||
useiOSPrebuilt = true;
|
||||
};
|
||||
|
||||
iphone64-simulator = {
|
||||
config = "x86_64-apple-ios";
|
||||
# config = "x86_64-apple-darwin14";
|
||||
@@ -303,18 +294,8 @@ rec {
|
||||
useiOSPrebuilt = true;
|
||||
};
|
||||
|
||||
iphone32-simulator = {
|
||||
config = "i686-apple-ios";
|
||||
# config = "i386-apple-darwin11";
|
||||
darwinSdkVersion = "14.3";
|
||||
xcodeVer = "12.3";
|
||||
xcodePlatform = "iPhoneSimulator";
|
||||
darwinPlatform = "ios-simulator";
|
||||
useiOSPrebuilt = true;
|
||||
};
|
||||
|
||||
aarch64-darwin = {
|
||||
config = "aarch64-apple-darwin";
|
||||
config = "arm64-apple-darwin";
|
||||
xcodePlatform = "MacOSX";
|
||||
platform = { };
|
||||
};
|
||||
|
||||
+10
-1
@@ -396,6 +396,12 @@ rec {
|
||||
significantByte = littleEndian;
|
||||
family = "javascript";
|
||||
};
|
||||
}
|
||||
// {
|
||||
# aliases
|
||||
# Apple architecture name, as used by `darwinArch`; required by
|
||||
# LLVM ≥ 20.
|
||||
arm64 = cpuTypes.aarch64;
|
||||
};
|
||||
|
||||
# GNU build systems assume that older NetBSD architectures are using a.out.
|
||||
@@ -921,6 +927,8 @@ rec {
|
||||
|
||||
kernelName = kernel: kernel.name + toString (kernel.version or "");
|
||||
|
||||
darwinArch = cpu: if cpu.name == "aarch64" then "arm64" else cpu.name;
|
||||
|
||||
doubleFromSystem =
|
||||
{
|
||||
cpu,
|
||||
@@ -949,8 +957,9 @@ rec {
|
||||
kernel.name == "netbsd" && gnuNetBSDDefaultExecFormat cpu != kernel.execFormat
|
||||
) kernel.execFormat.name;
|
||||
optAbi = optionalString (abi != abis.unknown) "-${abi.name}";
|
||||
cpuName = if kernel.families ? darwin then darwinArch cpu else cpu.name;
|
||||
in
|
||||
"${cpu.name}-${vendor.name}-${kernelName kernel}${optExecFormat}${optAbi}";
|
||||
"${cpuName}-${vendor.name}-${kernelName kernel}${optExecFormat}${optAbi}";
|
||||
|
||||
################################################################################
|
||||
|
||||
|
||||
@@ -66,10 +66,8 @@ lib.runTests (
|
||||
"armv7l-linux"
|
||||
"armv7l-netbsd"
|
||||
"arm-none"
|
||||
"armv7a-darwin"
|
||||
];
|
||||
testarmv7 = mseteq armv7 [
|
||||
"armv7a-darwin"
|
||||
"armv7a-linux"
|
||||
"armv7l-linux"
|
||||
"armv7a-netbsd"
|
||||
@@ -84,7 +82,6 @@ lib.runTests (
|
||||
"i686-cygwin"
|
||||
"i686-windows"
|
||||
"i686-none"
|
||||
"i686-darwin"
|
||||
];
|
||||
testmips = mseteq mips [
|
||||
"mips-none"
|
||||
@@ -145,9 +142,7 @@ lib.runTests (
|
||||
];
|
||||
testdarwin = mseteq darwin [
|
||||
"x86_64-darwin"
|
||||
"i686-darwin"
|
||||
"aarch64-darwin"
|
||||
"armv7a-darwin"
|
||||
];
|
||||
testfreebsd = mseteq freebsd [
|
||||
"aarch64-freebsd"
|
||||
|
||||
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
|
||||
|
||||
installPhase =
|
||||
let
|
||||
processor = stdenv.hostPlatform.uname.processor;
|
||||
processor = stdenv.hostPlatform.parsed.cpu.name;
|
||||
sharedLibrary = stdenv.hostPlatform.extensions.sharedLibrary;
|
||||
in
|
||||
''
|
||||
|
||||
@@ -594,21 +594,14 @@ stdenv.mkDerivation (
|
||||
(lib.cmakeBool "LLVM_LINK_LLVM_DYLIB" enableSharedLibraries)
|
||||
(lib.cmakeFeature "LLVM_TABLEGEN" "${buildLlvmTools.tblgen}/bin/llvm-tblgen")
|
||||
];
|
||||
|
||||
triple =
|
||||
if stdenv.hostPlatform.isDarwin && lib.versionAtLeast release_version "20" then
|
||||
# JIT tests expect the triple to use Darwin arch's naming for CPU architectures.
|
||||
"${stdenv.hostPlatform.darwinArch}-apple-${stdenv.hostPlatform.darwinPlatform}"
|
||||
else
|
||||
stdenv.hostPlatform.config;
|
||||
in
|
||||
flagsForLlvmConfig
|
||||
++ [
|
||||
(lib.cmakeBool "LLVM_INSTALL_UTILS" true) # Needed by rustc
|
||||
(lib.cmakeBool "LLVM_BUILD_TESTS" finalAttrs.finalPackage.doCheck)
|
||||
(lib.cmakeBool "LLVM_ENABLE_FFI" true)
|
||||
(lib.cmakeFeature "LLVM_HOST_TRIPLE" triple)
|
||||
(lib.cmakeFeature "LLVM_DEFAULT_TARGET_TRIPLE" triple)
|
||||
(lib.cmakeFeature "LLVM_HOST_TRIPLE" stdenv.hostPlatform.config)
|
||||
(lib.cmakeFeature "LLVM_DEFAULT_TARGET_TRIPLE" stdenv.hostPlatform.config)
|
||||
(lib.cmakeBool "LLVM_ENABLE_DUMP" true)
|
||||
(lib.cmakeBool "LLVM_ENABLE_TERMINFO" enableTerminfo)
|
||||
(lib.cmakeBool "LLVM_INCLUDE_TESTS" finalAttrs.finalPackage.doCheck)
|
||||
|
||||
@@ -82,7 +82,6 @@ rec {
|
||||
# Platforms with host tools from
|
||||
# https://doc.rust-lang.org/nightly/rustc/platform-support.html
|
||||
"x86_64-darwin"
|
||||
"i686-darwin"
|
||||
"aarch64-darwin"
|
||||
"i686-freebsd"
|
||||
"x86_64-freebsd"
|
||||
@@ -110,7 +109,6 @@ rec {
|
||||
targetPlatforms = tier1TargetPlatforms ++ [
|
||||
# Platforms without host tools from
|
||||
# https://doc.rust-lang.org/nightly/rustc/platform-support.html
|
||||
"armv7a-darwin"
|
||||
"armv5tel-linux"
|
||||
"armv7a-linux"
|
||||
"m68k-linux"
|
||||
|
||||
@@ -72,12 +72,7 @@ let
|
||||
else
|
||||
targetPlatform.parsed.kernel.name;
|
||||
|
||||
# Apple Silicon uses a different CPU name in the target triple.
|
||||
swiftArch =
|
||||
if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 then
|
||||
"arm64"
|
||||
else
|
||||
targetPlatform.parsed.cpu.name;
|
||||
swiftArch = stdenv.hostPlatform.darwinArch;
|
||||
|
||||
# On Darwin, a `.swiftmodule` is a subdirectory in `lib/swift/<OS>`,
|
||||
# containing binaries for supported archs. On other platforms, binaries are
|
||||
|
||||
@@ -156,7 +156,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
nixSupport.cc-cflags =
|
||||
[
|
||||
"-target"
|
||||
"${stdenv.targetPlatform.parsed.cpu.name}-${stdenv.targetPlatform.parsed.kernel.name}-${stdenv.targetPlatform.parsed.abi.name}"
|
||||
"${stdenv.targetPlatform.config}"
|
||||
]
|
||||
++ lib.optional (
|
||||
stdenv.targetPlatform.isLinux && !(stdenv.targetPlatform.isStatic or false)
|
||||
|
||||
@@ -54,9 +54,7 @@ stdenv.mkDerivation rec {
|
||||
else if stdenv.hostPlatform.system == "aarch64-darwin" then
|
||||
"macosx"
|
||||
else if stdenv.hostPlatform.system == "x86_64-darwin" then
|
||||
"macosx-thr"
|
||||
else if stdenv.hostPlatform.system == "i686-darwin" then
|
||||
"macosx-64-thr"
|
||||
"macosx-x86-64-thr"
|
||||
else if stdenv.hostPlatform.system == "i686-cygwin" then
|
||||
"win32"
|
||||
else if stdenv.hostPlatform.system == "x86_64-freebsd" then
|
||||
|
||||
@@ -84,7 +84,6 @@ buildPythonPackage rec {
|
||||
"i686-linux" = "-shared -o attach_linux_x86.so";
|
||||
"aarch64-linux" = "-shared -o attach_linux_arm64.so";
|
||||
"x86_64-darwin" = "-D_REENTRANT -dynamiclib -lc -o attach_x86_64.dylib";
|
||||
"i686-darwin" = "-D_REENTRANT -dynamiclib -lc -o attach_x86.dylib";
|
||||
"aarch64-darwin" = "-D_REENTRANT -dynamiclib -lc -o attach_arm64.dylib";
|
||||
}
|
||||
.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}")
|
||||
@@ -147,7 +146,6 @@ buildPythonPackage rec {
|
||||
"i686-linux"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"i686-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
};
|
||||
|
||||
@@ -41,7 +41,6 @@ let
|
||||
x86_64-linux = "linux";
|
||||
i686-linux = "linux32";
|
||||
x86_64-darwin = "osx";
|
||||
i686-darwin = "osx32";
|
||||
x86_64-cygwin = "win";
|
||||
i686-cygwin = "win32";
|
||||
};
|
||||
|
||||
@@ -48,23 +48,24 @@ mkAppleDerivation (finalAttrs: {
|
||||
|
||||
configureFlags = [
|
||||
"--with-gcc-arch=generic" # no detection of -march= or -mtune=
|
||||
"--enable-builddir=build"
|
||||
];
|
||||
|
||||
postConfigure = ''
|
||||
# Use Apple’s configuration instead of the one generated by the `configure` script.
|
||||
cp darwin/include/fficonfig_${stdenv.hostPlatform.darwinArch}.h ${stdenv.hostPlatform.config}/fficonfig.h
|
||||
cp darwin/include/fficonfig_${stdenv.hostPlatform.darwinArch}.h build/fficonfig.h
|
||||
cp darwin/include/ffitarget_${
|
||||
if stdenv.hostPlatform.isAarch64 then "arm64" else "x86"
|
||||
}.h ${stdenv.hostPlatform.config}/include/ffitarget.h
|
||||
}.h build/include/ffitarget.h
|
||||
# Use `macCatalyst` instead of `iosmac` to avoid errors due to invalid availability annotations.
|
||||
substitute darwin/include/ffi.h ${stdenv.hostPlatform.config}/include/ffi.h \
|
||||
substitute darwin/include/ffi.h build/include/ffi.h \
|
||||
--replace-fail iosmac macCatalyst
|
||||
'';
|
||||
|
||||
postBuild = lib.optionalString stdenv.hostPlatform.isAarch64 ''
|
||||
$CC -Os -Wl,-allowable_client,! -Wl,-not_for_dyld_shared_cache -Wl,-no_compact_unwind \
|
||||
src/aarch64/trampoline.S -dynamiclib -o libffi-trampolines.dylib \
|
||||
-Iinclude -Iaarch64-apple-darwin -Iaarch64-apple-darwin/include \
|
||||
-Iinclude -Ibuild -Ibuild/include \
|
||||
-install_name "$out/lib/libffi-trampoline.dylib" -Wl,-compatibility_version,1 -Wl,-current_version,1
|
||||
'';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user