mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 19:55:41 +03:00
lib/systems: use Darwin architecture names for config
and uname
`aarch64-apple-darwin` no longer works with LLVM 20.
This commit is contained in:
parent
1e6ab3434f
commit
61582c7043
9 changed files with 28 additions and 31 deletions
|
@ -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.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -276,7 +276,7 @@ rec {
|
|||
#
|
||||
|
||||
iphone64 = {
|
||||
config = "aarch64-apple-ios";
|
||||
config = "arm64-apple-ios";
|
||||
# config = "aarch64-apple-darwin14";
|
||||
darwinSdkVersion = "14.3";
|
||||
xcodeVer = "12.3";
|
||||
|
@ -295,7 +295,7 @@ rec {
|
|||
};
|
||||
|
||||
aarch64-darwin = {
|
||||
config = "aarch64-apple-darwin";
|
||||
config = "arm64-apple-darwin";
|
||||
xcodePlatform = "MacOSX";
|
||||
platform = { };
|
||||
};
|
||||
|
|
|
@ -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}";
|
||||
|
||||
################################################################################
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
'';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue