Merge pull request #307880 from reckenrode/ld64
cctools: 973.0.1 -> 1010.6
This commit is contained in:
commit
c3c5870e96
@ -60,9 +60,6 @@
|
||||
(!(targetPlatform.isAarch && targetPlatform.isStatic))
|
||||
])
|
||||
]) "pie"
|
||||
|
||||
# Darwin code signing support utilities
|
||||
, postLinkSignHook ? null, signingUtils ? null
|
||||
}:
|
||||
|
||||
assert propagateDoc -> bintools ? man;
|
||||
@ -357,7 +354,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"
|
||||
''
|
||||
@ -396,24 +393,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
|
||||
##
|
||||
|
@ -257,10 +257,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[@]}"} \
|
||||
|
@ -1,12 +1,5 @@
|
||||
{ lib, stdenv, bintools-unwrapped, llvmPackages, llvmPackages_13, coreutils }:
|
||||
{ lib, stdenv, bintools-unwrapped, llvmPackages, 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
|
||||
if stdenv.hostPlatform.isStatic
|
||||
then throw ''
|
||||
libredirect is not available on static builds.
|
||||
@ -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"
|
||||
|
@ -0,0 +1,53 @@
|
||||
From 55b2a5fcc38eb62f53e155bd8c741481690f1c73 Mon Sep 17 00:00:00 2001
|
||||
From: Randy Eckenrode <randy@largeandhighquality.com>
|
||||
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.45.2
|
||||
|
@ -0,0 +1,25 @@
|
||||
From 419c469634891d09f6688d56da9e26431018f342 Mon Sep 17 00:00:00 2001
|
||||
From: Randy Eckenrode <randy@largeandhighquality.com>
|
||||
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 | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libstuff/code_directory.c b/libstuff/code_directory.c
|
||||
index 7c158fa..3b8eb77 100644
|
||||
--- a/libstuff/code_directory.c
|
||||
+++ b/libstuff/code_directory.c
|
||||
@@ -146,7 +146,7 @@ static const char* format_version_xyz(uint32_t version)
|
||||
*/
|
||||
int codedir_is_linker_signed(const char* data, uint32_t size)
|
||||
{
|
||||
-#if 1
|
||||
+#if 0
|
||||
// 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.
|
||||
--
|
||||
2.45.2
|
||||
|
@ -0,0 +1,50 @@
|
||||
From 989ba5e30cefa0dd8990da158661713c4a21c0fe Mon Sep 17 00:00:00 2001
|
||||
From: Randy Eckenrode <randy@largeandhighquality.com>
|
||||
Date: Thu, 11 Apr 2024 18:05:34 -0400
|
||||
Subject: [PATCH 3/6] Fix utimensat compatability with the 10.12 SDK
|
||||
|
||||
---
|
||||
include/compat.h | 3 +++
|
||||
libstuff/writeout.c | 2 +-
|
||||
misc/lipo.c | 2 +-
|
||||
3 files changed, 5 insertions(+), 2 deletions(-)
|
||||
create mode 100644 include/compat.h
|
||||
|
||||
diff --git a/include/compat.h b/include/compat.h
|
||||
new file mode 100644
|
||||
index 0000000..8b1b866
|
||||
--- /dev/null
|
||||
+++ b/include/compat.h
|
||||
@@ -0,0 +1,3 @@
|
||||
+#pragma once
|
||||
+#include <time.h>
|
||||
+extern int utimensat(int dirfd, const char* pathname, const struct timespec times[_Nullable 2], int flags);
|
||||
diff --git a/libstuff/writeout.c b/libstuff/writeout.c
|
||||
index f904caa..03fa535 100644
|
||||
--- a/libstuff/writeout.c
|
||||
+++ b/libstuff/writeout.c
|
||||
@@ -297,7 +297,7 @@ no_throttle:
|
||||
* have been zeroed out when the library was created. writeout
|
||||
* will not zero out the modification time in the filesystem.
|
||||
*/
|
||||
- if (__builtin_available(macOS 10.12, *)) {
|
||||
+ if (__builtin_available(macOS 10.13, *)) {
|
||||
struct timespec times[2] = {0};
|
||||
memcpy(×[0], &toc_timespec, sizeof(struct timespec));
|
||||
memcpy(×[1], &toc_timespec, sizeof(struct timespec));
|
||||
diff --git a/misc/lipo.c b/misc/lipo.c
|
||||
index 04a3eca..887c049 100644
|
||||
--- a/misc/lipo.c
|
||||
+++ b/misc/lipo.c
|
||||
@@ -607,7 +607,7 @@ unknown_flag:
|
||||
if(close(fd) == -1)
|
||||
system_fatal("can't close output file: %s",output_file);
|
||||
#ifndef __OPENSTEP__
|
||||
- if (__builtin_available(macOS 10.12, *)) {
|
||||
+ if (__builtin_available(macOS 10.13, *)) {
|
||||
time_result = utimensat(AT_FDCWD, output_file,
|
||||
output_times, 0);
|
||||
}
|
||||
--
|
||||
2.45.2
|
||||
|
@ -0,0 +1,57 @@
|
||||
From 86b5ad551ef0ffc7ca4da24b7619937bec738522 Mon Sep 17 00:00:00 2001
|
||||
From: Randy Eckenrode <randy@largeandhighquality.com>
|
||||
Date: Mon, 15 Apr 2024 20:47:59 -0400
|
||||
Subject: [PATCH 4/6] Use nixpkgs clang with the assembler driver
|
||||
|
||||
---
|
||||
as/driver.c | 20 +++-----------------
|
||||
1 file changed, 3 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/as/driver.c b/as/driver.c
|
||||
index a0d49ad..c15dcbf 100644
|
||||
--- a/as/driver.c
|
||||
+++ b/as/driver.c
|
||||
@@ -36,7 +36,7 @@ char **envp)
|
||||
char *p, c, *arch_name, *as, *as_local;
|
||||
char **new_argv;
|
||||
const char *CLANG = "clang";
|
||||
- char *prefix, buf[MAXPATHLEN], resolved_name[PATH_MAX];
|
||||
+ char *prefix = "@clang-unwrapped@/bin/";
|
||||
uint32_t bufsize;
|
||||
struct arch_flag arch_flag;
|
||||
const struct arch_flag *arch_flags, *family_arch_flag;
|
||||
@@ -50,22 +50,6 @@ char **envp)
|
||||
qflag = FALSE;
|
||||
Qflag = FALSE;
|
||||
some_input_files = FALSE;
|
||||
- /*
|
||||
- * Construct the prefix to the assembler driver.
|
||||
- */
|
||||
- bufsize = MAXPATHLEN;
|
||||
- p = buf;
|
||||
- i = _NSGetExecutablePath(p, &bufsize);
|
||||
- if(i == -1){
|
||||
- p = allocate(bufsize);
|
||||
- _NSGetExecutablePath(p, &bufsize);
|
||||
- }
|
||||
- prefix = realpath(p, resolved_name);
|
||||
- if(prefix == NULL)
|
||||
- system_fatal("realpath(3) for %s failed", p);
|
||||
- p = rindex(prefix, '/');
|
||||
- if(p != NULL)
|
||||
- p[1] = '\0';
|
||||
/*
|
||||
* Process the assembler flags exactly like the assembler would (except
|
||||
* let the assembler complain about multiple flags, bad combinations of
|
||||
@@ -362,6 +346,8 @@ char **envp)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
+ prefix = "@gas@/bin/"; /* `libexec` is found relative to the assembler driver’s path. */
|
||||
+
|
||||
/*
|
||||
* If this assembler exist try to run it else print an error message.
|
||||
*/
|
||||
--
|
||||
2.45.2
|
||||
|
28
pkgs/by-name/cc/cctools/0005-Find-ld64-in-the-store.patch
Normal file
28
pkgs/by-name/cc/cctools/0005-Find-ld64-in-the-store.patch
Normal file
@ -0,0 +1,28 @@
|
||||
From e62f7d75380540937f24f896c82736a1e653cc75 Mon Sep 17 00:00:00 2001
|
||||
From: Randy Eckenrode <randy@largeandhighquality.com>
|
||||
Date: Mon, 22 Apr 2024 18:15:53 -0400
|
||||
Subject: [PATCH 5/6] Find ld64 in the store
|
||||
|
||||
---
|
||||
libstuff/execute.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/libstuff/execute.c b/libstuff/execute.c
|
||||
index 8526ab7..abbbf1b 100644
|
||||
--- a/libstuff/execute.c
|
||||
+++ b/libstuff/execute.c
|
||||
@@ -149,6 +149,11 @@ char *
|
||||
cmd_with_prefix(
|
||||
char *str)
|
||||
{
|
||||
+ // Return the path to ld64 in the store.
|
||||
+ if (strcmp(str, "ld") == 0) {
|
||||
+ return "@ld64_path@";
|
||||
+ }
|
||||
+
|
||||
int i;
|
||||
char *p;
|
||||
char *prefix, buf[MAXPATHLEN], resolved_name[PATH_MAX];
|
||||
--
|
||||
2.45.2
|
||||
|
@ -0,0 +1,30 @@
|
||||
From e25de788260051892b9e34177ea957cbafe6c415 Mon Sep 17 00:00:00 2001
|
||||
From: Randy Eckenrode <randy@largeandhighquality.com>
|
||||
Date: Thu, 2 May 2024 07:55:05 -0400
|
||||
Subject: [PATCH 6/6] Support target prefixes in ranlib detection
|
||||
|
||||
---
|
||||
misc/libtool.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/misc/libtool.c b/misc/libtool.c
|
||||
index 289ec4d..8265d53 100644
|
||||
--- a/misc/libtool.c
|
||||
+++ b/misc/libtool.c
|
||||
@@ -426,11 +426,11 @@ char **envp)
|
||||
p++;
|
||||
else
|
||||
p = argv[0];
|
||||
- if(strncmp(p, "ranlib", sizeof("ranlib") - 1) == 0) {
|
||||
+ if(strncmp(p, "@targetPrefix@ranlib", sizeof("@targetPrefix@ranlib") - 1) == 0) {
|
||||
cmd_flags.ranlib = TRUE;
|
||||
}
|
||||
else if (getenv("LIBTOOL_FORCE_RANLIB")) {
|
||||
- progname = "ranlib";
|
||||
+ progname = "@targetPrefix@ranlib";
|
||||
cmd_flags.ranlib = TRUE;
|
||||
}
|
||||
|
||||
--
|
||||
2.45.2
|
||||
|
657
pkgs/by-name/cc/cctools/meson.build
Normal file
657
pkgs/by-name/cc/cctools/meson.build
Normal file
@ -0,0 +1,657 @@
|
||||
# Build settings based on the upstream Xcode project.
|
||||
# See: https://github.com/apple-oss-distributions/cctools/blob/main/cctools.xcodeproj/project.pbxproj
|
||||
|
||||
# Project settings
|
||||
project(
|
||||
'cctools',
|
||||
'c',
|
||||
version : '@version@',
|
||||
default_options : {
|
||||
'c_args': [
|
||||
'-DCCTB_MACOS=YES',
|
||||
'-DCCTB_PROJECT=cctools',
|
||||
'-DCCTB_PROJVERS=cctools-@version@',
|
||||
'-DCCTB_VERSION=@version@',
|
||||
'-DCURRENT_PROJECT_VERSION="@version@"',
|
||||
'-DCODEDIRECTORY_SUPPORT',
|
||||
'-DLTO_SUPPORT',
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
fs = import('fs')
|
||||
|
||||
# Options
|
||||
target_prefix = get_option('target_prefix')
|
||||
|
||||
|
||||
# Dependencies
|
||||
cc = meson.get_compiler('c')
|
||||
|
||||
libcodedirectory = cc.find_library('codedirectory')
|
||||
libprunetrie = cc.find_library('prunetrie')
|
||||
|
||||
|
||||
# Feature tests
|
||||
# Add compatibility header for Darwin SDKs that don’t define `utimensat`.
|
||||
utimensat_test = '''
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
int main(int argc, char* argv[]) {
|
||||
utimensat(AT_FDCWD, NULL, NULL, 0);
|
||||
return 0;
|
||||
}
|
||||
'''
|
||||
if host_machine.system() == 'darwin' and not cc.compiles(utimensat_test, name : 'supports utimensat')
|
||||
add_project_arguments('-include', 'compat.h', language : 'c')
|
||||
add_project_link_arguments('-undefined', 'dynamic_lookup', language : 'c')
|
||||
endif
|
||||
|
||||
|
||||
incdirs = include_directories('include')
|
||||
|
||||
# Static libraries
|
||||
libstuff = static_library(
|
||||
'stuff',
|
||||
c_args : [
|
||||
'-DCPU_TYPE_RISCV32=24', # Per src/abstraction/MachOFileAbstraction.hpp from ld64
|
||||
],
|
||||
include_directories : [incdirs, 'include/stuff'],
|
||||
sources : [
|
||||
'libstuff/SymLoc.c',
|
||||
'libstuff/align.c',
|
||||
'libstuff/allocate.c',
|
||||
'libstuff/apple_version.c',
|
||||
'libstuff/arch.c',
|
||||
'libstuff/arch_usage.c',
|
||||
'libstuff/args.c',
|
||||
'libstuff/best_arch.c',
|
||||
'libstuff/breakout.c',
|
||||
'libstuff/bytesex.c',
|
||||
'libstuff/checkout.c',
|
||||
'libstuff/code_directory.c',
|
||||
'libstuff/coff_bytesex.c',
|
||||
'libstuff/crc32.c',
|
||||
'libstuff/depinfo.c',
|
||||
'libstuff/diagnostics.c',
|
||||
'libstuff/dylib_roots.c',
|
||||
'libstuff/dylib_table.c',
|
||||
'libstuff/errors.c',
|
||||
'libstuff/execute.c',
|
||||
'libstuff/fatal_arch.c',
|
||||
'libstuff/fatals.c',
|
||||
'libstuff/get_arch_from_host.c',
|
||||
'libstuff/get_toc_byte_sex.c',
|
||||
'libstuff/guess_short_name.c',
|
||||
'libstuff/hash_string.c',
|
||||
'libstuff/hppa.c',
|
||||
'libstuff/llvm.c',
|
||||
'libstuff/lto.c',
|
||||
'libstuff/macosx_deployment_target.c',
|
||||
'libstuff/ofile.c',
|
||||
'libstuff/ofile_error.c',
|
||||
'libstuff/ofile_get_word.c',
|
||||
'libstuff/print.c',
|
||||
'libstuff/reloc.c',
|
||||
'libstuff/rnd.c',
|
||||
'libstuff/seg_addr_table.c',
|
||||
'libstuff/set_arch_flag_name.c',
|
||||
'libstuff/swap_headers.c',
|
||||
'libstuff/symbol_list.c',
|
||||
'libstuff/unix_standard_mode.c',
|
||||
'libstuff/version_number.c',
|
||||
'libstuff/vm_flush_cache.c',
|
||||
'libstuff/write64.c',
|
||||
'libstuff/writeout.c',
|
||||
'libstuff/xcode.c',
|
||||
],
|
||||
)
|
||||
|
||||
libstuff_otool = static_library(
|
||||
'stuff_otool',
|
||||
c_args : [
|
||||
'-DCPU_TYPE_RISCV32=24', # Per src/abstraction/MachOFileAbstraction.hpp from ld64
|
||||
],
|
||||
include_directories : [incdirs, 'include/stuff', 'otool'],
|
||||
sources : [
|
||||
'libstuff/SymLoc.c',
|
||||
'libstuff/align.c',
|
||||
'libstuff/allocate.c',
|
||||
'libstuff/apple_version.c',
|
||||
'libstuff/arch.c',
|
||||
'libstuff/arch_usage.c',
|
||||
'libstuff/args.c',
|
||||
'libstuff/best_arch.c',
|
||||
'libstuff/breakout.c',
|
||||
'libstuff/bytesex.c',
|
||||
'libstuff/checkout.c',
|
||||
'libstuff/code_directory.c',
|
||||
'libstuff/coff_bytesex.c',
|
||||
'libstuff/crc32.c',
|
||||
'libstuff/depinfo.c',
|
||||
'libstuff/diagnostics.c',
|
||||
'libstuff/dylib_roots.c',
|
||||
'libstuff/dylib_table.c',
|
||||
'libstuff/errors.c',
|
||||
'libstuff/execute.c',
|
||||
'libstuff/fatal_arch.c',
|
||||
'libstuff/fatals.c',
|
||||
'libstuff/get_arch_from_host.c',
|
||||
'libstuff/get_toc_byte_sex.c',
|
||||
'libstuff/guess_short_name.c',
|
||||
'libstuff/hash_string.c',
|
||||
'libstuff/hppa.c',
|
||||
'libstuff/llvm.c',
|
||||
'libstuff/lto.c',
|
||||
'libstuff/macosx_deployment_target.c',
|
||||
'libstuff/ofile.c',
|
||||
'libstuff/ofile_error.c',
|
||||
'libstuff/ofile_get_word.c',
|
||||
'libstuff/print.c',
|
||||
'libstuff/reloc.c',
|
||||
'libstuff/rnd.c',
|
||||
'libstuff/seg_addr_table.c',
|
||||
'libstuff/set_arch_flag_name.c',
|
||||
'libstuff/swap_headers.c',
|
||||
'libstuff/symbol_list.c',
|
||||
'libstuff/unix_standard_mode.c',
|
||||
'libstuff/version_number.c',
|
||||
'libstuff/vm_flush_cache.c',
|
||||
'libstuff/write64.c',
|
||||
'libstuff/writeout.c',
|
||||
'libstuff/xcode.c',
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
# Binaries
|
||||
ar = executable(
|
||||
f'@target_prefix@ar',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : [
|
||||
'ar/append.c',
|
||||
'ar/ar.c',
|
||||
'ar/archive.c',
|
||||
'ar/contents.c',
|
||||
'ar/delete.c',
|
||||
'ar/extract.c',
|
||||
'ar/misc.c',
|
||||
'ar/move.c',
|
||||
'ar/print.c',
|
||||
'ar/replace.c',
|
||||
],
|
||||
)
|
||||
install_man(
|
||||
'ar/ar.1',
|
||||
'ar/ar.5',
|
||||
)
|
||||
|
||||
as = executable(
|
||||
f'@target_prefix@gas',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['as/driver.c'],
|
||||
)
|
||||
|
||||
as_common = files(
|
||||
'as/app.c',
|
||||
'as/as.c',
|
||||
'as/atof-generic.c',
|
||||
'as/atof-ieee.c',
|
||||
'as/dwarf2dbg.c',
|
||||
'as/expr.c',
|
||||
'as/fixes.c',
|
||||
'as/flonum-const.c',
|
||||
'as/flonum-copy.c',
|
||||
'as/flonum-mult.c',
|
||||
'as/frags.c',
|
||||
'as/hash.c',
|
||||
'as/hex-value.c',
|
||||
'as/input-file.c',
|
||||
'as/input-scrub.c',
|
||||
'as/layout.c',
|
||||
'as/messages.c',
|
||||
'as/obstack.c',
|
||||
'as/read.c',
|
||||
'as/sections.c',
|
||||
'as/symbols.c',
|
||||
'as/write_object.c',
|
||||
'as/xmalloc.c',
|
||||
)
|
||||
|
||||
as_arm = executable(
|
||||
'as-arm',
|
||||
c_args : [
|
||||
'-DARM',
|
||||
'-DNeXT_MOD',
|
||||
],
|
||||
include_directories : [
|
||||
incdirs,
|
||||
'as',
|
||||
'include/gnu',
|
||||
],
|
||||
install : true,
|
||||
install_dir : 'libexec/as/arm',
|
||||
link_with : [libstuff],
|
||||
sources : [as_common, 'as/arm.c'],
|
||||
)
|
||||
|
||||
as_i386 = executable(
|
||||
'as-i386',
|
||||
c_args : [
|
||||
'-DI386',
|
||||
'-Di486',
|
||||
'-Di586',
|
||||
'-Di686',
|
||||
'-DNeXT_MOD',
|
||||
],
|
||||
include_directories : [
|
||||
incdirs,
|
||||
'as',
|
||||
'include/gnu',
|
||||
],
|
||||
install : true,
|
||||
install_dir : 'libexec/as/i386',
|
||||
link_with : [libstuff],
|
||||
sources : [as_common, 'as/i386.c'],
|
||||
)
|
||||
|
||||
as_x86_64 = executable(
|
||||
'as-x86_64',
|
||||
c_args : [
|
||||
'-DI386',
|
||||
'-Di486',
|
||||
'-Di586',
|
||||
'-Di686',
|
||||
'-DARCH64',
|
||||
'-DNeXT_MOD',
|
||||
],
|
||||
include_directories : [
|
||||
incdirs,
|
||||
'as',
|
||||
'include/gnu'
|
||||
],
|
||||
install : true,
|
||||
install_dir : 'libexec/as/x86_64',
|
||||
link_with : [libstuff],
|
||||
sources : [as_common, 'as/i386.c'],
|
||||
)
|
||||
|
||||
# # ld # excluded because ld64 is built separately
|
||||
|
||||
bitcode_strip = executable(
|
||||
f'@target_prefix@bitcode_strip',
|
||||
dependencies : [libcodedirectory],
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/bitcode_strip.c'],
|
||||
)
|
||||
install_man('man/bitcode_strip.1')
|
||||
|
||||
check_dylib = executable(
|
||||
f'@target_prefix@check_dylib',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/check_dylib.c'],
|
||||
)
|
||||
install_man('man/check_dylib.1')
|
||||
|
||||
checksyms = executable(
|
||||
f'@target_prefix@checksyms',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/checksyms.c'],
|
||||
)
|
||||
install_man('man/checksyms.1')
|
||||
|
||||
cmpdylib = executable(
|
||||
f'@target_prefix@cmpdylib',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/cmpdylib.c'],
|
||||
)
|
||||
install_man('man/cmpdylib.1')
|
||||
|
||||
codesign_allocate = executable(
|
||||
f'@target_prefix@codesign_allocate',
|
||||
dependencies : [libcodedirectory],
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/codesign_allocate.c'],
|
||||
)
|
||||
install_man('man/codesign_allocate.1')
|
||||
|
||||
ctf_insert = executable(
|
||||
f'@target_prefix@ctf_insert',
|
||||
dependencies : [libcodedirectory],
|
||||
include_directories : [incdirs, 'include/stuff'],
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/ctf_insert.c'],
|
||||
)
|
||||
install_man('man/ctf_insert.1')
|
||||
|
||||
depinfo = executable(
|
||||
f'@target_prefix@depinfo',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/depinfo.c'],
|
||||
)
|
||||
install_man('man/depinfo.1')
|
||||
|
||||
diagtest = executable(
|
||||
f'@target_prefix@diagtest',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/diagtest.c'],
|
||||
)
|
||||
install_man('man/diagtest.1')
|
||||
|
||||
gprof = executable(
|
||||
f'@target_prefix@gprof',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : [
|
||||
'gprof/arcs.c',
|
||||
'gprof/calls.c',
|
||||
'gprof/dfn.c',
|
||||
'gprof/getnfile.c',
|
||||
'gprof/gprof.c',
|
||||
'gprof/hertz.c',
|
||||
'gprof/lookup.c',
|
||||
'gprof/printgprof.c',
|
||||
'gprof/printlist.c',
|
||||
'gprof/scatter.c',
|
||||
],
|
||||
)
|
||||
install_man('man/gprof.1')
|
||||
|
||||
# Not supported on 64-bit architectures
|
||||
# indr = executable(
|
||||
# f'@target_prefix@indr',
|
||||
# include_directories : incdirs,
|
||||
# sources : ['misc/indr.c'],
|
||||
# )
|
||||
# install_man('man/indr.1')
|
||||
|
||||
install_name_tool = executable(
|
||||
f'@target_prefix@install_name_tool',
|
||||
dependencies : [libcodedirectory],
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/install_name_tool.c'],
|
||||
)
|
||||
install_man('man/install_name_tool.1')
|
||||
|
||||
libtool = executable(
|
||||
f'@target_prefix@libtool',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/libtool.c'],
|
||||
)
|
||||
install_man('man/libtool.1')
|
||||
|
||||
lipo = executable(
|
||||
f'@target_prefix@lipo',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/lipo.c'],
|
||||
)
|
||||
install_man('man/lipo.1')
|
||||
|
||||
mtoc = executable(
|
||||
f'@target_prefix@mtoc',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['efitools/mtoc.c'],
|
||||
)
|
||||
install_man('man/mtoc.1')
|
||||
|
||||
mtor = executable(
|
||||
f'@target_prefix@mtor',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['efitools/mtor.c'],
|
||||
)
|
||||
install_man('man/mtor.1')
|
||||
|
||||
nm = executable(
|
||||
f'@target_prefix@nm',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/nm.c'],
|
||||
)
|
||||
install_man('man/nm-classic.1')
|
||||
|
||||
nmedit = executable(
|
||||
f'@target_prefix@nmedit',
|
||||
c_args : ['-DNMEDIT'],
|
||||
dependencies : [libcodedirectory],
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/strip.c'],
|
||||
)
|
||||
install_man('man/nmedit.1')
|
||||
|
||||
otool = executable(
|
||||
f'@target_prefix@otool',
|
||||
c_args : ['-DEFI_SUPPORT'],
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : [
|
||||
'otool/arm64_disasm.c',
|
||||
'otool/arm_disasm.c',
|
||||
'otool/coff_print.c',
|
||||
'otool/dyld_bind_info.c',
|
||||
'otool/hppa_disasm.c',
|
||||
'otool/i386_disasm.c',
|
||||
'otool/i860_disasm.c',
|
||||
'otool/m68k_disasm.c',
|
||||
'otool/m88k_disasm.c',
|
||||
'otool/main.c',
|
||||
'otool/ofile_print.c',
|
||||
'otool/ppc_disasm.c',
|
||||
'otool/print_bitcode.c',
|
||||
'otool/print_objc.c',
|
||||
'otool/print_objc2_32bit.c',
|
||||
'otool/print_objc2_64bit.c',
|
||||
'otool/print_objc2_util.c',
|
||||
'otool/sparc_disasm.c',
|
||||
],
|
||||
)
|
||||
install_man('man/otool-classic.1')
|
||||
|
||||
pagestuff = executable(
|
||||
f'@target_prefix@pagestuff',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/pagestuff.c'],
|
||||
)
|
||||
install_man('man/pagestuff.1')
|
||||
|
||||
# ranlib is a symlink to libtool
|
||||
install_man(
|
||||
'man/ranlib.1',
|
||||
'man/ranlib.5',
|
||||
)
|
||||
|
||||
redo_prebinding = executable(
|
||||
f'@target_prefix@redo_prebinding',
|
||||
dependencies : [libcodedirectory],
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/redo_prebinding.c'],
|
||||
)
|
||||
install_man('man/redo_prebinding.1')
|
||||
|
||||
seg_addr_table = executable(
|
||||
f'@target_prefix@seg_addr_table',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/seg_addr_table.c'],
|
||||
)
|
||||
install_man('man/seg_addr_table.1')
|
||||
|
||||
seg_hack = executable(
|
||||
f'@target_prefix@seg_hack',
|
||||
dependencies : [libcodedirectory],
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/seg_hack.c'],
|
||||
)
|
||||
|
||||
segedit = executable(
|
||||
f'@target_prefix@segedit',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/segedit.c'],
|
||||
)
|
||||
install_man('man/segedit.1',)
|
||||
|
||||
size = executable(
|
||||
f'@target_prefix@size',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/size.c'],
|
||||
)
|
||||
install_man('man/size-classic.1')
|
||||
|
||||
strings = executable(
|
||||
f'@target_prefix@strings',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/strings.c'],
|
||||
)
|
||||
install_man('man/strings.1')
|
||||
|
||||
strip = executable(
|
||||
f'@target_prefix@strip',
|
||||
c_args : ['-DTRIE_SUPPORT'],
|
||||
dependencies : [libcodedirectory, libprunetrie],
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/strip.c'],
|
||||
)
|
||||
install_man('man/strip.1')
|
||||
|
||||
vtool = executable(
|
||||
f'@target_prefix@vtool',
|
||||
dependencies : [libcodedirectory],
|
||||
include_directories : [incdirs, 'include/stuff'],
|
||||
install : true,
|
||||
link_with : [libstuff],
|
||||
sources : ['misc/vtool.c'],
|
||||
)
|
||||
install_man('man/vtool.1')
|
||||
|
||||
|
||||
# Development files
|
||||
# Static libraries
|
||||
libmacho = static_library(
|
||||
'macho',
|
||||
include_directories : incdirs,
|
||||
sources : [
|
||||
'libmacho/arch.c',
|
||||
'libmacho/get_end.c',
|
||||
'libmacho/getsecbyname.c',
|
||||
'libmacho/getsegbyname.c',
|
||||
'libmacho/hppa_swap.c',
|
||||
'libmacho/i386_swap.c',
|
||||
'libmacho/i860_swap.c',
|
||||
'libmacho/m68k_swap.c',
|
||||
'libmacho/m88k_swap.c',
|
||||
'libmacho/ppc_swap.c',
|
||||
'libmacho/slot_name.c',
|
||||
'libmacho/sparc_swap.c',
|
||||
'libmacho/swap.c',
|
||||
],
|
||||
)
|
||||
|
||||
libredo_prebinding = static_library(
|
||||
'redo_prebinding',
|
||||
c_args : ['-DLIBRARY_API'],
|
||||
include_directories : incdirs,
|
||||
sources : ['misc/redo_prebinding.c'],
|
||||
)
|
||||
install_man('man/redo_prebinding.3')
|
||||
|
||||
|
||||
# Development files
|
||||
# Based on the contents of the upstream SDK.
|
||||
install_headers(
|
||||
'include/mach-o/arch.h',
|
||||
'include/mach-o/fat.h',
|
||||
'include/mach-o/getsect.h',
|
||||
'include/mach-o/ldsyms.h',
|
||||
'include/mach-o/loader.h',
|
||||
'include/mach-o/nlist.h',
|
||||
'include/mach-o/ranlib.h',
|
||||
'include/mach-o/reloc.h',
|
||||
'include/mach-o/stab.h',
|
||||
'include/mach-o/swap.h',
|
||||
subdir : 'mach-o',
|
||||
)
|
||||
|
||||
# Some of these architectures are irrelevant, but the Libsystem derivation expects their headers to be present.
|
||||
# Not every arch has both headers, so tailor the lists for each that does.
|
||||
foreach arch : ['arm', 'arm64', 'hppa', 'i860', 'm88k', 'ppc', 'sparc', 'x86_64']
|
||||
install_headers(
|
||||
f'include/mach-o/@arch@/reloc.h',
|
||||
subdir : f'mach-o/@arch@',
|
||||
)
|
||||
endforeach
|
||||
foreach arch : ['hppa', 'i386', 'i860', 'm68k', 'm88k', 'ppc', 'sparc']
|
||||
install_headers(
|
||||
f'include/mach-o/@arch@/swap.h',
|
||||
subdir : f'mach-o/@arch@',
|
||||
)
|
||||
endforeach
|
||||
|
||||
install_data(
|
||||
'include/modules/mach-o.modulemap',
|
||||
install_dir : get_option('includedir'),
|
||||
rename : 'mach-o/module.map',
|
||||
)
|
||||
install_man(
|
||||
'man/Mach-O.5',
|
||||
'man/NSModule.3',
|
||||
'man/NSObjectFileImage.3',
|
||||
'man/NSObjectFileImage_priv.3',
|
||||
'man/arch.3',
|
||||
'man/dyld.3',
|
||||
'man/end.3',
|
||||
'man/get_end.3',
|
||||
'man/getsectbyname.3',
|
||||
'man/getsectbynamefromheader.3',
|
||||
'man/getsectdata.3',
|
||||
'man/getsectdatafromheader.3',
|
||||
'man/getsegbyname.3',
|
||||
'man/stab.5',
|
||||
)
|
6
pkgs/by-name/cc/cctools/meson.options
Normal file
6
pkgs/by-name/cc/cctools/meson.options
Normal file
@ -0,0 +1,6 @@
|
||||
option(
|
||||
'target_prefix',
|
||||
type : 'string',
|
||||
value : '',
|
||||
description: 'Specifies the prefix to use when building for cross-compilation (e.g., `aarch64-apple-darwin`)'
|
||||
)
|
175
pkgs/by-name/cc/cctools/package.nix
Normal file
175
pkgs/by-name/cc/cctools/package.nix
Normal file
@ -0,0 +1,175 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
buildPackages,
|
||||
darwin,
|
||||
ld64,
|
||||
llvm,
|
||||
memstreamHook,
|
||||
meson,
|
||||
ninja,
|
||||
openssl,
|
||||
xar,
|
||||
gitUpdater,
|
||||
}:
|
||||
|
||||
let
|
||||
# The targetPrefix is prepended to binary names to allow multiple binuntils on the PATH to both be usable.
|
||||
targetPrefix = lib.optionalString (
|
||||
stdenv.targetPlatform != stdenv.hostPlatform
|
||||
) "${stdenv.targetPlatform.config}-";
|
||||
|
||||
# First version with all the required files
|
||||
xnu = fetchFromGitHub {
|
||||
name = "xnu-src";
|
||||
owner = "apple-oss-distributions";
|
||||
repo = "xnu";
|
||||
rev = "xnu-7195.50.7.100.1";
|
||||
hash = "sha256-uHmAOm6k9ZXWfyqHiDSpm+tZqUbERlr6rXSJ4xNACkM=";
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "${targetPrefix}cctools";
|
||||
version = "1010.6";
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
"dev"
|
||||
"man"
|
||||
"gas"
|
||||
];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "apple-oss-distributions";
|
||||
repo = "cctools";
|
||||
rev = "cctools-${finalAttrs.version}";
|
||||
hash = "sha256-JiKCP6U+xxR4mk4TXWv/mEo9Idg+QQqUYmB/EeRksCE=";
|
||||
};
|
||||
|
||||
xcodeHash = "sha256-5RBbGrz1UKV0wt2Uk7RIHdfgWH8sgw/jy7hfTVrtVuM=";
|
||||
|
||||
postUnpack = ''
|
||||
unpackFile '${xnu}'
|
||||
|
||||
# Verify that the Xcode project has not changed unexpectedly.
|
||||
hashType=$(echo $xcodeHash | cut -d- -f1)
|
||||
expectedHash=$(echo $xcodeHash | cut -d- -f2)
|
||||
hash=$(openssl "$hashType" -binary "$sourceRoot/cctools.xcodeproj/project.pbxproj" | base64)
|
||||
|
||||
if [ "$hash" != "$expectedHash" ]; then
|
||||
echo 'error: hash mismatch in cctools.xcodeproj/project.pbxproj'
|
||||
echo " specified: $xcodeHash"
|
||||
echo " got: $hashType-$hash"
|
||||
echo
|
||||
echo 'Upstream Xcode project has changed. Update `meson.build` with any changes, then update `xcodeHash`.'
|
||||
echo 'Use `nix-hash --flat --sri --type sha256 cctools.xcodeproj/project.pbxproj` to regenerate it.'
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
|
||||
patches = [
|
||||
# Fix compile errors in redo_prebinding.c
|
||||
./0001-Fix-build-issues-with-misc-redo_prebinding.c.patch
|
||||
# Use libcd_is_blob_a_linker_signature as defined in the libcodedirectory.h header
|
||||
./0002-Rely-on-libcd_is_blob_a_linker_signature.patch
|
||||
# cctools uses availability checks for `utimensat`, but it checks the wrong version.
|
||||
# Also, provide a definition to avoid implicit function definition errors.
|
||||
./0003-Fix-utimensat-compatability-with-the-10.12-SDK.patch
|
||||
# Use the nixpkgs clang’s path as the prefix.
|
||||
./0004-Use-nixpkgs-clang-with-the-assembler-driver.patch
|
||||
# Make sure cctools can find ld64 in the store
|
||||
./0005-Find-ld64-in-the-store.patch
|
||||
# `ranlib` is a symlink to `libtool`. Make sure its detection works when it is used in cross-compilation.
|
||||
./0006-Support-target-prefixes-in-ranlib-detection.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substitute ${./meson.build} meson.build \
|
||||
--subst-var version
|
||||
cp ${./meson.options} meson.options
|
||||
|
||||
# Make sure as’s clang driver uses clang from nixpkgs and finds the drivers in the store.
|
||||
substituteInPlace as/driver.c \
|
||||
--subst-var-by clang-unwrapped '${lib.getBin buildPackages.clang.cc}' \
|
||||
--subst-var-by gas '${placeholder "gas"}'
|
||||
|
||||
# Need to set the path to make sure cctools can find ld64 in the store.
|
||||
substituteInPlace libstuff/execute.c \
|
||||
--subst-var-by ld64_path '${lib.getBin ld64}/bin/ld'
|
||||
|
||||
# Set the target prefix for `ranlib`
|
||||
substituteInPlace misc/libtool.c \
|
||||
--subst-var-by targetPrefix '${targetPrefix}'
|
||||
|
||||
# The version of this file distributed with cctools defines several CPU types missing from the 10.12 SDK.
|
||||
ln -s machine-cctools.h include/mach/machine.h
|
||||
|
||||
# Use libxar from nixpkgs
|
||||
for cctool_src in misc/nm.c otool/print_bitcode.c; do
|
||||
substituteInPlace $cctool_src \
|
||||
--replace-fail 'makestr(prefix, "../lib/libxar.dylib", NULL)' '"${lib.getLib xar}/lib/libxar.dylib"' \
|
||||
--replace-fail '/usr/lib/libxar.dylib' '${lib.getLib xar}/lib/libxar.dylib'
|
||||
done
|
||||
|
||||
# Use libLTO.dylib from nixpkgs LLVM
|
||||
substituteInPlace libstuff/llvm.c \
|
||||
--replace-fail 'getenv("LIBLTO_PATH")' '"${lib.getLib llvm}/lib/libLTO.dylib"'
|
||||
|
||||
cp ../xnu-src/EXTERNAL_HEADERS/mach-o/fixup-chains.h include/mach-o/fixup-chains.h
|
||||
'';
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
meson
|
||||
ninja
|
||||
openssl
|
||||
];
|
||||
|
||||
buildInputs =
|
||||
[
|
||||
ld64
|
||||
llvm
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin [ darwin.objc4 ]
|
||||
++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ memstreamHook ];
|
||||
|
||||
mesonBuildType = "release";
|
||||
|
||||
mesonFlags = [
|
||||
(lib.mesonOption "b_ndebug" "if-release")
|
||||
] ++ lib.optionals (targetPrefix != "") [ (lib.mesonOption "target_prefix" targetPrefix) ];
|
||||
|
||||
postInstall = ''
|
||||
ln -s ${targetPrefix}libtool "$out/bin/${targetPrefix}ranlib"
|
||||
ln -s nm-classic.1 "''${!outputMan}/share/man/man1/nm.1"
|
||||
ln -s otool-classic.1 "''${!outputMan}/share/man/man1/otool.1"
|
||||
ln -s size-classic.1 "''${!outputMan}/share/man/man1/size.1"
|
||||
|
||||
# Move GNU as to its own output to prevent it from being used accidentally.
|
||||
moveToOutput bin/gas "$gas"
|
||||
moveToOutput libexec "$gas"
|
||||
for arch in arm i386 x86_64; do
|
||||
mv "$gas/libexec/as/$arch/as-$arch" "$gas/libexec/as/$arch/as"
|
||||
done
|
||||
'';
|
||||
|
||||
__structuredAttrs = true;
|
||||
|
||||
passthru = {
|
||||
inherit targetPrefix;
|
||||
updateScript = gitUpdater { rev-prefix = "cctools-"; };
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "The classic linker for Darwin";
|
||||
homepage = "https://opensource.apple.com/releases/";
|
||||
license = with lib.licenses; [
|
||||
apple-psl20
|
||||
gpl2 # GNU as
|
||||
];
|
||||
maintainers = with lib.maintainers; [ reckenrode ];
|
||||
platforms = lib.platforms.darwin;
|
||||
};
|
||||
})
|
181
pkgs/by-name/ld/ld64/0004-Use-std-atomics-and-std-mutex.patch
Normal file
181
pkgs/by-name/ld/ld64/0004-Use-std-atomics-and-std-mutex.patch
Normal file
@ -0,0 +1,181 @@
|
||||
From 5e92d65ef2b5cc07dc25b5b1bf645b314599f5d1 Mon Sep 17 00:00:00 2001
|
||||
From: Randy Eckenrode <randy@largeandhighquality.com>
|
||||
Date: Sat, 6 Apr 2024 20:29:25 -0400
|
||||
Subject: [PATCH 4/8] Use std::atomics and std::mutex
|
||||
|
||||
---
|
||||
src/ld/InputFiles.cpp | 13 ++++++-------
|
||||
src/ld/InputFiles.h | 9 +++++----
|
||||
src/ld/OutputFile.cpp | 13 ++++++-------
|
||||
src/ld/ld.cpp | 11 +++++------
|
||||
4 files changed, 22 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/src/ld/InputFiles.cpp b/src/ld/InputFiles.cpp
|
||||
index ec53a60..427ab09 100644
|
||||
--- a/src/ld/InputFiles.cpp
|
||||
+++ b/src/ld/InputFiles.cpp
|
||||
@@ -42,7 +42,6 @@
|
||||
#include <mach-o/dyld.h>
|
||||
#include <mach-o/fat.h>
|
||||
#include <sys/sysctl.h>
|
||||
-#include <libkern/OSAtomic.h>
|
||||
#if HAVE_LIBDISPATCH
|
||||
#include <dispatch/dispatch.h>
|
||||
#endif
|
||||
@@ -387,16 +386,16 @@ ld::File* InputFiles::makeFile(const Options::FileInfo& info, bool indirectDylib
|
||||
|
||||
ld::relocatable::File* objResult = mach_o::relocatable::parse(p, len, info.path, info.modTime, info.ordinal, objOpts);
|
||||
if ( objResult != NULL ) {
|
||||
- OSAtomicAdd64(len, &_totalObjectSize);
|
||||
- OSAtomicIncrement32(&_totalObjectLoaded);
|
||||
+ _totalObjectSize += len;
|
||||
+ ++_totalObjectLoaded;
|
||||
return objResult;
|
||||
}
|
||||
|
||||
// see if it is an llvm object file
|
||||
objResult = lto::parse(p, len, info.path, info.modTime, info.ordinal, _options.architecture(), _options.subArchitecture(), _options.logAllFiles(), _options.verboseOptimizationHints());
|
||||
if ( objResult != NULL ) {
|
||||
- OSAtomicAdd64(len, &_totalObjectSize);
|
||||
- OSAtomicIncrement32(&_totalObjectLoaded);
|
||||
+ _totalObjectSize += len;
|
||||
+ ++_totalObjectLoaded;
|
||||
return objResult;
|
||||
}
|
||||
|
||||
@@ -444,8 +443,8 @@ ld::File* InputFiles::makeFile(const Options::FileInfo& info, bool indirectDylib
|
||||
ld::archive::File* archiveResult = ::archive::parse(p, len, info.path, info.modTime, info.ordinal, archOpts);
|
||||
if ( archiveResult != NULL ) {
|
||||
|
||||
- OSAtomicAdd64(len, &_totalArchiveSize);
|
||||
- OSAtomicIncrement32(&_totalArchivesLoaded);
|
||||
+ _totalArchiveSize += len;
|
||||
+ ++_totalArchivesLoaded;
|
||||
return archiveResult;
|
||||
}
|
||||
|
||||
diff --git a/src/ld/InputFiles.h b/src/ld/InputFiles.h
|
||||
index c18ccf8..ffff26b 100644
|
||||
--- a/src/ld/InputFiles.h
|
||||
+++ b/src/ld/InputFiles.h
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
+#include <atomic>
|
||||
#include <vector>
|
||||
|
||||
#include "Options.h"
|
||||
@@ -78,10 +79,10 @@ public:
|
||||
size_t count() const { return _inputFiles.size(); }
|
||||
|
||||
// for -print_statistics
|
||||
- volatile int64_t _totalObjectSize;
|
||||
- volatile int64_t _totalArchiveSize;
|
||||
- volatile int32_t _totalObjectLoaded;
|
||||
- volatile int32_t _totalArchivesLoaded;
|
||||
+ std::atomic<int64_t> _totalObjectSize;
|
||||
+ std::atomic<int64_t> _totalArchiveSize;
|
||||
+ std::atomic<int32_t> _totalObjectLoaded;
|
||||
+ std::atomic<int32_t> _totalArchivesLoaded;
|
||||
int32_t _totalDylibsLoaded;
|
||||
|
||||
|
||||
diff --git a/src/ld/OutputFile.cpp b/src/ld/OutputFile.cpp
|
||||
index e2c0397..15912a2 100644
|
||||
--- a/src/ld/OutputFile.cpp
|
||||
+++ b/src/ld/OutputFile.cpp
|
||||
@@ -43,11 +43,10 @@
|
||||
#include <mach-o/dyld.h>
|
||||
#include <mach-o/fat.h>
|
||||
#include <dispatch/dispatch.h>
|
||||
-#include <os/lock_private.h>
|
||||
extern "C" {
|
||||
#include <corecrypto/ccsha2.h>
|
||||
}
|
||||
-#include <string>
|
||||
+#include <mutex>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <algorithm>
|
||||
@@ -1362,7 +1361,7 @@ void OutputFile::rangeCheckRISCVBranch20(int64_t displacement, ld::Internal& sta
|
||||
|
||||
|
||||
#if SUPPORT_ARCH_arm64e
|
||||
-static os_lock_unfair_s sAuthenticatedFixupDataLock = OS_LOCK_UNFAIR_INIT; // to serialize building of _authenticatedFixupData
|
||||
+static std::mutex sAuthenticatedFixupDataLock; // to serialize building of _authenticatedFixupData
|
||||
#endif
|
||||
|
||||
void OutputFile::applyFixUps(ld::Internal& state, uint64_t mhAddress, const ld::Atom* atom, uint8_t* buffer)
|
||||
@@ -1737,11 +1736,11 @@ void OutputFile::applyFixUps(ld::Internal& state, uint64_t mhAddress, const ld::
|
||||
}
|
||||
else {
|
||||
auto fixupOffset = (uintptr_t)(fixUpLocation - mhAddress);
|
||||
- os_lock_lock(&sAuthenticatedFixupDataLock);
|
||||
+ sAuthenticatedFixupDataLock.lock();
|
||||
assert(_authenticatedFixupData.find(fixupOffset) == _authenticatedFixupData.end());
|
||||
auto authneticatedData = std::make_pair(authData, accumulator);
|
||||
_authenticatedFixupData[fixupOffset] = authneticatedData;
|
||||
- os_lock_unlock(&sAuthenticatedFixupDataLock);
|
||||
+ sAuthenticatedFixupDataLock.unlock();
|
||||
// Zero out this entry which we will expect later.
|
||||
set64LE(fixUpLocation, 0);
|
||||
}
|
||||
@@ -1768,11 +1767,11 @@ void OutputFile::applyFixUps(ld::Internal& state, uint64_t mhAddress, const ld::
|
||||
}
|
||||
else {
|
||||
auto fixupOffset = (uintptr_t)(fixUpLocation - mhAddress);
|
||||
- os_lock_lock(&sAuthenticatedFixupDataLock);
|
||||
+ sAuthenticatedFixupDataLock.lock();
|
||||
assert(_authenticatedFixupData.find(fixupOffset) == _authenticatedFixupData.end());
|
||||
auto authneticatedData = std::make_pair(authData, accumulator);
|
||||
_authenticatedFixupData[fixupOffset] = authneticatedData;
|
||||
- os_lock_unlock(&sAuthenticatedFixupDataLock);
|
||||
+ sAuthenticatedFixupDataLock.unlock();
|
||||
// Zero out this entry which we will expect later.
|
||||
set64LE(fixUpLocation, 0);
|
||||
}
|
||||
diff --git a/src/ld/ld.cpp b/src/ld/ld.cpp
|
||||
index b7590a3..f1bf9df 100644
|
||||
--- a/src/ld/ld.cpp
|
||||
+++ b/src/ld/ld.cpp
|
||||
@@ -47,9 +47,8 @@ extern "C" double log2 ( double );
|
||||
#include <mach-o/dyld.h>
|
||||
#include <dlfcn.h>
|
||||
#include <AvailabilityMacros.h>
|
||||
-#include <os/lock_private.h>
|
||||
|
||||
-#include <string>
|
||||
+#include <mutex>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
@@ -1603,8 +1602,8 @@ int main(int argc, const char* argv[])
|
||||
statistics.vmEnd.faults-statistics.vmStart.faults);
|
||||
fprintf(stderr, "memory active: %lu, wired: %lu\n", statistics.vmEnd.active_count * vm_page_size, statistics.vmEnd.wire_count * vm_page_size);
|
||||
char temp[40];
|
||||
- fprintf(stderr, "processed %3u object files, totaling %15s bytes\n", inputFiles._totalObjectLoaded, commatize(inputFiles._totalObjectSize, temp));
|
||||
- fprintf(stderr, "processed %3u archive files, totaling %15s bytes\n", inputFiles._totalArchivesLoaded, commatize(inputFiles._totalArchiveSize, temp));
|
||||
+ fprintf(stderr, "processed %3u object files, totaling %15s bytes\n", inputFiles._totalObjectLoaded.load(), commatize(inputFiles._totalObjectSize.load(), temp));
|
||||
+ fprintf(stderr, "processed %3u archive files, totaling %15s bytes\n", inputFiles._totalArchivesLoaded.load(), commatize(inputFiles._totalArchiveSize.load(), temp));
|
||||
fprintf(stderr, "processed %3u dylib files\n", inputFiles._totalDylibsLoaded);
|
||||
fprintf(stderr, "wrote output file totaling %15s bytes\n", commatize(out.fileSize(), temp));
|
||||
}
|
||||
@@ -1634,12 +1633,12 @@ int main(int argc, const char* argv[])
|
||||
#ifndef NDEBUG
|
||||
|
||||
// now that the linker is multi-threaded, only allow one assert() to be processed
|
||||
-static os_lock_unfair_s sAssertLock = OS_LOCK_UNFAIR_INIT;
|
||||
+static std::mutex sAssertLock;
|
||||
|
||||
// implement assert() function to print out a backtrace before aborting
|
||||
void __assert_rtn(const char* func, const char* file, int line, const char* failedexpr)
|
||||
{
|
||||
- os_lock_lock(&sAssertLock);
|
||||
+ sAssertLock.lock();
|
||||
|
||||
Snapshot *snapshot = Snapshot::globalSnapshot;
|
||||
|
||||
--
|
||||
2.45.1
|
||||
|
48
pkgs/by-name/ld/ld64/0005-Support-LTO-in-nixpkgs.patch
Normal file
48
pkgs/by-name/ld/ld64/0005-Support-LTO-in-nixpkgs.patch
Normal file
@ -0,0 +1,48 @@
|
||||
From faa5ab7c6e8d9a6c6157a2b681edad592ce78555 Mon Sep 17 00:00:00 2001
|
||||
From: Randy Eckenrode <randy@largeandhighquality.com>
|
||||
Date: Sun, 7 Apr 2024 15:33:36 -0400
|
||||
Subject: [PATCH 5/8] Support LTO in nixpkgs
|
||||
|
||||
---
|
||||
src/ld/InputFiles.cpp | 11 ++---------
|
||||
src/ld/parsers/lto_file.cpp | 2 +-
|
||||
2 files changed, 3 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/ld/InputFiles.cpp b/src/ld/InputFiles.cpp
|
||||
index 427ab09..b8a9870 100644
|
||||
--- a/src/ld/InputFiles.cpp
|
||||
+++ b/src/ld/InputFiles.cpp
|
||||
@@ -464,15 +464,8 @@ ld::File* InputFiles::makeFile(const Options::FileInfo& info, bool indirectDylib
|
||||
if ( _options.overridePathlibLTO() != NULL ) {
|
||||
libLTO = _options.overridePathlibLTO();
|
||||
}
|
||||
- else if ( _NSGetExecutablePath(ldPath, &bufSize) != -1 ) {
|
||||
- if ( realpath(ldPath, tmpPath) != NULL ) {
|
||||
- char* lastSlash = strrchr(tmpPath, '/');
|
||||
- if ( lastSlash != NULL )
|
||||
- strcpy(lastSlash, "/../lib/libLTO.dylib");
|
||||
- libLTO = tmpPath;
|
||||
- if ( realpath(tmpPath, libLTOPath) != NULL )
|
||||
- libLTO = libLTOPath;
|
||||
- }
|
||||
+ else {
|
||||
+ libLTO = "@libllvm@/lib/libLTO.dylib";
|
||||
}
|
||||
throwf("could not process llvm bitcode object file, because %s could not be loaded", libLTO);
|
||||
}
|
||||
diff --git a/src/ld/parsers/lto_file.cpp b/src/ld/parsers/lto_file.cpp
|
||||
index 5318212..e18e974 100644
|
||||
--- a/src/ld/parsers/lto_file.cpp
|
||||
+++ b/src/ld/parsers/lto_file.cpp
|
||||
@@ -1807,7 +1807,7 @@ bool optimize( const std::vector<const ld::Atom*>& allAtoms,
|
||||
|
||||
}; // namespace lto
|
||||
|
||||
-static const char *sLTODylib = "@rpath/libLTO.dylib";
|
||||
+static const char *sLTODylib = "@libllvm@/lib/libLTO.dylib";
|
||||
static std::atomic<bool> sLTOIsLoaded(false);
|
||||
|
||||
static void *getHandle() {
|
||||
--
|
||||
2.45.1
|
||||
|
@ -0,0 +1,113 @@
|
||||
From add8bae5577ebe1c98cf7a711f87a3578a51d313 Mon Sep 17 00:00:00 2001
|
||||
From: Randy Eckenrode <randy@largeandhighquality.com>
|
||||
Date: Mon, 8 Apr 2024 22:42:40 -0400
|
||||
Subject: [PATCH 6/8] Add libcd_is_blob_a_linker_signature implementation
|
||||
|
||||
---
|
||||
compat/libcodedirectory.c | 74 +++++++++++++++++++++++++++++++++++++++
|
||||
src/ld/libcodedirectory.h | 8 +++++
|
||||
2 files changed, 82 insertions(+)
|
||||
create mode 100644 compat/libcodedirectory.c
|
||||
|
||||
diff --git a/compat/libcodedirectory.c b/compat/libcodedirectory.c
|
||||
new file mode 100644
|
||||
index 0000000..e584dfc
|
||||
--- /dev/null
|
||||
+++ b/compat/libcodedirectory.c
|
||||
@@ -0,0 +1,74 @@
|
||||
+// SPDX-License-Identifier: APSL-2.0
|
||||
+// libcd_is_blob_a_linker_signature implementation written by Randy Eckenrode © 2024
|
||||
+
|
||||
+#include <libcodedirectory.h>
|
||||
+
|
||||
+#include <stdbool.h>
|
||||
+
|
||||
+// References:
|
||||
+// - https://forums.developer.apple.com/forums/thread/702351
|
||||
+// - https://redmaple.tech/blogs/macho-files/#codedirectory-blob
|
||||
+
|
||||
+static inline uint32_t read32be(const uint8_t* data)
|
||||
+{
|
||||
+ return (data[0] << 24) + (data[1] << 16) + (data[2] << 8) + data[3];
|
||||
+}
|
||||
+
|
||||
+static inline bool is_embedded_signature(uint32_t magic) {
|
||||
+ switch (magic) {
|
||||
+ case CSMAGIC_EMBEDDED_SIGNATURE:
|
||||
+ case CSMAGIC_EMBEDDED_SIGNATURE_OLD:
|
||||
+ return true;
|
||||
+ default:
|
||||
+ return false;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static inline const uint8_t* find_code_directory(const uint8_t* data, size_t size) {
|
||||
+ const uint8_t* index_ptr = data + offsetof(CS_SuperBlob, index);
|
||||
+
|
||||
+ // There also needs to be space for the actual blobs, but there must be at least enough space
|
||||
+ // for the blob indexes. If there’s not, then something’s wrong, and the blob is invalid.
|
||||
+ uint32_t count = read32be(data + offsetof(CS_SuperBlob, count));
|
||||
+ if (count > ((data + size) - index_ptr) / sizeof(CS_BlobIndex)) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ for (uint32_t n = 0; n < count; ++n) {
|
||||
+ const uint8_t* current_index_ptr = index_ptr + n * sizeof(CS_BlobIndex);
|
||||
+ uint32_t type = read32be(current_index_ptr + offsetof(CS_BlobIndex, type));
|
||||
+ if (type == CSSLOT_CODEDIRECTORY) {
|
||||
+ uint32_t offset = read32be(current_index_ptr + offsetof(CS_BlobIndex, offset));
|
||||
+ if (offset > size - sizeof(CS_CodeDirectory)) {
|
||||
+ return NULL;
|
||||
+ } else {
|
||||
+ return data + offset;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+enum libcd_signature_query_ret
|
||||
+libcd_is_blob_a_linker_signature(const uint8_t* data, size_t size, int* linker_signed)
|
||||
+{
|
||||
+ if (size < sizeof(CS_SuperBlob) + sizeof(CS_BlobIndex) + sizeof(CS_CodeDirectory)) {
|
||||
+ return LIBCD_SIGNATURE_QUERY_INVALID_ARGUMENT;
|
||||
+ }
|
||||
+
|
||||
+ if (!is_embedded_signature(read32be(data + offsetof(CS_SuperBlob, magic)))) {
|
||||
+ return LIBCD_SIGNATURE_QUERY_NOT_A_SIGNATURE;
|
||||
+ }
|
||||
+
|
||||
+ const uint8_t* cd = find_code_directory(data, size);
|
||||
+ if (!cd) {
|
||||
+ return LIBCD_SIGNATURE_QUERY_INVALID_ARGUMENT;
|
||||
+ }
|
||||
+
|
||||
+ uint32_t flags = read32be(cd + offsetof(CS_CodeDirectory, flags));
|
||||
+ if ((flags & CS_LINKER_SIGNED) == CS_LINKER_SIGNED) {
|
||||
+ *linker_signed = 1;
|
||||
+ }
|
||||
+
|
||||
+ return LIBCD_SIGNATURE_QUERY_SUCCESS;
|
||||
+}
|
||||
diff --git a/src/ld/libcodedirectory.h b/src/ld/libcodedirectory.h
|
||||
index 0e989a9..7532648 100644
|
||||
--- a/src/ld/libcodedirectory.h
|
||||
+++ b/src/ld/libcodedirectory.h
|
||||
@@ -116,6 +116,14 @@ enum libcd_set_linkage_ret {
|
||||
|
||||
enum libcd_set_linkage_ret libcd_set_linkage(libcd *s, int linkage_hash_type, uint8_t *linkage_hash);
|
||||
|
||||
+enum libcd_signature_query_ret {
|
||||
+ LIBCD_SIGNATURE_QUERY_SUCCESS,
|
||||
+ LIBCD_SIGNATURE_QUERY_INVALID_ARGUMENT,
|
||||
+ LIBCD_SIGNATURE_QUERY_NOT_A_SIGNATURE,
|
||||
+};
|
||||
+
|
||||
+enum libcd_signature_query_ret libcd_is_blob_a_linker_signature(const uint8_t* data, size_t size, int* linker_signed);
|
||||
+
|
||||
__END_DECLS
|
||||
|
||||
#endif // H_LIBCODEDIRECTORY
|
||||
--
|
||||
2.45.1
|
||||
|
@ -0,0 +1,311 @@
|
||||
From 36767c7345161baf0ab125f95c8557f8e24f25db Mon Sep 17 00:00:00 2001
|
||||
From: Randy Eckenrode <randy@largeandhighquality.com>
|
||||
Date: Tue, 9 Apr 2024 19:28:17 -0400
|
||||
Subject: [PATCH 7/8] Add OpenSSL-based CoreCrypto digest functions
|
||||
|
||||
---
|
||||
compat/CommonCrypto/CommonDigest.h | 6 +++
|
||||
compat/CommonCrypto/CommonDigestSPI.c | 21 +++++++++++
|
||||
compat/CommonCrypto/CommonDigestSPI.h | 14 +++++++
|
||||
compat/corecrypto/api_defines.h | 10 +++++
|
||||
compat/corecrypto/ccdigest.c | 53 +++++++++++++++++++++++++++
|
||||
compat/corecrypto/ccdigest.h | 27 ++++++++++++++
|
||||
compat/corecrypto/ccdigest_private.h | 19 ++++++++++
|
||||
compat/corecrypto/ccsha1.c | 22 +++++++++++
|
||||
compat/corecrypto/ccsha1.h | 9 +++++
|
||||
compat/corecrypto/ccsha2.c | 22 +++++++++++
|
||||
compat/corecrypto/ccsha2.h | 9 +++++
|
||||
11 files changed, 212 insertions(+)
|
||||
create mode 100644 compat/CommonCrypto/CommonDigest.h
|
||||
create mode 100644 compat/CommonCrypto/CommonDigestSPI.c
|
||||
create mode 100644 compat/CommonCrypto/CommonDigestSPI.h
|
||||
create mode 100644 compat/corecrypto/api_defines.h
|
||||
create mode 100644 compat/corecrypto/ccdigest.c
|
||||
create mode 100644 compat/corecrypto/ccdigest.h
|
||||
create mode 100644 compat/corecrypto/ccdigest_private.h
|
||||
create mode 100644 compat/corecrypto/ccsha1.c
|
||||
create mode 100644 compat/corecrypto/ccsha1.h
|
||||
create mode 100644 compat/corecrypto/ccsha2.c
|
||||
create mode 100644 compat/corecrypto/ccsha2.h
|
||||
|
||||
diff --git a/compat/CommonCrypto/CommonDigest.h b/compat/CommonCrypto/CommonDigest.h
|
||||
new file mode 100644
|
||||
index 0000000..a60eba7
|
||||
--- /dev/null
|
||||
+++ b/compat/CommonCrypto/CommonDigest.h
|
||||
@@ -0,0 +1,6 @@
|
||||
+// SPDX-License-Identifier: APSL-2.0
|
||||
+// CoreCrypto compatibility shims written by Randy Eckenrode © 2024
|
||||
+
|
||||
+#pragma once
|
||||
+
|
||||
+#define CCSHA256_OUTPUT_SIZE 32
|
||||
diff --git a/compat/CommonCrypto/CommonDigestSPI.c b/compat/CommonCrypto/CommonDigestSPI.c
|
||||
new file mode 100644
|
||||
index 0000000..41269fc
|
||||
--- /dev/null
|
||||
+++ b/compat/CommonCrypto/CommonDigestSPI.c
|
||||
@@ -0,0 +1,21 @@
|
||||
+// SPDX-License-Identifier: APSL-2.0
|
||||
+// CoreCrypto compatibility shims written by Randy Eckenrode © 2024
|
||||
+
|
||||
+#include "CommonDigestSPI.h"
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+#include <corecrypto/ccsha2.h>
|
||||
+
|
||||
+void CCDigest(int type, const uint8_t* bytes, size_t count, uint8_t* digest) {
|
||||
+ if (type != kCCDigestSHA256) {
|
||||
+ abort();
|
||||
+ }
|
||||
+ const struct ccdigest_info* di = ccsha256_di();
|
||||
+
|
||||
+ ccdigest_di_decl(_di, ctx);
|
||||
+ ccdigest_init(di, ctx);
|
||||
+ ccdigest_update(di, ctx, count, bytes);
|
||||
+ ccdigest_final(di, ctx, digest);
|
||||
+}
|
||||
diff --git a/compat/CommonCrypto/CommonDigestSPI.h b/compat/CommonCrypto/CommonDigestSPI.h
|
||||
new file mode 100644
|
||||
index 0000000..172742a
|
||||
--- /dev/null
|
||||
+++ b/compat/CommonCrypto/CommonDigestSPI.h
|
||||
@@ -0,0 +1,14 @@
|
||||
+// SPDX-License-Identifier: APSL-2.0
|
||||
+// CoreCrypto compatibility shims written by Randy Eckenrode © 2024
|
||||
+
|
||||
+#pragma once
|
||||
+
|
||||
+#include <stdint.h>
|
||||
+
|
||||
+#include <corecrypto/ccdigest.h>
|
||||
+#include <cs_blobs.h>
|
||||
+
|
||||
+
|
||||
+#define kCCDigestSHA256 10
|
||||
+
|
||||
+EXTERN_C void CCDigest(int type, const uint8_t* bytes, size_t count, uint8_t* digest);
|
||||
diff --git a/compat/corecrypto/api_defines.h b/compat/corecrypto/api_defines.h
|
||||
new file mode 100644
|
||||
index 0000000..13d1e7a
|
||||
--- /dev/null
|
||||
+++ b/compat/corecrypto/api_defines.h
|
||||
@@ -0,0 +1,10 @@
|
||||
+// SPDX-License-Identifier: APSL-2.0
|
||||
+// CoreCrypto compatibility shims written by Randy Eckenrode © 2024
|
||||
+
|
||||
+#pragma once
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+#define EXTERN_C extern "C"
|
||||
+#else
|
||||
+#define EXTERN_C
|
||||
+#endif
|
||||
diff --git a/compat/corecrypto/ccdigest.c b/compat/corecrypto/ccdigest.c
|
||||
new file mode 100644
|
||||
index 0000000..e29dcb8
|
||||
--- /dev/null
|
||||
+++ b/compat/corecrypto/ccdigest.c
|
||||
@@ -0,0 +1,53 @@
|
||||
+// SPDX-License-Identifier: APSL-2.0
|
||||
+// CoreCrypto compatibility shims written by Randy Eckenrode © 2024
|
||||
+
|
||||
+#include "ccdigest.h"
|
||||
+#include "ccdigest_private.h"
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+#include <openssl/err.h>
|
||||
+
|
||||
+
|
||||
+struct ccdigest_context* _ccdigest_context_new(void)
|
||||
+{
|
||||
+ struct ccdigest_context* ctx = malloc(sizeof(struct ccdigest_context));
|
||||
+ ctx->context = EVP_MD_CTX_new();
|
||||
+ return ctx;
|
||||
+}
|
||||
+
|
||||
+struct ccdigest_info* _ccdigest_newprovider(const char* name)
|
||||
+{
|
||||
+ struct ccdigest_info* di = malloc(sizeof(struct ccdigest_info));
|
||||
+ di->provider = EVP_MD_fetch(NULL, name, NULL);
|
||||
+ return di;
|
||||
+}
|
||||
+
|
||||
+void ccdigest_init(const struct ccdigest_info* di, struct ccdigest_context* ctx)
|
||||
+{
|
||||
+ if (!EVP_DigestInit_ex2(ctx->context, di->provider, NULL)) {
|
||||
+ ERR_print_errors_fp(stderr);
|
||||
+ abort();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void ccdigest_update(
|
||||
+ const struct ccdigest_info* _di,
|
||||
+ struct ccdigest_context* ctx,
|
||||
+ size_t count,
|
||||
+ const void* bytes
|
||||
+)
|
||||
+{
|
||||
+ if (!EVP_DigestUpdate(ctx->context, bytes, count)) {
|
||||
+ ERR_print_errors_fp(stderr);
|
||||
+ abort();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void ccdigest_final(const struct ccdigest_info* _di, struct ccdigest_context* ctx, uint8_t* digest)
|
||||
+{
|
||||
+ if (!EVP_DigestFinal_ex(ctx->context, digest, NULL)) {
|
||||
+ ERR_print_errors_fp(stderr);
|
||||
+ abort();
|
||||
+ }
|
||||
+}
|
||||
diff --git a/compat/corecrypto/ccdigest.h b/compat/corecrypto/ccdigest.h
|
||||
new file mode 100644
|
||||
index 0000000..9af2394
|
||||
--- /dev/null
|
||||
+++ b/compat/corecrypto/ccdigest.h
|
||||
@@ -0,0 +1,27 @@
|
||||
+// SPDX-License-Identifier: APSL-2.0
|
||||
+// CoreCrypto compatibility shims written by Randy Eckenrode © 2024
|
||||
+
|
||||
+#pragma once
|
||||
+
|
||||
+#include <stddef.h>
|
||||
+#include <stdint.h>
|
||||
+
|
||||
+#include "api_defines.h"
|
||||
+
|
||||
+
|
||||
+struct ccdigest_info;
|
||||
+struct ccdigest_context;
|
||||
+
|
||||
+EXTERN_C struct ccdigest_context* _ccdigest_context_new(void);
|
||||
+
|
||||
+#define ccdigest_di_decl(_di, ctxvar) \
|
||||
+ struct ccdigest_context* (ctxvar) = _ccdigest_context_new()
|
||||
+
|
||||
+EXTERN_C void ccdigest_init(const struct ccdigest_info* di, struct ccdigest_context* ctx);
|
||||
+EXTERN_C void ccdigest_update(
|
||||
+ const struct ccdigest_info* _di,
|
||||
+ struct ccdigest_context* ctx,
|
||||
+ size_t count,
|
||||
+ const void* bytes
|
||||
+);
|
||||
+EXTERN_C void ccdigest_final(const struct ccdigest_info* _di, struct ccdigest_context* ctx, uint8_t* digest);
|
||||
diff --git a/compat/corecrypto/ccdigest_private.h b/compat/corecrypto/ccdigest_private.h
|
||||
new file mode 100644
|
||||
index 0000000..0ea9759
|
||||
--- /dev/null
|
||||
+++ b/compat/corecrypto/ccdigest_private.h
|
||||
@@ -0,0 +1,19 @@
|
||||
+// SPDX-License-Identifier: APSL-2.0
|
||||
+// CoreCrypto compatibility shims written by Randy Eckenrode © 2024
|
||||
+
|
||||
+#pragma once
|
||||
+
|
||||
+#include "api_defines.h"
|
||||
+
|
||||
+#include <openssl/evp.h>
|
||||
+
|
||||
+
|
||||
+struct ccdigest_info {
|
||||
+ EVP_MD* provider;
|
||||
+};
|
||||
+
|
||||
+struct ccdigest_context {
|
||||
+ EVP_MD_CTX* context;
|
||||
+};
|
||||
+
|
||||
+EXTERN_C struct ccdigest_info* _ccdigest_newprovider(const char* name);
|
||||
diff --git a/compat/corecrypto/ccsha1.c b/compat/corecrypto/ccsha1.c
|
||||
new file mode 100644
|
||||
index 0000000..e02b2b6
|
||||
--- /dev/null
|
||||
+++ b/compat/corecrypto/ccsha1.c
|
||||
@@ -0,0 +1,22 @@
|
||||
+// SPDX-License-Identifier: APSL-2.0
|
||||
+// CoreCrypto compatibility shims written by Randy Eckenrode © 2024
|
||||
+
|
||||
+#include "ccsha1.h"
|
||||
+
|
||||
+#include <assert.h>
|
||||
+
|
||||
+#include <cs_blobs.h>
|
||||
+
|
||||
+#include "ccdigest_private.h"
|
||||
+
|
||||
+
|
||||
+static struct ccdigest_info* di = NULL;
|
||||
+
|
||||
+const struct ccdigest_info* ccsha1_di(void)
|
||||
+{
|
||||
+ if (!di) {
|
||||
+ di = _ccdigest_newprovider("SHA-1");
|
||||
+ assert(EVP_MD_get_size(di->provider) == CS_SHA1_LEN);
|
||||
+ }
|
||||
+ return di;
|
||||
+}
|
||||
diff --git a/compat/corecrypto/ccsha1.h b/compat/corecrypto/ccsha1.h
|
||||
new file mode 100644
|
||||
index 0000000..8e3f85f
|
||||
--- /dev/null
|
||||
+++ b/compat/corecrypto/ccsha1.h
|
||||
@@ -0,0 +1,9 @@
|
||||
+// SPDX-License-Identifier: APSL-2.0
|
||||
+// CoreCrypto compatibility shims written by Randy Eckenrode © 2024
|
||||
+
|
||||
+#pragma once
|
||||
+
|
||||
+#include <corecrypto/ccdigest.h>
|
||||
+
|
||||
+
|
||||
+EXTERN_C const struct ccdigest_info* ccsha1_di(void);
|
||||
diff --git a/compat/corecrypto/ccsha2.c b/compat/corecrypto/ccsha2.c
|
||||
new file mode 100644
|
||||
index 0000000..6504503
|
||||
--- /dev/null
|
||||
+++ b/compat/corecrypto/ccsha2.c
|
||||
@@ -0,0 +1,22 @@
|
||||
+// SPDX-License-Identifier: APSL-2.0
|
||||
+// CoreCrypto compatibility shims written by Randy Eckenrode © 2024
|
||||
+
|
||||
+#include "ccsha2.h"
|
||||
+
|
||||
+#include <assert.h>
|
||||
+
|
||||
+#include <cs_blobs.h>
|
||||
+
|
||||
+#include "ccdigest_private.h"
|
||||
+
|
||||
+
|
||||
+static struct ccdigest_info* di = NULL;
|
||||
+
|
||||
+const struct ccdigest_info* ccsha256_di(void)
|
||||
+{
|
||||
+ if (!di) {
|
||||
+ di = _ccdigest_newprovider("SHA-256");
|
||||
+ assert(EVP_MD_get_size(di->provider) == CS_SHA256_LEN);
|
||||
+ }
|
||||
+ return di;
|
||||
+}
|
||||
diff --git a/compat/corecrypto/ccsha2.h b/compat/corecrypto/ccsha2.h
|
||||
new file mode 100644
|
||||
index 0000000..9f30e03
|
||||
--- /dev/null
|
||||
+++ b/compat/corecrypto/ccsha2.h
|
||||
@@ -0,0 +1,9 @@
|
||||
+// SPDX-License-Identifier: APSL-2.0
|
||||
+// CoreCrypto compatibility shims written by Randy Eckenrode © 2024
|
||||
+
|
||||
+#pragma once
|
||||
+
|
||||
+#include <corecrypto/ccdigest.h>
|
||||
+
|
||||
+
|
||||
+EXTERN_C const struct ccdigest_info* ccsha256_di(void);
|
||||
--
|
||||
2.45.1
|
||||
|
@ -0,0 +1,25 @@
|
||||
From 3e80d438e2a3ec50d666f2b6e32007c275d4a08a Mon Sep 17 00:00:00 2001
|
||||
From: Randy Eckenrode <randy@largeandhighquality.com>
|
||||
Date: Thu, 11 Apr 2024 23:13:29 -0400
|
||||
Subject: [PATCH 8/8] Disable searching in standard library locations
|
||||
|
||||
---
|
||||
src/ld/Options.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/ld/Options.cpp b/src/ld/Options.cpp
|
||||
index 67a9f53..611b583 100644
|
||||
--- a/src/ld/Options.cpp
|
||||
+++ b/src/ld/Options.cpp
|
||||
@@ -4320,7 +4320,7 @@ bool Options::shouldUseBuildVersion(ld::Platform plat, uint32_t minOSvers) const
|
||||
|
||||
void Options::buildSearchPaths(int argc, const char* argv[])
|
||||
{
|
||||
- bool addStandardLibraryDirectories = true;
|
||||
+ bool addStandardLibraryDirectories = false;
|
||||
ld::Platform platform = ld::Platform::unknown;
|
||||
std::vector<const char*> libraryPaths;
|
||||
std::vector<const char*> frameworkPaths;
|
||||
--
|
||||
2.45.1
|
||||
|
8
pkgs/by-name/ld/ld64/gen_compile_stubs.py
Normal file
8
pkgs/by-name/ld/ld64/gen_compile_stubs.py
Normal file
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env python
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
byteseq = (str(int(x)) for x in Path(sys.argv[1]).read_bytes())
|
||||
|
||||
print("#pragma once")
|
||||
print(f"static const char compile_stubs[] = {{ {', '.join(byteseq)} }};")
|
249
pkgs/by-name/ld/ld64/meson.build
Normal file
249
pkgs/by-name/ld/ld64/meson.build
Normal file
@ -0,0 +1,249 @@
|
||||
# Build settings based on the upstream Xcode project.
|
||||
# See: https://github.com/apple-oss-distributions/ld64/blob/main/ld64.xcodeproj/project.pbxproj
|
||||
|
||||
# Project settings
|
||||
project(
|
||||
'ld64',
|
||||
'c', 'cpp',
|
||||
version : '@version@',
|
||||
default_options : {'cpp_std': 'c++20'},
|
||||
)
|
||||
|
||||
fs = import('fs')
|
||||
|
||||
# Options
|
||||
target_prefix = get_option('target_prefix')
|
||||
|
||||
|
||||
# Dependencies
|
||||
cc = meson.get_compiler('c')
|
||||
cxx = meson.get_compiler('cpp')
|
||||
python = find_program('python3')
|
||||
|
||||
libtapi = cxx.find_library('tapi')
|
||||
openssl = dependency('openssl', version : '>=3.0')
|
||||
xar = cc.find_library('xar')
|
||||
|
||||
|
||||
# Feature tests
|
||||
|
||||
# macOS 10.12 does not support `DISPATCH_APPLY_AUTO`. Fortunately, `DISPATCH_APPLY_CURRENT_ROOT_QUEUE` has the
|
||||
# same value and was repurposed in subsequent releases as `DISPATCH_APPLY_AUTO`.
|
||||
dispatch_apply_auto_test = '''
|
||||
#include <dispatch/dispatch.h>
|
||||
int main(int argc, char* argv[]) {
|
||||
dispatch_queue_t queue = DISPATCH_APPLY_AUTO;
|
||||
return 0;
|
||||
}
|
||||
'''
|
||||
if not cc.compiles(
|
||||
dispatch_apply_auto_test,
|
||||
args : '-Wno-unused-command-line-argument',
|
||||
name : 'supports DISPATCH_APPLY_AUTO',
|
||||
)
|
||||
add_project_arguments(
|
||||
'-include', 'dispatch/private.h',
|
||||
'-DDISPATCH_APPLY_AUTO=DISPATCH_APPLY_CURRENT_ROOT_QUEUE',
|
||||
'-DPRIVATE', # The required API is private on the 10.12 SDK.
|
||||
language: ['c', 'cpp'],
|
||||
)
|
||||
endif
|
||||
|
||||
# The return type of `dispatch_get_global_queue` was changed in 10.14.
|
||||
# Use the older type if the SDK does not support it.
|
||||
dispatch_queue_global_test = '''
|
||||
#include <dispatch/dispatch.h>
|
||||
int main(int argc, char* argv[]) {
|
||||
dispatch_queue_global_t queue = dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0);
|
||||
return 0;
|
||||
}
|
||||
'''
|
||||
if not cc.compiles(
|
||||
dispatch_queue_global_test,
|
||||
args : '-Wno-unused-command-line-argument',
|
||||
name : 'supports dispatch_queue_global_t',
|
||||
)
|
||||
add_project_arguments('-Ddispatch_queue_global_t=dispatch_queue_t', language : ['c', 'cpp'])
|
||||
endif
|
||||
|
||||
|
||||
# Generated files
|
||||
|
||||
compile_stubs_h = custom_target(
|
||||
'compile_stubs.h',
|
||||
capture : true,
|
||||
command : [python, '@INPUT0@', '@INPUT1@'],
|
||||
input : ['gen_compile_stubs.py', 'compile_stubs'],
|
||||
output : ['compile_stubs.h'],
|
||||
)
|
||||
|
||||
configure_h = custom_target(
|
||||
'configure_h',
|
||||
command : ['bash', '@INPUT@'],
|
||||
env : {
|
||||
'DERIVED_FILE_DIR' : meson.current_build_dir(),
|
||||
'RC_ProjectSourceVersion': '@version@'
|
||||
},
|
||||
input : ['src/create_configure'],
|
||||
output : ['configure.h'],
|
||||
)
|
||||
|
||||
incdirs = include_directories(
|
||||
'compat',
|
||||
'include',
|
||||
'src/abstraction',
|
||||
'src/ld',
|
||||
'src/ld/code-sign-blobs',
|
||||
'src/ld/parsers',
|
||||
'src/ld/passes',
|
||||
'src/mach_o',
|
||||
)
|
||||
|
||||
# Dynamic libraries
|
||||
libcodedirectory = library(
|
||||
'codedirectory',
|
||||
dependencies : [openssl],
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
sources : [
|
||||
'compat/corecrypto/ccdigest.c',
|
||||
'compat/corecrypto/ccsha1.c',
|
||||
'compat/corecrypto/ccsha2.c',
|
||||
'compat/libcodedirectory.c',
|
||||
'src/ld/libcodedirectory.c'
|
||||
],
|
||||
soversion : 1,
|
||||
)
|
||||
install_headers(
|
||||
'src/ld/cs_blobs.h',
|
||||
'src/ld/libcodedirectory.h',
|
||||
)
|
||||
|
||||
|
||||
# Static libraries
|
||||
libprunetrie = static_library(
|
||||
'prunetrie',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
override_options : {'b_lto': false},
|
||||
sources : [
|
||||
'src/mach_o/Error.cpp',
|
||||
'src/mach_o/ExportsTrie.cpp',
|
||||
'src/other/PruneTrie.cpp',
|
||||
],
|
||||
)
|
||||
install_headers(
|
||||
'src/other/prune_trie.h',
|
||||
subdir : 'mach-o',
|
||||
)
|
||||
|
||||
|
||||
# Binaries
|
||||
ld64 = executable(
|
||||
f'@target_prefix@ld',
|
||||
dependencies : [libtapi, openssl, xar],
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
# These linker flags mirror those used in a release build of the Xcode project.
|
||||
# See: https://github.com/apple-oss-distributions/ld64/blob/47f477cb721755419018f7530038b272e9d0cdea/ld64.xcodeproj/project.pbxproj#L1292-L1299.
|
||||
link_args : [
|
||||
'-Wl,-exported_symbol,__mh_execute_header',
|
||||
'-Wl,-stack_size,0x02000000',
|
||||
'-Wl,-client_name,ld',
|
||||
],
|
||||
link_with : [libcodedirectory],
|
||||
sources : [
|
||||
compile_stubs_h,
|
||||
configure_h,
|
||||
'compat/CommonCrypto/CommonDigestSPI.c',
|
||||
'compat/corecrypto/ccdigest.c',
|
||||
'compat/corecrypto/ccsha1.c',
|
||||
'compat/corecrypto/ccsha2.c',
|
||||
'src/ld/FatFile.cpp',
|
||||
'src/ld/InputFiles.cpp',
|
||||
'src/ld/Mangling.cpp',
|
||||
'src/ld/Options.cpp',
|
||||
'src/ld/OutputFile.cpp',
|
||||
'src/ld/PlatformSupport.cpp',
|
||||
'src/ld/Resolver.cpp',
|
||||
'src/ld/ResponseFiles.cpp',
|
||||
'src/ld/Snapshot.cpp',
|
||||
'src/ld/SymbolTable.cpp',
|
||||
'src/ld/code-sign-blobs/blob.cpp',
|
||||
'src/ld/code-sign-blobs/blob.h',
|
||||
'src/ld/debugline.c',
|
||||
'src/ld/ld.cpp',
|
||||
'src/ld/parsers/archive_file.cpp',
|
||||
'src/ld/parsers/generic_dylib_file.cpp',
|
||||
'src/ld/parsers/lto_file.cpp',
|
||||
'src/ld/parsers/macho_dylib_file.cpp',
|
||||
'src/ld/parsers/macho_relocatable_file.cpp',
|
||||
'src/ld/parsers/opaque_section_file.cpp',
|
||||
'src/ld/parsers/textstub_dylib_file.cpp',
|
||||
'src/ld/passes/bitcode_bundle.cpp',
|
||||
'src/ld/passes/branch_island.cpp',
|
||||
'src/ld/passes/branch_shim.cpp',
|
||||
'src/ld/passes/code_dedup.cpp',
|
||||
'src/ld/passes/compact_unwind.cpp',
|
||||
'src/ld/passes/dtrace_dof.cpp',
|
||||
'src/ld/passes/dylibs.cpp',
|
||||
'src/ld/passes/got.cpp',
|
||||
'src/ld/passes/huge.cpp',
|
||||
'src/ld/passes/inits.cpp',
|
||||
'src/ld/passes/objc.cpp',
|
||||
'src/ld/passes/objc_constants.cpp',
|
||||
'src/ld/passes/objc_stubs.cpp',
|
||||
'src/ld/passes/order.cpp',
|
||||
'src/ld/passes/stubs/stubs.cpp',
|
||||
'src/ld/passes/thread_starts.cpp',
|
||||
'src/ld/passes/tlvp.cpp',
|
||||
'src/mach_o/Error.cpp',
|
||||
'src/mach_o/ExportsTrie.cpp',
|
||||
],
|
||||
)
|
||||
install_man('doc/man/man1/ld-classic.1')
|
||||
|
||||
# Extra tools
|
||||
unwinddump = executable(
|
||||
f'@target_prefix@unwinddump',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
sources : [
|
||||
configure_h,
|
||||
'src/other/UnwindDump.cpp',
|
||||
],
|
||||
)
|
||||
install_man('doc/man/man1/unwinddump.1')
|
||||
|
||||
machocheck = executable(
|
||||
f'@target_prefix@machocheck',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
sources : [
|
||||
configure_h,
|
||||
'src/other/machochecker.cpp',
|
||||
],
|
||||
)
|
||||
|
||||
objectdump = executable(
|
||||
f'@target_prefix@ObjectDump',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
sources : [
|
||||
configure_h,
|
||||
'src/ld/PlatformSupport.cpp',
|
||||
'src/ld/debugline.c',
|
||||
'src/ld/parsers/macho_relocatable_file.cpp',
|
||||
'src/other/ObjectDump.cpp',
|
||||
],
|
||||
)
|
||||
|
||||
objcimageinfo = executable(
|
||||
f'@target_prefix@objcimageinfo',
|
||||
include_directories : incdirs,
|
||||
install : true,
|
||||
sources : [
|
||||
configure_h,
|
||||
'src/other/objcimageinfo.cpp',
|
||||
],
|
||||
)
|
6
pkgs/by-name/ld/ld64/meson.options
Normal file
6
pkgs/by-name/ld/ld64/meson.options
Normal file
@ -0,0 +1,6 @@
|
||||
option(
|
||||
'target_prefix',
|
||||
type : 'string',
|
||||
value : '',
|
||||
description: 'Specifies the prefix to use when building for cross-compilation (e.g., `aarch64-apple-darwin`)'
|
||||
)
|
202
pkgs/by-name/ld/ld64/package.nix
Normal file
202
pkgs/by-name/ld/ld64/package.nix
Normal file
@ -0,0 +1,202 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
fetchurl,
|
||||
darwin,
|
||||
libtapi,
|
||||
libunwind,
|
||||
llvm,
|
||||
meson,
|
||||
ninja,
|
||||
openssl,
|
||||
pkg-config,
|
||||
python3,
|
||||
swiftPackages,
|
||||
xar,
|
||||
gitUpdater,
|
||||
}:
|
||||
|
||||
let
|
||||
# The targetPrefix is prepended to binary names to allow multiple binutils on the PATH to be usable.
|
||||
targetPrefix = lib.optionalString (
|
||||
stdenv.targetPlatform != stdenv.hostPlatform
|
||||
) "${stdenv.targetPlatform.config}-";
|
||||
|
||||
# ld64 needs CrashReporterClient.h, which is hard to find, but WebKit2 has it.
|
||||
# Fetch it directly because the Darwin stdenv bootstrap can’t depend on fetchgit.
|
||||
crashreporter_h = fetchurl {
|
||||
url = "https://raw.githubusercontent.com/apple-oss-distributions/WebKit2/WebKit2-7605.1.33.0.2/Platform/spi/Cocoa/CrashReporterClientSPI.h";
|
||||
hash = "sha256-0ybVcwHuGEdThv0PPjYQc3SW0YVOyrM3/L9zG/l1Vtk=";
|
||||
};
|
||||
|
||||
# First version with all the required definitions. This is used in preference to darwin.xnu to make it easier
|
||||
# to support Linux and because the version of darwin.xnu available on x86_64-darwin in the 10.12 SDK is too old.
|
||||
xnu = fetchFromGitHub {
|
||||
name = "xnu-src";
|
||||
owner = "apple-oss-distributions";
|
||||
repo = "xnu";
|
||||
rev = "xnu-6153.11.26";
|
||||
hash = "sha256-dcnGcp7bIjQxeAn5pXt+mHSYEXb2Ad9Smhd/WUG4kb4=";
|
||||
};
|
||||
|
||||
# Avoid pulling in all of Swift just to build libdispatch
|
||||
libdispatch = swiftPackages.Dispatch.override { useSwift = false; };
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "ld64";
|
||||
version = "951.9";
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
"dev"
|
||||
"lib"
|
||||
];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "apple-oss-distributions";
|
||||
repo = "ld64";
|
||||
rev = "ld64-${finalAttrs.version}";
|
||||
hash = "sha256-hLkfqgBwVPlO4gfriYOawTO5E1zSD63ZcNetm1E5I70";
|
||||
};
|
||||
|
||||
xcodeHash = "sha256-+j7Ed/6aD46SJnr3DWPfWuYWylb2FNJRPmWsUVxZJHM=";
|
||||
|
||||
postUnpack = ''
|
||||
unpackFile '${xnu}'
|
||||
|
||||
# Verify that the Xcode project has not changed unexpectedly.
|
||||
hashType=$(echo $xcodeHash | cut -d- -f1)
|
||||
expectedHash=$(echo $xcodeHash | cut -d- -f2)
|
||||
hash=$(openssl "$hashType" -binary "$sourceRoot/ld64.xcodeproj/project.pbxproj" | base64)
|
||||
|
||||
if [ "$hash" != "$expectedHash" ]; then
|
||||
echo 'error: hash mismatch in ld64.xcodeproj/project.pbxproj'
|
||||
echo " specified: $xcodeHash"
|
||||
echo " got: $hashType-$hash"
|
||||
echo
|
||||
echo 'Upstream Xcode project has changed. Update `meson.build` with any changes, then update `xcodeHash`.'
|
||||
echo 'Use `nix-hash --flat --sri --type sha256 ld64.xcodeproj/project.pbxproj` to regenerate it.'
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
|
||||
patches = [
|
||||
# Use std::atomic for atomics. Replaces private APIs (`os/lock_private.h`) with standard APIs.
|
||||
./0004-Use-std-atomics-and-std-mutex.patch
|
||||
# ld64 assumes the default libLTO.dylib can be found relative to its bindir, which is
|
||||
# not the case in nixpkgs. Override it to default to `stdenv.cc`’s libLTO.dylib.
|
||||
./0005-Support-LTO-in-nixpkgs.patch
|
||||
# Add implementation of missing function required for code directory support.
|
||||
./0006-Add-libcd_is_blob_a_linker_signature-implementation.patch
|
||||
# Add OpenSSL implementation of CoreCrypto digest functions. Avoids use of private and non-free APIs.
|
||||
./0007-Add-OpenSSL-based-CoreCrypto-digest-functions.patch
|
||||
# ld64 will search `/usr/lib`, `/Library/Frameworks`, etc by default. Disable that.
|
||||
./0008-Disable-searching-in-standard-library-locations.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substitute ${./meson.build} meson.build \
|
||||
--subst-var version
|
||||
cp ${./meson.options} meson.options
|
||||
|
||||
# Copy headers for certain private APIs
|
||||
mkdir -p include
|
||||
substitute ${crashreporter_h} include/CrashReporterClient.h \
|
||||
--replace-fail 'USE(APPLE_INTERNAL_SDK)' '0'
|
||||
|
||||
# Copy from the source so the headers can be used on Linux and x86_64-darwin
|
||||
mkdir -p include/System
|
||||
for dir in arm i386 machine; do
|
||||
cp -r ../xnu-src/osfmk/$dir include/System/$dir
|
||||
done
|
||||
mkdir -p include/sys
|
||||
cp ../xnu-src/bsd/sys/commpage.h include/sys
|
||||
|
||||
# Match the version format used by upstream.
|
||||
sed -i src/ld/Options.cpp \
|
||||
-e '1iconst char ld_classicVersionString[] = "@(#)PROGRAM:ld PROJECT:ld64-${finalAttrs.version}\\n";'
|
||||
|
||||
# Instead of messing around with trying to extract and run the script from the Xcode project,
|
||||
# just use our own Python script to generate `compile_stubs.h`
|
||||
cp ${./gen_compile_stubs.py} gen_compile_stubs.py
|
||||
|
||||
# Enable LTO support using LLVM’s libLTO.dylib by default.
|
||||
substituteInPlace src/ld/InputFiles.cpp \
|
||||
--subst-var-by libllvm '${lib.getLib llvm}'
|
||||
substituteInPlace src/ld/parsers/lto_file.cpp \
|
||||
--subst-var-by libllvm '${lib.getLib llvm}'
|
||||
|
||||
# Use portable includes
|
||||
substituteInPlace src/ld/code-sign-blobs/endian.h \
|
||||
--replace-fail '#include <machine/endian.h>' '#include <sys/types.h>'
|
||||
'';
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
meson
|
||||
ninja
|
||||
openssl
|
||||
pkg-config
|
||||
python3
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
libtapi
|
||||
llvm
|
||||
libunwind
|
||||
openssl
|
||||
xar
|
||||
] ++ lib.optionals stdenv.isDarwin [ darwin.dyld ] ++ lib.optionals stdenv.isLinux [ libdispatch ];
|
||||
|
||||
# Note for overrides: ld64 cannot be built as a debug build because of UB in its iteration implementations,
|
||||
# which trigger libc++ debug assertions due to trying to take the address of the first element of an emtpy vector.
|
||||
mesonBuildType = "release";
|
||||
|
||||
mesonFlags = [
|
||||
(lib.mesonOption "b_ndebug" "if-release")
|
||||
(lib.mesonOption "default_library" (if stdenv.hostPlatform.isStatic then "static" else "shared"))
|
||||
] ++ lib.optionals (targetPrefix != "") [ (lib.mesonOption "target_prefix" targetPrefix) ];
|
||||
|
||||
doInstallCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
|
||||
|
||||
# ld64 has a test suite, but many of the tests fail (even with ld from Xcode). Instead
|
||||
# of running the test suite, rebuild ld64 using itself to link itself as a check.
|
||||
# LTO is enabled only to confirm that it is set up and working properly in nixpkgs.
|
||||
installCheckPhase = ''
|
||||
runHook preInstallCheck
|
||||
|
||||
cd "$NIX_BUILD_TOP/$sourceRoot"
|
||||
|
||||
export NIX_CFLAGS_COMPILE+=" --ld-path=$out/bin/${targetPrefix}ld"
|
||||
meson setup build-install-check -Db_lto=true --buildtype=$mesonBuildType
|
||||
|
||||
cd build-install-check
|
||||
ninja ${targetPrefix}ld "-j$NIX_BUILD_CORES"
|
||||
|
||||
# Confirm that ld found the LTO library and reports it.
|
||||
./${targetPrefix}ld -v 2>&1 | grep -q 'LTO support'
|
||||
|
||||
runHook postInstallCheck
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
ln -s ld-classic.1 "$out/share/man/man1/ld.1"
|
||||
ln -s ld.1 "$out/share/man/man1/ld64.1"
|
||||
moveToOutput lib/libprunetrie.a "$dev"
|
||||
'';
|
||||
|
||||
__structuredAttrs = true;
|
||||
|
||||
passthru.updateScript = gitUpdater { rev-prefix = "ld64-"; };
|
||||
|
||||
meta = {
|
||||
description = "The classic linker for Darwin";
|
||||
homepage = "https://opensource.apple.com/releases/";
|
||||
license = lib.licenses.apple-psl20;
|
||||
mainProgram = "ld";
|
||||
maintainers = with lib.maintainers; [ reckenrode ];
|
||||
platforms = lib.platforms.darwin; # Porting to other platforms is incomplete. Support only Darwin for now.
|
||||
};
|
||||
})
|
@ -0,0 +1,37 @@
|
||||
From e954aacbc075355419f5fc99db61f68aca1fcfe4 Mon Sep 17 00:00:00 2001
|
||||
From: Randy Eckenrode <randy@largeandhighquality.com>
|
||||
Date: Fri, 5 Apr 2024 14:16:40 -0400
|
||||
Subject: [PATCH 1/3] Check for -no_exported_symbols linker support
|
||||
|
||||
---
|
||||
CMakeLists.txt | 7 ++++++-
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tapi/CMakeLists.txt b/tapi/CMakeLists.txt
|
||||
index 62affdf..82426de 100644
|
||||
--- a/tapi/CMakeLists.txt
|
||||
+++ b/tapi/CMakeLists.txt
|
||||
@@ -73,6 +73,9 @@ llvm_check_linker_flag(CXX "-Wl,-no_inits" LINKER_SUPPORTS_NO_INITS)
|
||||
llvm_check_linker_flag(CXX "-Wl,-iosmac_version_min,13.0" LINKER_SUPPORTS_IOSMAC)
|
||||
# MARZIPAN RENAME
|
||||
|
||||
+# Older versions of ld64 (e.g., in the Darwin bootstrap) do not support this flag.
|
||||
+llvm_check_linker_flag(CXX "-Wl,-no_exported_symbols" LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS)
|
||||
+
|
||||
# Check if i386 is supported.
|
||||
SET(CMAKE_OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
SET(CMAKE_OLD_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
|
||||
@@ -160,7 +163,9 @@ endmacro(add_tapi_library)
|
||||
macro(add_tapi_executable name)
|
||||
add_llvm_executable(${name} ${ARGN})
|
||||
set_target_properties(${name} PROPERTIES FOLDER "Tapi executables")
|
||||
- target_link_options(${name} PRIVATE "-Wl,-no_exported_symbols")
|
||||
+ if(LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS)
|
||||
+ target_link_options(${name} PRIVATE "-Wl,-no_exported_symbols")
|
||||
+ endif()
|
||||
endmacro(add_tapi_executable)
|
||||
|
||||
function(tapi_clang_tablegen)
|
||||
--
|
||||
2.42.0
|
||||
|
@ -0,0 +1,25 @@
|
||||
From 77ca537cfc61765f2109c626757f2da8de602ce0 Mon Sep 17 00:00:00 2001
|
||||
From: Randy Eckenrode <randy@largeandhighquality.com>
|
||||
Date: Fri, 5 Apr 2024 23:20:32 -0400
|
||||
Subject: [PATCH 2/3] Pass fileType to writeToStream
|
||||
|
||||
---
|
||||
lib/Core/JSONReaderWriter.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tapi/lib/Core/JSONReaderWriter.cpp b/tapi/lib/Core/JSONReaderWriter.cpp
|
||||
index c040670..c1be85f 100644
|
||||
--- a/tapi/lib/Core/JSONReaderWriter.cpp
|
||||
+++ b/tapi/lib/Core/JSONReaderWriter.cpp
|
||||
@@ -57,7 +57,7 @@ Error JSONWriter::writeFile(raw_ostream &os, const InterfaceFile *file,
|
||||
if (file == nullptr)
|
||||
return errorCodeToError(std::make_error_code(std::errc::invalid_argument));
|
||||
|
||||
- return TextAPIWriter::writeToStream(os, *file, /*Compact=*/false);
|
||||
+ return TextAPIWriter::writeToStream(os, *file, fileType, /*Compact=*/false);
|
||||
}
|
||||
|
||||
TAPI_NAMESPACE_INTERNAL_END
|
||||
--
|
||||
2.42.0
|
||||
|
@ -0,0 +1,28 @@
|
||||
From b69038edb2e0ace9128407ab3ee7bc1001ffd751 Mon Sep 17 00:00:00 2001
|
||||
From: Randy Eckenrode <randy@largeandhighquality.com>
|
||||
Date: Sun, 7 Apr 2024 19:23:24 -0400
|
||||
Subject: [PATCH 3/3] Match designator order with declaration order
|
||||
|
||||
---
|
||||
lib/Core/Demangler.cpp | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tapi/lib/Core/Demangler.cpp b/tapi/lib/Core/Demangler.cpp
|
||||
index d85899a..f5c485a 100644
|
||||
--- a/tapi/lib/Core/Demangler.cpp
|
||||
+++ b/tapi/lib/Core/Demangler.cpp
|
||||
@@ -30,9 +30,10 @@ bool Demangler::isItaniumEncoding(StringRef mangledName) {
|
||||
return mangledName.startswith("_Z") || mangledName.startswith("___Z");
|
||||
}
|
||||
|
||||
+
|
||||
DemangledName Demangler::demangle(StringRef mangledName) {
|
||||
DemangledName result{
|
||||
- .str = mangledName.str(), .isSwift = false, .isItanium = false};
|
||||
+ .str = mangledName.str(), .isItanium = false, .isSwift = false};
|
||||
char *demangled = nullptr;
|
||||
|
||||
if (isItaniumEncoding(mangledName)) {
|
||||
--
|
||||
2.42.0
|
||||
|
184
pkgs/by-name/li/libtapi/package.nix
Normal file
184
pkgs/by-name/li/libtapi/package.nix
Normal file
@ -0,0 +1,184 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
fetchpatch,
|
||||
cmake,
|
||||
ninja,
|
||||
python3,
|
||||
zlib,
|
||||
}:
|
||||
|
||||
let
|
||||
# libtapi is only supported building against Apple’s LLVM fork pinned to a specific revision.
|
||||
# It can’t be built against upstream LLVM because it uses APIs that are specific to Apple’s fork.
|
||||
# See: https://github.com/apple-oss-distributions/tapi/blob/main/Readme.md
|
||||
|
||||
# Apple’s LLVM fork uses its own versioning scheme.
|
||||
# See: https://en.wikipedia.org/wiki/Xcode#Toolchain_versions
|
||||
# Note: Can’t use a sparse checkout because the Darwin stdenv bootstrap can’t depend on fetchgit.
|
||||
appleLlvm = {
|
||||
version = "15.0.0"; # As reported by upstream’s `tapi --version`.
|
||||
rev = "2b5ff47e44b059c03de5779479d01a133ab4d581"; # Per the TAPI repo.
|
||||
hash = "sha256-X37zBbpSEWmqtdTXsd1t++gp+0ggA8YtB73fGKNaiR0=";
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "libtapi";
|
||||
version = "1500.0.12.3";
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
"bin"
|
||||
"dev"
|
||||
];
|
||||
|
||||
srcs = [
|
||||
(fetchFromGitHub {
|
||||
name = "tapi-src";
|
||||
owner = "apple-oss-distributions";
|
||||
repo = "tapi";
|
||||
rev = "tapi-${finalAttrs.version}";
|
||||
hash = "sha256-YeaA2OeSY1fXYJHPJJ0TrVC1brspSvutBtPMPGX6Y1o=";
|
||||
})
|
||||
# libtapi can’t avoid pulling the whole repo even though it needs only a couple of folders because
|
||||
# `fetchgit` can’t be used in the Darwin bootstrap.
|
||||
(fetchFromGitHub {
|
||||
name = "apple-llvm-src";
|
||||
owner = "apple";
|
||||
repo = "llvm-project";
|
||||
inherit (appleLlvm) rev hash;
|
||||
})
|
||||
];
|
||||
|
||||
patches = [
|
||||
# Older versions of ld64 may not support `-no_exported_symbols`, so use it only
|
||||
# when the linker supports it.
|
||||
# Note: This can be dropped once the bootstrap tools are updated after the ld64 update.
|
||||
./0001-Check-for-no_exported_symbols-linker-support.patch
|
||||
# The recommended upstream revision of Apple’s LLVM fork needs this patch, or
|
||||
# `tapi stubify` will crash when generating stubs.
|
||||
(fetchpatch {
|
||||
url = "https://github.com/apple/llvm-project/commit/455bf3d1ccd6a52df5e38103532c1b8f49924edc.patch";
|
||||
hash = "sha256-ujZcfdAls20JPIvjvO2Xv8st8cNTY/XTEQusICKBKSA";
|
||||
})
|
||||
# Updates `JSONReaderWriter` to work with the API change in the above patch.
|
||||
./0002-Pass-fileType-to-writeToStream.patch
|
||||
# Fix build on Linux. GCC is more picky than clang about the field order.
|
||||
./0003-Match-designator-order-with-declaration-order.patch
|
||||
];
|
||||
|
||||
postPatch =
|
||||
''
|
||||
# Enable building on non-Darwin platforms
|
||||
substituteInPlace tapi/CMakeLists.txt \
|
||||
--replace-fail 'message(FATAL_ERROR "Unsupported configuration.")' ""
|
||||
|
||||
# Remove the client limitation on linking to libtapi.dylib.
|
||||
substituteInPlace tapi/tools/libtapi/CMakeLists.txt \
|
||||
--replace-fail '-allowable_client ld' ""
|
||||
# Replace hard-coded installation paths with standard ones.
|
||||
declare -A installdirs=(
|
||||
[bin]=BINDIR
|
||||
[include]=INCLUDEDIR
|
||||
[lib]=LIBDIR
|
||||
[local/bin]=BINDIR
|
||||
[local/share/man]=MANDIR
|
||||
[share/man]=MANDIR
|
||||
)
|
||||
for dir in "''${!installdirs[@]}"; do
|
||||
cmakevar=CMAKE_INSTALL_''${installdirs[$dir]}
|
||||
for cmakelist in $(grep -rl "DESTINATION $dir" tapi); do
|
||||
substituteInPlace "$cmakelist" \
|
||||
--replace-fail "DESTINATION $dir" "DESTINATION \''${$cmakevar}"
|
||||
done
|
||||
done
|
||||
# Doesn’t seem to exist publically.
|
||||
substituteInPlace tapi/test/CMakeLists.txt \
|
||||
--replace-fail tapi-configs ""
|
||||
''
|
||||
+ lib.optionalString stdenv.isLinux ''
|
||||
# Remove Darwin-specific versioning flags.
|
||||
substituteInPlace tapi/tools/libtapi/CMakeLists.txt \
|
||||
--replace-fail '-current_version ''${DYLIB_VERSION} -compatibility_version 1' ""
|
||||
'';
|
||||
|
||||
preUnpack = ''
|
||||
mkdir source
|
||||
'';
|
||||
|
||||
sourceRoot = "source";
|
||||
|
||||
postUnpack = ''
|
||||
chmod -R u+w apple-llvm-src tapi-src
|
||||
mv apple-llvm-src/{clang,cmake,llvm,utils} source
|
||||
mv tapi-src source/tapi
|
||||
'';
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
buildInputs = [ zlib ]; # Upstream links against zlib in their distribution.
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
ninja
|
||||
python3
|
||||
];
|
||||
|
||||
cmakeDir = "../llvm";
|
||||
|
||||
cmakeFlags = [
|
||||
(lib.cmakeFeature "LLVM_ENABLE_PROJECTS" "clang;tapi")
|
||||
(lib.cmakeFeature "LLVM_EXTERNAL_PROJECTS" "tapi")
|
||||
(lib.cmakeBool "TAPI_INCLUDE_DOCS" true)
|
||||
# Matches the version string format reported by upstream `tapi`.
|
||||
(lib.cmakeFeature "TAPI_REPOSITORY_STRING" "tapi-${finalAttrs.version}")
|
||||
(lib.cmakeFeature "TAPI_FULL_VERSION" appleLlvm.version)
|
||||
# Match the versioning used by Apple’s LLVM fork (primarily used for .so versioning).
|
||||
(lib.cmakeFeature "LLVM_VERSION_MAJOR" (lib.versions.major appleLlvm.version))
|
||||
(lib.cmakeFeature "LLVM_VERSION_MINOR" (lib.versions.minor appleLlvm.version))
|
||||
(lib.cmakeFeature "LLVM_VERSION_PATCH" (lib.versions.patch appleLlvm.version))
|
||||
(lib.cmakeFeature "LLVM_VERSION_SUFFIX" "")
|
||||
# Upstream `tapi` does not link against ncurses. Disable it explicitly to make sure
|
||||
# it is not detected incorrectly from the bootstrap tools tarball.
|
||||
(lib.cmakeBool "LLVM_ENABLE_TERMINFO" false)
|
||||
# Disabling the benchmarks avoids a failure during the configure phase because
|
||||
# the sparse checkout does not include the benchmarks.
|
||||
(lib.cmakeBool "LLVM_INCLUDE_BENCHMARKS" false)
|
||||
# tapi’s tests expect to target macOS 13.0 and build both x86_64 and universal
|
||||
# binaries regardless of the host platform.
|
||||
(lib.cmakeBool "LLVM_INCLUDE_TESTS" false)
|
||||
(lib.cmakeBool "TAPI_INCLUDE_TESTS" false)
|
||||
];
|
||||
|
||||
ninjaFlags = [
|
||||
"libtapi"
|
||||
"tapi-sdkdb"
|
||||
"tapi"
|
||||
];
|
||||
|
||||
installTargets = [
|
||||
"install-libtapi"
|
||||
"install-tapi-docs"
|
||||
"install-tapi-headers"
|
||||
"install-tapi-sdkdb"
|
||||
"install-tapi"
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
# The man page is installed for these, but they’re not included in the source release.
|
||||
rm $bin/share/man/man1/tapi-analyze.1 $bin/share/man/man1/tapi-api-verify.1
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Replaces the Mach-O Dynamic Library Stub files in Apple's SDKs to reduce the size";
|
||||
homepage = "https://github.com/apple-oss-distributions/tapi/";
|
||||
license = lib.licenses.ncsa;
|
||||
mainProgram = "tapi";
|
||||
maintainers = with lib.maintainers; [
|
||||
matthewbauer
|
||||
reckenrode
|
||||
];
|
||||
platforms = lib.platforms.unix;
|
||||
};
|
||||
})
|
@ -41,7 +41,6 @@ let
|
||||
isDarwin
|
||||
buildPlatform
|
||||
targetPlatform;
|
||||
inherit (darwin) cctools-llvm;
|
||||
inherit (swiftPackages) apple_sdk swift;
|
||||
|
||||
releaseManifest = lib.importJSON releaseManifestFile;
|
||||
@ -53,16 +52,6 @@ let
|
||||
|
||||
sigtool = callPackage ./sigtool.nix {};
|
||||
|
||||
# we need dwarfdump from cctools, but can't have e.g. 'ar' overriding stdenv
|
||||
dwarfdump = stdenvNoCC.mkDerivation {
|
||||
name = "dwarfdump-wrapper";
|
||||
dontUnpack = true;
|
||||
installPhase = ''
|
||||
mkdir -p "$out/bin"
|
||||
ln -s "${cctools-llvm}/bin/dwarfdump" "$out/bin"
|
||||
'';
|
||||
};
|
||||
|
||||
_icu = if isDarwin then darwin.ICU else icu;
|
||||
|
||||
in stdenv.mkDerivation rec {
|
||||
@ -118,7 +107,6 @@ in stdenv.mkDerivation rec {
|
||||
buildInputs = old.buildInputs ++ old.propagatedBuildInputs;
|
||||
propagatedBuildInputs = [];
|
||||
}))
|
||||
dwarfdump
|
||||
sigtool
|
||||
Foundation
|
||||
CoreFoundation
|
||||
|
@ -157,18 +157,16 @@ let
|
||||
|
||||
otool = cc.bintools.bintools;
|
||||
|
||||
# GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is
|
||||
# part of the bintools wrapper (due to codesigning requirements), but not on
|
||||
# x86_64-darwin. We decide based on target platform to have consistent tools
|
||||
# across all GHC stages.
|
||||
install_name_tool =
|
||||
if stdenv.targetPlatform.isAarch64
|
||||
then cc.bintools
|
||||
else cc.bintools.bintools;
|
||||
# Same goes for strip.
|
||||
# GHC needs install_name_tool on all darwin platforms. The same one can
|
||||
# be used on both platforms. It is safe to use with linker-generated
|
||||
# signatures because it will update the signatures automatically after
|
||||
# modifying the target binary.
|
||||
install_name_tool = cc.bintools.bintools;
|
||||
|
||||
# strip on darwin is wrapped to enable deterministic mode.
|
||||
strip =
|
||||
# TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold"
|
||||
if stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin
|
||||
if stdenv.targetPlatform.isDarwin
|
||||
then cc.bintools
|
||||
else cc.bintools.bintools;
|
||||
}.${name};
|
||||
|
@ -288,18 +288,16 @@ let
|
||||
|
||||
otool = cc.bintools.bintools;
|
||||
|
||||
# GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is
|
||||
# part of the bintools wrapper (due to codesigning requirements), but not on
|
||||
# x86_64-darwin. We decide based on target platform to have consistent tools
|
||||
# across all GHC stages.
|
||||
install_name_tool =
|
||||
if stdenv.targetPlatform.isAarch64
|
||||
then cc.bintools
|
||||
else cc.bintools.bintools;
|
||||
# Same goes for strip.
|
||||
# GHC needs install_name_tool on all darwin platforms. The same one can
|
||||
# be used on both platforms. It is safe to use with linker-generated
|
||||
# signatures because it will update the signatures automatically after
|
||||
# modifying the target binary.
|
||||
install_name_tool = cc.bintools.bintools;
|
||||
|
||||
# strip on darwin is wrapped to enable deterministic mode.
|
||||
strip =
|
||||
# TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold"
|
||||
if stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin
|
||||
if stdenv.targetPlatform.isDarwin
|
||||
then cc.bintools
|
||||
else cc.bintools.bintools;
|
||||
}.${name};
|
||||
|
@ -157,18 +157,16 @@ let
|
||||
|
||||
otool = cc.bintools.bintools;
|
||||
|
||||
# GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is
|
||||
# part of the bintools wrapper (due to codesigning requirements), but not on
|
||||
# x86_64-darwin. We decide based on target platform to have consistent tools
|
||||
# across all GHC stages.
|
||||
install_name_tool =
|
||||
if stdenv.targetPlatform.isAarch64
|
||||
then cc.bintools
|
||||
else cc.bintools.bintools;
|
||||
# Same goes for strip.
|
||||
# GHC needs install_name_tool on all darwin platforms. The same one can
|
||||
# be used on both platforms. It is safe to use with linker-generated
|
||||
# signatures because it will update the signatures automatically after
|
||||
# modifying the target binary.
|
||||
install_name_tool = cc.bintools.bintools;
|
||||
|
||||
# strip on darwin is wrapped to enable deterministic mode.
|
||||
strip =
|
||||
# TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold"
|
||||
if stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin
|
||||
if stdenv.targetPlatform.isDarwin
|
||||
then cc.bintools
|
||||
else cc.bintools.bintools;
|
||||
}.${name};
|
||||
|
@ -58,10 +58,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
pname = targetPrefix + "binutils";
|
||||
inherit version;
|
||||
|
||||
# HACK: Ensure that we preserve source from bootstrap binutils to not rebuild LLVM
|
||||
src = stdenv.__bootPackages.binutils-unwrapped.src
|
||||
or srcs.${targetPlatform.system}
|
||||
or srcs.normal;
|
||||
src = srcs.${targetPlatform.system} or srcs.normal;
|
||||
|
||||
# WARN: this package is used for bootstrapping fetchurl, and thus cannot use
|
||||
# fetchpatch! All mutable patches (generated by GitHub or cgit) that are
|
||||
|
@ -363,7 +363,7 @@ in rec {
|
||||
|
||||
objc4 = pkgs.darwin.libobjc;
|
||||
|
||||
sdkRoot = pkgs.callPackage ./sdkRoot.nix { sdkVersion = "10.12"; };
|
||||
sdkRoot = pkgs.callPackage ./sdkRoot.nix { sdkVersion = "10.12.4"; };
|
||||
|
||||
inherit (pkgs.darwin) Libsystem;
|
||||
|
||||
|
@ -0,0 +1,244 @@
|
||||
From dd3a2378cca465ec783fd792158b2fc11f83722c Mon Sep 17 00:00:00 2001
|
||||
From: Randy Eckenrode <randy@largeandhighquality.com>
|
||||
Date: Tue, 2 Jul 2024 20:04:56 -0400
|
||||
Subject: [PATCH] Support setting an upper bound on versions
|
||||
|
||||
---
|
||||
availability | 94 ++++++++++++++++++++++++++++++++++------------------
|
||||
1 file changed, 61 insertions(+), 33 deletions(-)
|
||||
|
||||
diff --git a/availability b/availability
|
||||
index 8ebd250..5bb9edb 100755
|
||||
--- a/availability
|
||||
+++ b/availability
|
||||
@@ -17,12 +17,34 @@ MIN_PYTHON = (3, 7) #Required for ordered dictionaries as default
|
||||
if sys.version_info < MIN_PYTHON:
|
||||
sys.exit("Python %s.%s or later is required.\n" % MIN_PYTHON)
|
||||
|
||||
+
|
||||
+def parse_version(ver):
|
||||
+ if hasattr(ver, "string"):
|
||||
+ ver = ver.string()
|
||||
+
|
||||
+ return (tuple(map(int, ver.split("."))) + (0, 0))[:3]
|
||||
+
|
||||
+
|
||||
+def version_older_or_equal(lhs, rhs):
|
||||
+ if not rhs:
|
||||
+ return True
|
||||
+
|
||||
+ lhs_major, lhs_minor, lhs_patch = parse_version(lhs)
|
||||
+ rhs_major, rhs_minor, rhs_patch = parse_version(rhs)
|
||||
+
|
||||
+ return (
|
||||
+ lhs_major < rhs_major
|
||||
+ or (lhs_major == rhs_major and lhs_minor < rhs_minor)
|
||||
+ or (lhs_major == rhs_major and lhs_minor == rhs_minor and lhs_patch <= rhs_patch)
|
||||
+ )
|
||||
+
|
||||
+
|
||||
# The build script will embed the DSL content here, otherwise we build it at runtime
|
||||
dslContent = None
|
||||
# @@INSERT_DSL_CONTENT()@@
|
||||
|
||||
class VersionSetDSL:
|
||||
- def __init__(self, data): self.parsedDSL = self.Parser(data)
|
||||
+ def __init__(self, data, threshold): self.parsedDSL = self.Parser(data, threshold)
|
||||
def sets(self): return self.parsedDSL.version_sets
|
||||
def platforms(self): return self.parsedDSL.platforms
|
||||
|
||||
@@ -104,12 +126,15 @@ class VersionSetDSL:
|
||||
self.availability_deprecation_define_name = optionals["availability_deprecation_define_name"]
|
||||
if "version_define_name" in optionals:
|
||||
self.availability_define_prefix = f"__{optionals['version_define_name']}_"
|
||||
- def add_version(self, version): return self.versions.append(version);
|
||||
+ def add_version(self, version, threshold):
|
||||
+ if version_older_or_equal(version, threshold):
|
||||
+ self.versions.append(version)
|
||||
def add_variant(self, variant): return self.variants.append(variant);
|
||||
class Parser:
|
||||
platforms = {}
|
||||
version_sets = []
|
||||
- def __init__(self, data):
|
||||
+ def __init__(self, data, threshold):
|
||||
+ self.threshold = threshold
|
||||
for line in data.splitlines():
|
||||
line = line.strip().split('#',1)[0]
|
||||
if not line:
|
||||
@@ -129,7 +154,7 @@ class VersionSetDSL:
|
||||
def set(self, name, version, uversion):
|
||||
platforms = {}
|
||||
for (platformName, platform) in self.platforms.items():
|
||||
- if platform.versioned:
|
||||
+ if platform.versioned and platform.versions:
|
||||
platforms[platformName] = platform.versions[-1]
|
||||
version_set = {}
|
||||
version_set["name"] = name
|
||||
@@ -138,7 +163,7 @@ class VersionSetDSL:
|
||||
self.version_sets.append(version_set)
|
||||
# TODO add error checking for version decrease
|
||||
def version(self, platform, version):
|
||||
- if platform in self.platforms: self.platforms[platform].add_version(VersionSetDSL.Version(version))
|
||||
+ if platform in self.platforms: self.platforms[platform].add_version(VersionSetDSL.Version(version), self.threshold)
|
||||
else:
|
||||
print(f"Unknown platform \"{platform}\"")
|
||||
exit(-1)
|
||||
@@ -165,9 +190,8 @@ if not dslContent:
|
||||
parts = line.split()
|
||||
if uversion and parts and parts[0] == "set" and parts[3] == uversion:
|
||||
break
|
||||
-versions = VersionSetDSL(dslContent)
|
||||
|
||||
-def print_sets():
|
||||
+def print_sets(versions):
|
||||
print("---")
|
||||
for set in versions.sets():
|
||||
print(f'{set["name"]}:')
|
||||
@@ -178,7 +202,8 @@ def print_versions(platform):
|
||||
print(" ".join([version.string() for version in versions.platforms()[platform].versions]))
|
||||
|
||||
class Preprocessor:
|
||||
- def __init__(self, inputFile, outputFile):
|
||||
+ def __init__(self, versions, inputFile, outputFile):
|
||||
+ self.versions = versions
|
||||
bufferedOutput = ""
|
||||
with tempfile.NamedTemporaryFile('w') as tmp:
|
||||
with open(inputFile, 'r') as input:
|
||||
@@ -207,10 +232,10 @@ class Preprocessor:
|
||||
output.write("\"\"\"\n")
|
||||
def VERSION_MAP(self, output):
|
||||
sets = []
|
||||
- for set in versions.sets():
|
||||
+ for set in self.versions.sets():
|
||||
set_string = ", ".join(sorted({".{} = {}".format(os,osVersion.hex()) for (os,osVersion) in set["platforms"].items()}))
|
||||
sets.append("\t{{ .set = {}, {} }}".format(set["version"].hex(), set_string))
|
||||
- platform_string = "\n".join([" uint32_t {} = 0;".format(name) for name in versions.platforms().keys()])
|
||||
+ platform_string = "\n".join([" uint32_t {} = 0;".format(name) for name in self.versions.platforms().keys()])
|
||||
output.write("""
|
||||
#include <set>
|
||||
#include <array>
|
||||
@@ -229,16 +254,16 @@ static const std::array<VersionSetEntry, {}> sVersionMap = {{{{
|
||||
}};
|
||||
""".format(platform_string, len(sets), ",\n".join(sets)))
|
||||
def DYLD_HEADER_VERSIONS(self, output):
|
||||
- for (name,platform) in versions.platforms().items():
|
||||
+ for (name,platform) in self.versions.platforms().items():
|
||||
for version in platform.versions:
|
||||
output.write(f"#define {platform.dyld_version_define_name + version.symbol() : <48}{version.hex()}\n");
|
||||
output.write("\n")
|
||||
- for set in versions.sets():
|
||||
+ for set in self.versions.sets():
|
||||
set_string = " / ".join(sorted({"{} {}".format(os,osVersion.string()) for(os,osVersion) in set["platforms"].items()}))
|
||||
output.write("// dyld_{}_os_versions => {}\n".format(set["name"], set_string))
|
||||
output.write("#define dyld_{}_os_versions".format(set["name"]).ljust(56, ' '))
|
||||
output.write("({{ (dyld_build_version_t){{0xffffffff, {}}}; }})\n\n".format(set["version"].hex()))
|
||||
- for (name,platform) in versions.platforms().items():
|
||||
+ for (name,platform) in self.versions.platforms().items():
|
||||
for version in platform.versions:
|
||||
output.write("#define dyld_platform_version_{}_{}".format(platform.stylized_name, version.symbol()).ljust(56, ' '))
|
||||
output.write("({{ (dyld_build_version_t){{{}, {}{}}}; }})\n".format(platform.platform_define, platform.dyld_version_define_name, version.symbol()))
|
||||
@@ -247,14 +272,14 @@ static const std::array<VersionSetEntry, {}> sVersionMap = {{{{
|
||||
def ALIAS_VERSION_MACROS(self, output, platformString, newName, oldName, **optionals):
|
||||
minVersion = literal_eval(optionals.get("minVersion", "0x00000000"))
|
||||
maxVersion = literal_eval(optionals.get("maxVersion", "0xFFFFFFFF"))
|
||||
- platform = versions.platforms()[platformString];
|
||||
+ platform = self.versions.platforms()[platformString];
|
||||
for version in platform.versions:
|
||||
if literal_eval(version.hex()) < minVersion: continue
|
||||
if literal_eval(version.hex()) >= maxVersion: continue
|
||||
output.write(f'#define {newName + version.symbol() : <48} {oldName + version.symbol()}\n')
|
||||
def AVAILABILITY_DEFINES(self, output):
|
||||
- for platformString in versions.platforms():
|
||||
- platform = versions.platforms()[platformString];
|
||||
+ for platformString in self.versions.platforms():
|
||||
+ platform = self.versions.platforms()[platformString];
|
||||
if platform.bleached:
|
||||
output.write(f"#ifndef __APPLE_BLEACH_SDK__\n")
|
||||
output.write(f"#ifndef __API_TO_BE_DEPRECATED_{platform.availability_deprecation_define_name}\n")
|
||||
@@ -268,16 +293,16 @@ static const std::array<VersionSetEntry, {}> sVersionMap = {{{{
|
||||
output.write(f"#endif /* __APPLE_BLEACH_SDK__ */\n")
|
||||
output.write(f"\n");
|
||||
def AVAILABILITY_VERSION_DEFINES(self, output):
|
||||
- for platformString in versions.platforms():
|
||||
- short = platform = versions.platforms()[platformString].short_version_numbers
|
||||
- platform = versions.platforms()[platformString];
|
||||
+ for platformString in self.versions.platforms():
|
||||
+ short = platform = self.versions.platforms()[platformString].short_version_numbers
|
||||
+ platform = self.versions.platforms()[platformString];
|
||||
for version in platform.versions:
|
||||
output.write(f"#define {platform.availability_define_prefix + version.symbol() : <48}{version.decimal(short)}\n")
|
||||
output.write(f"/* {platform.availability_define_prefix}_NA is not defined to a value but is used as a token by macros to indicate that the API is unavailable */\n\n")
|
||||
def AVAILABILITY_MIN_MAX_DEFINES(self, output):
|
||||
- for platformString in versions.platforms():
|
||||
- platform = versions.platforms()[platformString];
|
||||
- if not platform.versioned:
|
||||
+ for platformString in self.versions.platforms():
|
||||
+ platform = self.versions.platforms()[platformString];
|
||||
+ if not platform.versioned or not platform.versions:
|
||||
continue
|
||||
if platform.bleached:
|
||||
output.write(f"#ifndef __APPLE_BLEACH_SDK__\n")
|
||||
@@ -310,8 +335,8 @@ static const std::array<VersionSetEntry, {}> sVersionMap = {{{{
|
||||
output.write(f" #define __API_UNAVAILABLE_PLATFORM_{displayName} {realName},unavailable\n")
|
||||
output.write(f"#if defined(__has_feature) && defined(__has_attribute)\n")
|
||||
output.write(f" #if __has_attribute(availability)\n")
|
||||
- for platformString in versions.platforms():
|
||||
- platform = versions.platforms()[platformString];
|
||||
+ for platformString in self.versions.platforms():
|
||||
+ platform = self.versions.platforms()[platformString];
|
||||
if platform.bleached:
|
||||
output.write(f"#ifndef __APPLE_BLEACH_SDK__\n")
|
||||
writeDefines(platformString, platformString, platform.versioned)
|
||||
@@ -326,9 +351,9 @@ static const std::array<VersionSetEntry, {}> sVersionMap = {{{{
|
||||
output.write(f" #endif /* __has_attribute(availability) */\n")
|
||||
output.write(f"#endif /* defined(__has_feature) && defined(__has_attribute) */\n")
|
||||
def AVAILABILITY_MACRO_IMPL(self, output, prefix, dispatcher, **optionals):
|
||||
- count = len(versions.platforms())
|
||||
- for platformString in versions.platforms():
|
||||
- platform = versions.platforms()[platformString]
|
||||
+ count = len(self.versions.platforms())
|
||||
+ for platformString in self.versions.platforms():
|
||||
+ platform = self.versions.platforms()[platformString]
|
||||
count = count + len(platform.variants)
|
||||
platformList = []
|
||||
argList = []
|
||||
@@ -344,9 +369,9 @@ static const std::array<VersionSetEntry, {}> sVersionMap = {{{{
|
||||
scoped_availablity = False
|
||||
if "scoped_availablity" in optionals and optionals["scoped_availablity"] == "TRUE":
|
||||
scoped_availablity=True
|
||||
- count = len(versions.platforms())
|
||||
- for platformString in versions.platforms():
|
||||
- platform = versions.platforms()[platformString]
|
||||
+ count = len(self.versions.platforms())
|
||||
+ for platformString in self.versions.platforms():
|
||||
+ platform = self.versions.platforms()[platformString]
|
||||
count = count + len(platform.variants)
|
||||
argList = ','.join([f'{macroName}{x}' for x in reversed(range(0, count))])
|
||||
if "argCount" in optionals:
|
||||
@@ -358,8 +383,9 @@ static const std::array<VersionSetEntry, {}> sVersionMap = {{{{
|
||||
output.write(f" #define {name}(...) {macroName}_GET_MACRO(__VA_ARGS__,{argList},0)(__VA_ARGS__)\n")
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
+parser.add_argument("--threshold", default=False, help='Specifies the maximum version (inclusive) included in pre-processed headers')
|
||||
group = parser.add_mutually_exclusive_group()
|
||||
-for (name, platform) in versions.platforms().items():
|
||||
+for (name, platform) in VersionSetDSL(dslContent, threshold=None).platforms().items():
|
||||
group.add_argument("--{}".format(name), default=False, action='store_true', help="Prints all SDK versions defined for {}".format(name))
|
||||
for alias in platform.cmd_aliases:
|
||||
group.add_argument("--{}".format(alias), dest=name, default=False, action='store_true', help="Alias for --{}".format(name))
|
||||
@@ -367,8 +393,10 @@ group.add_argument("--sets", default=False, actio
|
||||
group.add_argument("--preprocess", nargs=2, help=argparse.SUPPRESS)
|
||||
args = parser.parse_args()
|
||||
|
||||
-if args.sets: print_sets();
|
||||
-elif args.preprocess: Preprocessor(args.preprocess[0], args.preprocess[1]);
|
||||
+versions = VersionSetDSL(dslContent, threshold=args.threshold)
|
||||
+
|
||||
+if args.sets: print_sets(versions);
|
||||
+elif args.preprocess: Preprocessor(versions, args.preprocess[0], args.preprocess[1]);
|
||||
else:
|
||||
for platform in versions.platforms().keys():
|
||||
if getattr(args, platform, None):
|
||||
--
|
||||
2.45.2
|
||||
|
@ -0,0 +1,99 @@
|
||||
{
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
appleDerivation',
|
||||
gnused,
|
||||
python3,
|
||||
unifdef,
|
||||
}:
|
||||
|
||||
appleDerivation' stdenvNoCC {
|
||||
nativeBuildInputs = [ unifdef ];
|
||||
|
||||
patches = [ ./0001-Support-setting-an-upper-bound-on-versions.patch ];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
declare -a unifdef_sources=(
|
||||
os_availability.modulemap
|
||||
os_availability_private.modulemap
|
||||
AvailabilityPrivate.modulemap
|
||||
)
|
||||
unifdef -x2 -UBUILD_FOR_DRIVERKIT -m $(for x in "''${unifdef_sources[@]}"; do echo templates/$x; done)
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p "$out/bin" "$out/libexec" "$out/share/availability"
|
||||
|
||||
cp -r availability.dsl templates "$out/share/availability/"
|
||||
|
||||
substitute availability "$out/libexec/availability" \
|
||||
--replace-fail '/usr/bin/env python3' '${lib.getBin python3}/bin/python3' \
|
||||
--replace-fail 'f"{os.path.abspath(os.path.dirname(sys.argv[0]))}/' "\"$out/share/availability/"
|
||||
chmod a+x "$out/libexec/availability"
|
||||
|
||||
cat <<SCRIPT > "$out/bin/gen-headers"
|
||||
#!/usr/bin/env bash
|
||||
set -eu
|
||||
|
||||
declare -a headers=(
|
||||
Availability.h
|
||||
AvailabilityInternal.h
|
||||
AvailabilityInternalLegacy.h
|
||||
AvailabilityMacros.h
|
||||
AvailabilityVersions.h
|
||||
os/availability.h
|
||||
)
|
||||
|
||||
dest=\$2
|
||||
threshold=\$1
|
||||
|
||||
for header in "\''${headers[@]}"; do
|
||||
header_src=\''${header/\//_}
|
||||
mkdir -p "\$(dirname "\$dest/include/\$header")"
|
||||
"$out/libexec/availability" \\
|
||||
--threshold "\$threshold" \\
|
||||
--preprocess "$out/share/availability/templates/\$header_src" "\$dest/include/\$header"
|
||||
done
|
||||
|
||||
# `__ENVIRONMENT_OS_VERSION_MIN_REQUIRED__` is only defined by clang 17+, so define it for older versions.
|
||||
${lib.getExe gnused} -E '/#ifndef __MAC_OS_X_VERSION_MIN_REQUIRED/{
|
||||
i#ifndef __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__
|
||||
i#define __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
|
||||
i#endif
|
||||
}' \\
|
||||
-i "\$dest/include/AvailabilityInternal.h"
|
||||
|
||||
# Remove macros from newer SDKs because they can confuse some programs about the SDK version.
|
||||
declare -a versionParts=(\''${threshold//./ })
|
||||
if [ "\''${versionParts[0]}" == "10" ]; then
|
||||
sdkMajor=\''${versionParts[1]}
|
||||
sdkMinor=\''${versionParts[2]:-0}
|
||||
for minor in \$(seq \$(("\$sdkMinor" + 1)) 9); do
|
||||
${lib.getExe gnused} \\
|
||||
-E "/VERSION_10_\''${sdkMajor}_\$minor/,/#endif/c\\ */" \\
|
||||
-i "\$dest/include/AvailabilityMacros.h"
|
||||
done
|
||||
for major in \$(seq \$(("\$sdkMajor" + 1)) 15); do
|
||||
${lib.getExe gnused} \\
|
||||
-E "/VERSION_10_\$major/,/#endif/c\\ */" \\
|
||||
-i "\$dest/include/AvailabilityMacros.h"
|
||||
done
|
||||
fi
|
||||
|
||||
cp "$out/share/availability/templates/os_availability.modulemap" "\$dest/include/"
|
||||
SCRIPT
|
||||
chmod a+x "$out/bin/gen-headers"
|
||||
|
||||
patchShebangs "$out/bin"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta.mainProgram = "gen-headers";
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
{ lib, stdenv, buildPackages, fetchzip, fetchFromGitHub
|
||||
, appleDerivation', xnu, Libc, Libm, libdispatch, Libinfo
|
||||
, appleDerivation', AvailabilityVersions, sdkRoot, xnu, Libc, Libm, libdispatch, Libinfo
|
||||
, dyld, Csu, architecture, libclosure, CarbonHeaders, ncurses, CommonCrypto
|
||||
, copyfile, removefile, libresolvHeaders, libresolv, Libnotify, libmalloc, libplatform, libpthread
|
||||
, mDNSResponder, launchd, libutilHeaders, hfsHeaders, darwin-stubs
|
||||
@ -48,9 +48,11 @@ appleDerivation' stdenv {
|
||||
|
||||
# Set up our include directories
|
||||
(cd ${xnu}/include && find . -name '*.h' -or -name '*.defs' | copyHierarchy $out/include)
|
||||
cp ${xnu}/Library/Frameworks/Kernel.framework/Versions/A/Headers/Availability*.h $out/include
|
||||
cp ${xnu}/Library/Frameworks/Kernel.framework/Versions/A/Headers/stdarg.h $out/include
|
||||
|
||||
# These headers are from a newer SDK, but they’re more compatible with GCC (and still work with older SDKs).
|
||||
${lib.getExe AvailabilityVersions} ${lib.getVersion sdkRoot} "$out"
|
||||
|
||||
for dep in ${Libc} ${Libm} ${Libinfo} ${dyld} ${architecture} \
|
||||
${libclosure} ${CarbonHeaders} ${libdispatch} ${ncurses.dev} \
|
||||
${CommonCrypto} ${copyfile} ${removefile} ${libresolvHeaders} \
|
||||
@ -74,27 +76,6 @@ appleDerivation' stdenv {
|
||||
cp ${darling.src}/src/libc/os/log.h $out/include/os
|
||||
cp ${darling.src}/src/duct/include/os/trace.h $out/include/os
|
||||
|
||||
cat <<EOF > $out/include/os/availability.h
|
||||
#ifndef __OS_AVAILABILITY__
|
||||
#define __OS_AVAILABILITY__
|
||||
#include <AvailabilityInternal.h>
|
||||
|
||||
#if defined(__has_feature) && defined(__has_attribute) && __has_attribute(availability)
|
||||
#define API_AVAILABLE(...) __API_AVAILABLE_GET_MACRO(__VA_ARGS__, __API_AVAILABLE4, __API_AVAILABLE3, __API_AVAILABLE2, __API_AVAILABLE1)(__VA_ARGS__)
|
||||
#define API_DEPRECATED(...) __API_DEPRECATED_MSG_GET_MACRO(__VA_ARGS__, __API_DEPRECATED_MSG5, __API_DEPRECATED_MSG4, __API_DEPRECATED_MSG3, __API_DEPRECATED_MSG2, __API_DEPRECATED_MSG1)(__VA_ARGS__)
|
||||
#define API_DEPRECATED_WITH_REPLACEMENT(...) __API_DEPRECATED_REP_GET_MACRO(__VA_ARGS__, __API_DEPRECATED_REP5, __API_DEPRECATED_REP4, __API_DEPRECATED_REP3, __API_DEPRECATED_REP2, __API_DEPRECATED_REP1)(__VA_ARGS__)
|
||||
#define API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__, __API_UNAVAILABLE3, __API_UNAVAILABLE2, __API_UNAVAILABLE1)(__VA_ARGS__)
|
||||
#else
|
||||
|
||||
#define API_AVAILABLE(...)
|
||||
#define API_DEPRECATED(...)
|
||||
#define API_DEPRECATED_WITH_REPLACEMENT(...)
|
||||
#define API_UNAVAILABLE(...)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
EOF
|
||||
|
||||
cat <<EOF > $out/include/TargetConditionals.h
|
||||
#ifndef __TARGETCONDITIONALS__
|
||||
#define __TARGETCONDITIONALS__
|
||||
|
@ -1,7 +1,9 @@
|
||||
AssertMacros.h
|
||||
Availability.h
|
||||
AvailabilityInternal.h
|
||||
AvailabilityInternalLegacy.h
|
||||
AvailabilityMacros.h
|
||||
AvailabilityVersions.h
|
||||
Block.h
|
||||
Block_private.h
|
||||
CommonCrypto/CommonBaseXX.h
|
||||
@ -1050,8 +1052,7 @@ os/overflow.h
|
||||
os/semaphore_private.h
|
||||
os/trace.h
|
||||
os/tsd.h
|
||||
os/voucher_activity_private.h
|
||||
os/voucher_private.h
|
||||
os_availability.modulemap
|
||||
osfmk/UserNotification/KUNCUserNotifications.h
|
||||
osfmk/UserNotification/UNDReply.defs
|
||||
osfmk/UserNotification/UNDRequest.defs
|
||||
|
@ -1,13 +1,29 @@
|
||||
{ lib, stdenv, runCommand, appleDerivation', launchd, bootstrap_cmds, swift-corelibs-foundation, xnu, xpc, ppp, IOKit, eap8021x, Security
|
||||
{ lib, stdenv, stdenvNoCC, appleDerivation', launchd, bootstrap_cmds, swift-corelibs-foundation, xnu, xpc, ppp, IOKit, eap8021x, Security
|
||||
, headersOnly ? false }:
|
||||
|
||||
let
|
||||
privateHeaders = runCommand "swift-corelibs-foundation-private" { } ''
|
||||
mkdir -p $out/include/CoreFoundation
|
||||
# Copy the headers out of CF instead of building it to avoid an infinite recursion.
|
||||
privateHeaders = stdenvNoCC.mkDerivation {
|
||||
pname = "swift-corelibs-foundation-private";
|
||||
inherit (swift-corelibs-foundation) version src;
|
||||
|
||||
cp ${swift-corelibs-foundation}/Library/Frameworks/CoreFoundation.framework/PrivateHeaders/* \
|
||||
$out/include/CoreFoundation
|
||||
'';
|
||||
buildCommand = ''
|
||||
unpackFile "$src"
|
||||
|
||||
mkdir -p "$out/include/CoreFoundation"
|
||||
|
||||
declare -a privateHeaders=(
|
||||
Base.subproj/CFRuntime.h
|
||||
PlugIn.subproj/CFBundlePriv.h
|
||||
RunLoop.subproj/CFRunLoop.h
|
||||
String.subproj/CFStringDefaultEncoding.h
|
||||
)
|
||||
|
||||
for header in "''${privateHeaders[@]}"; do
|
||||
cp source/CoreFoundation/$header $out/include/CoreFoundation
|
||||
done
|
||||
'';
|
||||
};
|
||||
in
|
||||
appleDerivation' stdenv {
|
||||
meta.broken = stdenv.cc.nativeLibc;
|
||||
|
@ -10,6 +10,9 @@ let
|
||||
# a stdenv out of something like this. With some care we can probably get rid of this, but for
|
||||
# now it's staying here.
|
||||
versions = {
|
||||
"macos-14.4" = {
|
||||
AvailabilityVersions = "140.1";
|
||||
};
|
||||
"macos-14.3" = {
|
||||
system_cmds = "970.0.4";
|
||||
};
|
||||
@ -36,6 +39,9 @@ let
|
||||
libpthread = "218.60.3";
|
||||
hfs = "366.70.1";
|
||||
};
|
||||
"osx-10.12.4" = {
|
||||
libdispatch = "703.50.37";
|
||||
};
|
||||
"osx-10.11.6" = {
|
||||
PowerManagement = "572.50.1";
|
||||
dtrace = "168";
|
||||
@ -248,6 +254,7 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // {
|
||||
|
||||
inherit (adv_cmds-boot) ps locale;
|
||||
architecture = applePackage "architecture" "osx-10.11.6" "sha256-cUKeMx6mOAxBSRHIdfzsrR65Qv86m7+20XvpKqVfwVI=" {};
|
||||
AvailabilityVersions = applePackage "AvailabilityVersions" "macos-14.4" "sha256-O9/EOsbK5ZXxh6iDSTwGWWrY5GX/viUwdfG3tdvZwcQ=" {};
|
||||
bsdmake = applePackage "bsdmake" "dev-tools-3.2.6" "sha256-CW8zP5QZMhWTGp+rhrm8oHE/vSLsRlv1VRAGe1OUDmI=" {};
|
||||
CarbonHeaders = applePackage "CarbonHeaders" "osx-10.6.2" "sha256-UNaHvxzYzEBnYYuoMLqWUVprZa6Wqn/3XleoSCco050=" {};
|
||||
CommonCrypto = applePackage "CommonCrypto" "osx-10.12.6" "sha256-FLgODBrfv+XsGaAjddncYAm/BIJJYw6LcwX/z7ncKFM=" {};
|
||||
@ -271,7 +278,7 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // {
|
||||
};
|
||||
};
|
||||
libclosure = applePackage "libclosure" "osx-10.11.6" "sha256-L5rQ+UBpf3B+W1U+gZKk7fXulslHsc8lxnCsplV+nr0=" {};
|
||||
libdispatch = applePackage "libdispatch" "osx-10.10.5" "sha256-jfAEk0OLrJa9AIZVikIoHomd+l+4rCfc320Xh50qK5M=" {};
|
||||
libdispatch = applePackage "libdispatch" "osx-10.12.4" "sha256-xUqoG5JK4P3nXeoVUOBzodVK9fjH/I3xJ6WRtM39bdw=" {};
|
||||
Libinfo = applePackage "Libinfo" "osx-10.11.6" "sha256-6F7wiwerv4nz/xXHtp1qCHSaFzZgzcRN+jbmXA5oWOQ=" {};
|
||||
Libm = applePackage "Libm" "osx-10.7.4" "sha256-KjMETfT4qJm0m0Ux/F6Rq8bI4Q4UVnFx6IKbKxXd+Es=" {};
|
||||
Libnotify = applePackage "Libnotify" "osx-10.12.6" "sha256-6wvMBxAUfiYcQtmlfYCj1d3kFmFM/jdboTd7hRvi3e4=" {};
|
||||
@ -283,7 +290,7 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // {
|
||||
else macosPackages_11_0_1.libplatform;
|
||||
libpthread = applePackage "libpthread" "osx-10.12.6" "sha256-QvJ9PERmrCWBiDmOWrLvQUKZ4JxHuh8gS5nlZKDLqE8=" {};
|
||||
libresolv = applePackage "libresolv" "osx-10.12.6" "sha256-FtvwjJKSFX6j9APYPC8WLXVOjbHLZa1Gcoc8yxLy8qE=" {};
|
||||
Libsystem = applePackage "Libsystem" "osx-10.12.6" "sha256-zvRdCP//TjKCGAqm/5nJXPppshU1cv2fg/L/yK/olGQ=" {};
|
||||
Libsystem = applePackage "Libsystem" "osx-10.12.6" "sha256-zvRdCP//TjKCGAqm/5nJXPppshU1cv2fg/L/yK/olGQ=" { inherit (pkgs.darwin.apple_sdk) sdkRoot; };
|
||||
libutil = applePackage "libutil" "osx-10.12.6" "sha256-4PFuk+CTLwvd/Ll9GLBkiIM0Sh/CVaiKwh5m1noheRs=" {};
|
||||
libunwind = applePackage "libunwind" "osx-10.12.6" "sha256-CC0sndP/mKYe3dZu3v7fjuDASV4V4w7dAcnWMvpoquE=" {};
|
||||
mDNSResponder = applePackage "mDNSResponder" "osx-10.12.6" "sha256-ddZr6tropkpdMJhq/kUlm3OwO8b0yxtkrMpwec8R4FY=" {};
|
||||
|
@ -1,13 +1,12 @@
|
||||
{ appleDerivation', stdenvNoCC }:
|
||||
{ lib, appleDerivation', stdenvNoCC }:
|
||||
|
||||
appleDerivation' stdenvNoCC {
|
||||
appleDerivation' stdenvNoCC (finalAttrs: {
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
installPhase = ''
|
||||
mkdir -p $out/include/dispatch $out/include/os
|
||||
|
||||
# Move these headers so CF can find <os/voucher_private.h>
|
||||
mv private/voucher*.h $out/include/os
|
||||
cp -r private/*.h $out/include/dispatch
|
||||
|
||||
cp -r dispatch/*.h $out/include/dispatch
|
||||
@ -15,7 +14,7 @@ appleDerivation' stdenvNoCC {
|
||||
|
||||
# gcc compatibility. Source: https://stackoverflow.com/a/28014302/3714556
|
||||
substituteInPlace $out/include/dispatch/object.h \
|
||||
--replace 'typedef void (^dispatch_block_t)(void);' \
|
||||
--replace-fail 'typedef void (^dispatch_block_t)(void);' \
|
||||
'#ifdef __clang__
|
||||
typedef void (^dispatch_block_t)(void);
|
||||
#else
|
||||
@ -46,9 +45,14 @@ appleDerivation' stdenvNoCC {
|
||||
dispatch/source.h
|
||||
dispatch/source_private.h
|
||||
dispatch/time.h
|
||||
''
|
||||
+ lib.optionalString (lib.versionAtLeast "1271.40.12" finalAttrs.version) ''
|
||||
dispatch/time_private.h
|
||||
dispatch/workloop.h
|
||||
dispatch/workloop_private.h
|
||||
''
|
||||
+ ''
|
||||
os/object.h
|
||||
os/object_private.h
|
||||
os/voucher_activity_private.h
|
||||
os/voucher_private.h
|
||||
'';
|
||||
}
|
||||
})
|
||||
|
@ -3,6 +3,7 @@
|
||||
stdenvNoCC,
|
||||
cctools,
|
||||
clang-unwrapped,
|
||||
ld64,
|
||||
llvm,
|
||||
llvm-manpages,
|
||||
makeWrapper,
|
||||
@ -17,6 +18,7 @@ let
|
||||
"addr2line"
|
||||
"ar"
|
||||
"c++filt"
|
||||
"dwarfdump"
|
||||
"dsymutil"
|
||||
"nm"
|
||||
"objcopy"
|
||||
@ -90,7 +92,7 @@ stdenvNoCC.mkDerivation {
|
||||
${linkManPages (lib.getMan cctools) "$tool" "$tool"}
|
||||
done
|
||||
${
|
||||
# These unprefixed because some tools expect to invoke them without it when cross-compiling to Darwin:
|
||||
# These are unprefixed because some tools expect to invoke them without it when cross-compiling to Darwin:
|
||||
# - clang needs `dsymutil` when building with debug information;
|
||||
# - meson needs `lipo` when cross-compiling to Darwin; and
|
||||
# - meson also needs `install_name_tool` and `otool` when performing rpath cleanup on installation.
|
||||
@ -104,10 +106,10 @@ stdenvNoCC.mkDerivation {
|
||||
makeWrapper "${lib.getBin clang-unwrapped}/bin/clang" "$out/bin/${targetPrefix}as" \
|
||||
--add-flags "-x assembler -integrated-as -c"
|
||||
|
||||
ln -s '${lib.getBin cctools}/bin/${targetPrefix}ld' "$out/bin/${targetPrefix}ld"
|
||||
${linkManPages (lib.getMan cctools) "ld" "ld"}
|
||||
# ${linkManPages (lib.getMan cctools) "ld-classic" "ld-classic"}
|
||||
${linkManPages (lib.getMan cctools) "ld64" "ld64"}
|
||||
ln -s '${lib.getBin ld64}/bin/${targetPrefix}ld' "$out/bin/${targetPrefix}ld"
|
||||
${linkManPages (lib.getMan ld64) "ld" "ld"}
|
||||
${linkManPages (lib.getMan ld64) "ld-classic" "ld-classic"}
|
||||
${linkManPages (lib.getMan ld64) "ld64" "ld64"}
|
||||
'';
|
||||
|
||||
__structuredAttrs = true;
|
||||
|
@ -1,122 +0,0 @@
|
||||
{ lib, stdenv, fetchFromGitHub, symlinkJoin, xcbuildHook, tcsh, libobjc, libtapi, libunwind, llvm, memstreamHook, xar }:
|
||||
|
||||
let
|
||||
|
||||
cctools = stdenv.mkDerivation rec {
|
||||
pname = "cctools";
|
||||
version = "973.0.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "apple-oss-distributions";
|
||||
repo = "cctools";
|
||||
rev = "${pname}-${version}";
|
||||
hash = "sha256-0NlDqy3zeg4D0MbDipx0sMYDfzYa63Jxfsckzz/928o=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./cctools-add-missing-vtool-libstuff-dep.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
for file in libstuff/writeout.c misc/libtool.c misc/lipo.c; do
|
||||
substituteInPlace "$file" \
|
||||
--replace '__builtin_available(macOS 10.12, *)' '0'
|
||||
done
|
||||
substituteInPlace libmacho/swap.c \
|
||||
--replace '#ifndef RLD' '#if 1'
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ xcbuildHook memstreamHook ];
|
||||
buildInputs = [ libobjc llvm ];
|
||||
|
||||
xcbuildFlags = [
|
||||
"MACOSX_DEPLOYMENT_TARGET=10.12"
|
||||
];
|
||||
|
||||
doCheck = true;
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
|
||||
Products/Release/libstuff_test
|
||||
rm Products/Release/libstuff_test
|
||||
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
rm -rf "$out/usr"
|
||||
mkdir -p "$out/bin"
|
||||
find Products/Release -maxdepth 1 -type f -perm 755 -exec cp {} "$out/bin/" \;
|
||||
cp -r include "$out/"
|
||||
|
||||
ln -s ./nm-classic "$out"/bin/nm
|
||||
ln -s ./otool-classic "$out"/bin/otool
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
|
||||
ld64 = stdenv.mkDerivation rec {
|
||||
pname = "ld64";
|
||||
version = "609";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "apple-oss-distributions";
|
||||
repo = "ld64";
|
||||
rev = "${pname}-${version}";
|
||||
hash = "sha256-WAaphem6NS4eCHL/pISlDXnO1CDYTgSrVGzcothh4/Q=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace ld64.xcodeproj/project.pbxproj \
|
||||
--replace "/bin/csh" "${tcsh}/bin/tcsh" \
|
||||
--replace 'F9E8D4BE07FCAF2A00FD5801 /* PBXBuildRule */,' "" \
|
||||
--replace 'F9E8D4BD07FCAF2000FD5801 /* PBXBuildRule */,' ""
|
||||
|
||||
sed -i src/ld/Options.cpp -e '1iconst char ldVersionString[] = "${version}";'
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ xcbuildHook ];
|
||||
buildInputs = [
|
||||
libtapi
|
||||
libunwind
|
||||
llvm
|
||||
xar
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p "$out/bin"
|
||||
find Products/Release-assert -maxdepth 1 -type f -perm 755 -exec cp {} "$out/bin/" \;
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
symlinkJoin rec {
|
||||
name = "cctools-${version}";
|
||||
version = "${cctools.version}-${ld64.version}";
|
||||
|
||||
paths = [
|
||||
cctools
|
||||
ld64
|
||||
];
|
||||
|
||||
# workaround for the fetch-tarballs script
|
||||
passthru = {
|
||||
inherit (cctools) src;
|
||||
ld64_src = ld64.src;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "MacOS Compiler Tools";
|
||||
homepage = "http://www.opensource.apple.com/source/cctools/";
|
||||
license = licenses.apple-psl20;
|
||||
platforms = platforms.darwin;
|
||||
};
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
diff -ru a/cctools.xcodeproj/project.pbxproj b/cctools.xcodeproj/project.pbxproj
|
||||
--- a/cctools.xcodeproj/project.pbxproj 2021-02-24 20:30:55.000000000 -0500
|
||||
+++ b/cctools.xcodeproj/project.pbxproj 2022-01-31 20:01:09.000000000 -0500
|
||||
@@ -2558,6 +2558,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
+ DE97E92421F3B86100C7947D /* libstuff.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
@ -1,17 +0,0 @@
|
||||
--- a/cctools/include/stuff/diagnostics.h
|
||||
+++ b/cctools/include/stuff/diagnostics.h
|
||||
@@ -60,13 +60,6 @@ void diagnostics_log_msg(enum diagnostic_level level, const char* message);
|
||||
*/
|
||||
void diagnostics_write(void);
|
||||
|
||||
-#if defined(__APPLE__ ) && defined(__has_builtin)
|
||||
-# if __has_builtin(__builtin_available)
|
||||
-# define HAVE_OPENMEMSTREAM_RUNTIME __builtin_available(macOS 10.13, *)
|
||||
-# endif
|
||||
-#endif
|
||||
-#ifndef HAVE_OPENMEMSTREAM_RUNTIME
|
||||
-# define HAVE_OPENMEMSTREAM_RUNTIME 1
|
||||
-#endif
|
||||
+#define HAVE_OPENMEMSTREAM_RUNTIME 1
|
||||
|
||||
#endif /* diagnostics_h */
|
@ -1,16 +0,0 @@
|
||||
diff --git a/cctools/ld64/src/ld/Options.cpp b/cctools/ld64/src/ld/Options.cpp
|
||||
index 2565518..9250016 100644
|
||||
--- a/cctools/ld64/src/ld/Options.cpp
|
||||
+++ b/cctools/ld64/src/ld/Options.cpp
|
||||
@@ -2522,6 +2522,11 @@ void Options::parse(int argc, const char* argv[])
|
||||
throw "missing argument to -rpath";
|
||||
fRPaths.push_back(path);
|
||||
}
|
||||
+ else if ( strcmp(arg, "-rpath-link") == 0 ) {
|
||||
+ const char* path = argv[++i];
|
||||
+ if ( path == NULL )
|
||||
+ throw "missing argument to -rpath-link";
|
||||
+ }
|
||||
else if ( strcmp(arg, "-read_only_stubs") == 0 ) {
|
||||
fReadOnlyx86Stubs = true;
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
diff --git a/cctools/ld64/src/ld/Options.cpp b/cctools/ld64/src/ld/Options.cpp
|
||||
index e4b37ec..4189ebc 100644
|
||||
--- a/cctools/ld64/src/ld/Options.cpp
|
||||
+++ b/cctools/ld64/src/ld/Options.cpp
|
||||
@@ -5800,24 +5800,6 @@ void Options::checkIllegalOptionCombinations()
|
||||
if ( fDeadStrip && (fOutputKind == Options::kObjectFile) )
|
||||
throw "-r and -dead_strip cannot be used together";
|
||||
|
||||
- // can't use -rpath unless targeting 10.5 or later
|
||||
- if ( fRPaths.size() > 0 ) {
|
||||
- if ( !platforms().minOS(ld::version2008) )
|
||||
- throw "-rpath can only be used when targeting Mac OS X 10.5 or later";
|
||||
- switch ( fOutputKind ) {
|
||||
- case Options::kDynamicExecutable:
|
||||
- case Options::kDynamicLibrary:
|
||||
- case Options::kDynamicBundle:
|
||||
- break;
|
||||
- case Options::kStaticExecutable:
|
||||
- case Options::kObjectFile:
|
||||
- case Options::kDyld:
|
||||
- case Options::kPreload:
|
||||
- case Options::kKextBundle:
|
||||
- throw "-rpath can only be used when creating a dynamic final linked image";
|
||||
- }
|
||||
- }
|
||||
-
|
||||
if ( fPositionIndependentExecutable ) {
|
||||
switch ( fOutputKind ) {
|
||||
case Options::kDynamicExecutable:
|
@ -1,113 +0,0 @@
|
||||
# Create a cctools-compatible bintools that uses equivalent tools from LLVM in place of the ones
|
||||
# from cctools when possible.
|
||||
|
||||
{ lib, stdenv, makeWrapper, cctools-port, llvmPackages, enableManpages ? stdenv.targetPlatform == stdenv.hostPlatform }:
|
||||
|
||||
let
|
||||
inherit (stdenv) targetPlatform hostPlatform;
|
||||
|
||||
cctoolsVersion = lib.getVersion cctools-port;
|
||||
llvmVersion = llvmPackages.release_version;
|
||||
|
||||
# `bitcode_strip` is not available until LLVM 12.
|
||||
useLLVMBitcodeStrip = lib.versionAtLeast llvmVersion "12";
|
||||
|
||||
# A compatible implementation of `otool` was not added until LLVM 13.
|
||||
useLLVMOtool = lib.versionAtLeast llvmVersion "13";
|
||||
|
||||
# Older versions of `strip` cause problems for the version of `codesign_allocate` available in
|
||||
# the version of cctools in nixpkgs. The version of `codesign_allocate` in cctools-1005.2 does
|
||||
# not appear to have issues, but the source is not available yet (as of June 2023).
|
||||
useLLVMStrip = lib.versionAtLeast llvmVersion "15" || lib.versionAtLeast cctoolsVersion "1005.2";
|
||||
|
||||
# Clang 11 performs an optimization on x86_64 that is sensitive to the presence of debug info.
|
||||
# This causes GCC to fail to bootstrap due to object file differences between stages 2 and 3.
|
||||
useClangAssembler = lib.versionAtLeast llvmVersion "12" || !stdenv.isx86_64;
|
||||
|
||||
llvm_bins = [
|
||||
"dwarfdump"
|
||||
"nm"
|
||||
"objdump"
|
||||
"size"
|
||||
"strings"
|
||||
]
|
||||
++ lib.optional useLLVMBitcodeStrip "bitcode-strip"
|
||||
++ lib.optional useLLVMOtool "otool"
|
||||
++ lib.optional useLLVMStrip "strip";
|
||||
|
||||
# Only include the tools that LLVM doesn’t provide and that are present normally on Darwin.
|
||||
# The only exceptions are the following tools, which should be reevaluated when LLVM is bumped.
|
||||
# - install_name_tool (llvm-objcopy): unrecognized linker commands when building open source CF;
|
||||
# - libtool (llvm-libtool-darwin): not fully compatible when used with xcbuild; and
|
||||
# - lipo (llvm-lipo): crashes when running the LLVM test suite.
|
||||
cctools_bins = [
|
||||
"cmpdylib"
|
||||
"codesign_allocate"
|
||||
"ctf_insert"
|
||||
"install_name_tool"
|
||||
"ld"
|
||||
"libtool"
|
||||
"lipo"
|
||||
"nmedit"
|
||||
"pagestuff"
|
||||
"ranlib"
|
||||
"segedit"
|
||||
"vtool"
|
||||
]
|
||||
++ lib.optional (!useLLVMBitcodeStrip) "bitcode_strip"
|
||||
++ lib.optional (!useLLVMOtool) "otool"
|
||||
++ lib.optional (!useLLVMStrip) "strip"
|
||||
++ lib.optional (!useClangAssembler) "as";
|
||||
|
||||
targetPrefix = lib.optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-";
|
||||
|
||||
linkManPages = pkg: source: target: lib.optionalString enableManpages ''
|
||||
sourcePath=${pkg}/share/man/man1/${source}.1.gz
|
||||
targetPath=$man/share/man/man1/${target}.1.gz
|
||||
|
||||
if [ -f "$sourcePath" ]; then
|
||||
mkdir -p "$(dirname "$targetPath")"
|
||||
ln -s "$sourcePath" "$targetPath"
|
||||
fi
|
||||
'';
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "cctools-llvm";
|
||||
version = "${llvmVersion}-${cctoolsVersion}";
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
# The `man` output has to be included unconditionally because darwin.binutils expects it.
|
||||
outputs = [ "out" "dev" "man" ];
|
||||
|
||||
buildCommand = ''
|
||||
mkdir -p "$out/bin" "$man"
|
||||
ln -s ${lib.getDev cctools-port} "$dev"
|
||||
|
||||
'' + lib.optionalString useClangAssembler ''
|
||||
# Use the clang-integrated assembler instead of using `as` from cctools.
|
||||
makeWrapper "${lib.getBin llvmPackages.clang-unwrapped}/bin/clang" "$out/bin/${targetPrefix}as" \
|
||||
--add-flags "-x assembler -integrated-as -c"
|
||||
|
||||
'' + ''
|
||||
ln -s "${lib.getBin llvmPackages.bintools-unwrapped}/bin/${targetPrefix}llvm-ar" "$out/bin/${targetPrefix}ar"
|
||||
${linkManPages llvmPackages.llvm-manpages "llvm-ar" "ar"}
|
||||
|
||||
for tool in ${toString llvm_bins}; do
|
||||
cctoolsTool=''${tool/-/_}
|
||||
ln -s "${lib.getBin llvmPackages.llvm}/bin/llvm-$tool" "$out/bin/${targetPrefix}$cctoolsTool"
|
||||
${linkManPages llvmPackages.llvm-manpages "llvm-$tool" "$cctoolsTool"}
|
||||
done
|
||||
|
||||
for tool in ${toString cctools_bins}; do
|
||||
ln -s "${lib.getBin cctools-port}/bin/${targetPrefix}$tool" "$out/bin/${targetPrefix}$tool"
|
||||
${linkManPages (lib.getMan cctools-port) "$tool" "$tool"}
|
||||
done
|
||||
|
||||
${linkManPages (lib.getMan cctools-port) "ld64" "ld64"}
|
||||
${lib.optionalString (!useLLVMOtool) # The actual man page for otool in cctools is llvm-otool
|
||||
(linkManPages (lib.getMan cctools-port) "llvm-otool" "llvm-otool")}
|
||||
'';
|
||||
|
||||
passthru = { inherit targetPrefix; };
|
||||
}
|
@ -1,198 +0,0 @@
|
||||
{ lib, stdenv, fetchFromGitHub, autoconf, automake, libtool, autoreconfHook, memstreamHook
|
||||
, installShellFiles
|
||||
, libuuid
|
||||
, libobjc ? null, maloader ? null
|
||||
, enableTapiSupport ? true, libtapi
|
||||
, fetchpatch
|
||||
}:
|
||||
|
||||
let
|
||||
|
||||
# The targetPrefix prepended to binary names to allow multiple binuntils on the
|
||||
# PATH to both be usable.
|
||||
targetPrefix = lib.optionalString
|
||||
(stdenv.targetPlatform != stdenv.hostPlatform)
|
||||
"${stdenv.targetPlatform.config}-";
|
||||
in
|
||||
|
||||
# Non-Darwin alternatives
|
||||
assert (!stdenv.hostPlatform.isDarwin) -> maloader != null;
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "${targetPrefix}cctools-port";
|
||||
version = "973.0.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "tpoechtrager";
|
||||
repo = "cctools-port";
|
||||
# This is the commit before: https://github.com/tpoechtrager/cctools-port/pull/114
|
||||
# That specific change causes trouble for us (see the PR discussion), but
|
||||
# is also currently the last commit on master at the time of writing, so we
|
||||
# can just go back one step.
|
||||
rev = "457dc6ddf5244ebf94f28e924e3a971f1566bd66";
|
||||
sha256 = "0ns12q7vg9yand4dmdsps1917cavfbw67yl5q7bm6kb4ia5kkx13";
|
||||
};
|
||||
|
||||
outputs = [ "out" "dev" "gas" "man" ];
|
||||
|
||||
nativeBuildInputs = [ autoconf automake libtool autoreconfHook installShellFiles ]
|
||||
++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ memstreamHook ];
|
||||
buildInputs = [ libuuid ]
|
||||
++ lib.optionals stdenv.isDarwin [ libobjc ]
|
||||
++ lib.optional enableTapiSupport libtapi;
|
||||
|
||||
patches = [
|
||||
./ld-ignore-rpath-link.patch
|
||||
./ld-rpath-nonfinal.patch
|
||||
(fetchpatch {
|
||||
url = "https://github.com/tpoechtrager/cctools-port/commit/4a734070cd2838e49658464003de5b92271d8b9e.patch";
|
||||
hash = "sha256-72KaJyu7CHXxJJ1GNq/fz+kW1RslO3UaKI91LhBtiXA=";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://github.com/MercuryTechnologies/cctools-port/commit/025899b7b3593dedb0c681e689e57c0e7bbd9b80.patch";
|
||||
hash = "sha256-SWVUzFaJHH2fu9y8RcU3Nx/QKx60hPE5zFx0odYDeQs=";
|
||||
})
|
||||
# Always use `open_memstream`. This is provided by memstream via hook on x86_64-darwin.
|
||||
./darwin-memstream.patch
|
||||
];
|
||||
|
||||
__propagatedImpureHostDeps = [
|
||||
# As far as I can tell, otool from cctools is the only thing that depends on these two, and we should fix them
|
||||
"/usr/lib/libobjc.A.dylib"
|
||||
"/usr/lib/libobjc.dylib"
|
||||
];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
# TODO(@Ericson2314): Always pass "--target" and always targetPrefix.
|
||||
configurePlatforms = [ "build" "host" ]
|
||||
++ lib.optional (stdenv.targetPlatform != stdenv.hostPlatform) "target";
|
||||
configureFlags = [ "--disable-clang-as" ]
|
||||
++ lib.optionals enableTapiSupport [
|
||||
"--enable-tapi-support"
|
||||
"--with-libtapi=${libtapi}"
|
||||
];
|
||||
|
||||
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
substituteInPlace cctools/Makefile.am --replace libobjc2 ""
|
||||
'' + ''
|
||||
sed -i -e 's/addStandardLibraryDirectories = true/addStandardLibraryDirectories = false/' cctools/ld64/src/ld/Options.cpp
|
||||
|
||||
# FIXME: there are far more absolute path references that I don't want to fix right now
|
||||
substituteInPlace cctools/configure.ac \
|
||||
--replace "-isystem /usr/local/include -isystem /usr/pkg/include" "" \
|
||||
--replace "-L/usr/local/lib" "" \
|
||||
|
||||
# Appears to use new libdispatch API not available in macOS SDK 10.12.
|
||||
substituteInPlace cctools/ld64/src/ld/libcodedirectory.c \
|
||||
--replace "#define LIBCD_PARALLEL 1" ""
|
||||
|
||||
patchShebangs tools
|
||||
sed -i -e 's/which/type -P/' tools/*.sh
|
||||
|
||||
cd cctools
|
||||
'';
|
||||
|
||||
preInstall = ''
|
||||
installManPage ar/ar.{1,5}
|
||||
|
||||
# The makefile rules for installing headers are missing in 973.0.1.
|
||||
# The below is derived from 949.0.1.
|
||||
mkdir -p $dev/include/mach-o/i386
|
||||
mkdir -p $dev/include/mach-o/ppc
|
||||
mkdir -p $dev/include/mach-o/x86_64
|
||||
mkdir -p $dev/include/mach-o/arm
|
||||
mkdir -p $dev/include/mach-o/arm64
|
||||
mkdir -p $dev/include/mach-o/m68k
|
||||
mkdir -p $dev/include/mach-o/sparc
|
||||
mkdir -p $dev/include/mach-o/hppa
|
||||
mkdir -p $dev/include/mach-o/i860
|
||||
mkdir -p $dev/include/mach-o/m88k
|
||||
mkdir -p $dev/include/dyld
|
||||
mkdir -p $dev/include/cbt
|
||||
|
||||
pushd include/mach-o
|
||||
install -c -m 444 arch.h ldsyms.h reloc.h \
|
||||
stab.h loader.h fat.h swap.h getsect.h nlist.h \
|
||||
ranlib.h $dev/include/mach-o
|
||||
popd
|
||||
|
||||
pushd include/mach-o/i386
|
||||
install -c -m 444 swap.h \
|
||||
$dev/include/mach-o/i386
|
||||
popd
|
||||
|
||||
pushd include/mach-o/ppc
|
||||
install -c -m 444 reloc.h swap.h \
|
||||
$dev/include/mach-o/ppc
|
||||
popd
|
||||
|
||||
pushd include/mach-o/x86_64
|
||||
install -c -m 444 reloc.h \
|
||||
$dev/include/mach-o/x86_64
|
||||
popd
|
||||
|
||||
pushd include/mach-o/arm
|
||||
install -c -m 444 reloc.h \
|
||||
$dev/include/mach-o/arm
|
||||
popd
|
||||
|
||||
pushd include/mach-o/arm64
|
||||
install -c -m 444 reloc.h \
|
||||
$dev/include/mach-o/arm64
|
||||
popd
|
||||
|
||||
pushd include/mach-o/m68k
|
||||
install -c -m 444 swap.h \
|
||||
$dev/include/mach-o/m68k
|
||||
popd
|
||||
|
||||
pushd include/mach-o/sparc
|
||||
install -c -m 444 reloc.h swap.h \
|
||||
$dev/include/mach-o/sparc
|
||||
popd
|
||||
|
||||
pushd include/mach-o/hppa
|
||||
install -c -m 444 reloc.h swap.h \
|
||||
$dev/include/mach-o/hppa
|
||||
popd
|
||||
|
||||
pushd include/mach-o/i860
|
||||
install -c -m 444 reloc.h swap.h \
|
||||
$dev/include/mach-o/i860
|
||||
popd
|
||||
|
||||
pushd include/mach-o/m88k
|
||||
install -c -m 444 reloc.h swap.h \
|
||||
$dev/include/mach-o/m88k
|
||||
popd
|
||||
|
||||
pushd include/stuff
|
||||
install -c -m 444 bool.h \
|
||||
$dev/include/dyld
|
||||
popd
|
||||
|
||||
pushd include/cbt
|
||||
install -c -m 444 libsyminfo.h \
|
||||
$dev/include/cbt
|
||||
popd
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
# Move GNU as to its own output to prevent it from being used accidentally.
|
||||
moveToOutput bin/gas "$gas"
|
||||
moveToOutput libexec "$gas"
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit targetPrefix;
|
||||
};
|
||||
|
||||
meta = {
|
||||
broken = !stdenv.targetPlatform.isDarwin; # Only supports darwin targets
|
||||
homepage = "http://www.opensource.apple.com/source/cctools/";
|
||||
description = "MacOS Compiler Tools (cross-platform port)";
|
||||
license = lib.licenses.apple-psl20;
|
||||
maintainers = with lib.maintainers; [ matthewbauer ];
|
||||
};
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
{ lib, stdenv, fetchFromGitHub, pkgsBuildBuild, cmake, python3, ncurses }:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "libtapi";
|
||||
version = "1100.0.11"; # determined by looking at VERSION.txt
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "tpoechtrager";
|
||||
repo = "apple-libtapi";
|
||||
rev = "664b8414f89612f2dfd35a9b679c345aa5389026";
|
||||
sha256 = "1y1yl46msabfy14z0rln333a06087bk14f5h7q1cdawn8nmvbdbr";
|
||||
};
|
||||
|
||||
sourceRoot = "${finalAttrs.src.name}/src/llvm";
|
||||
|
||||
# Backported from newer llvm, fixes configure error when cross compiling.
|
||||
# Also means we don't have to manually fix the result with install_name_tool.
|
||||
patches = [
|
||||
./disable-rpath.patch
|
||||
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||
# TODO: make unconditional and rebuild the world
|
||||
# TODO: send upstream
|
||||
./native-clang-tblgen.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake python3 ];
|
||||
|
||||
# ncurses is required here to avoid a reference to bootstrap-tools, which is
|
||||
# not allowed for the stdenv.
|
||||
buildInputs = [ ncurses ];
|
||||
|
||||
cmakeFlags = [ "-DLLVM_INCLUDE_TESTS=OFF" ]
|
||||
++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
|
||||
"-DCMAKE_CROSSCOMPILING=True"
|
||||
# This package could probably have a llvm_6 llvm-tblgen and clang-tblgen
|
||||
# provided to reduce some building. This package seems intended to
|
||||
# include all of its dependencies, including enough of LLVM to build the
|
||||
# required tablegens.
|
||||
(
|
||||
let
|
||||
nativeCC = pkgsBuildBuild.stdenv.cc;
|
||||
nativeBintools = nativeCC.bintools.bintools;
|
||||
nativeToolchainFlags = [
|
||||
"-DCMAKE_C_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}cc"
|
||||
"-DCMAKE_CXX_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}c++"
|
||||
"-DCMAKE_AR=${nativeBintools}/bin/${nativeBintools.targetPrefix}ar"
|
||||
"-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
|
||||
"-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
|
||||
];
|
||||
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
|
||||
)
|
||||
];
|
||||
|
||||
# fixes: fatal error: 'clang/Basic/Diagnostic.h' file not found
|
||||
# adapted from upstream
|
||||
# https://github.com/tpoechtrager/apple-libtapi/blob/3cb307764cc5f1856c8a23bbdf3eb49dfc6bea48/build.sh#L58-L60
|
||||
preConfigure = ''
|
||||
INCLUDE_FIX="-I $PWD/projects/clang/include"
|
||||
INCLUDE_FIX+=" -I $PWD/build/projects/clang/include"
|
||||
|
||||
cmakeFlagsArray+=(-DCMAKE_CXX_FLAGS="$INCLUDE_FIX")
|
||||
'';
|
||||
|
||||
buildFlags = [ "clangBasic" "libtapi" "tapi" ];
|
||||
|
||||
installTargets = [ "install-libtapi" "install-tapi-headers" "install-tapi" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Replaces the Mach-O Dynamic Library Stub files in Apple's SDKs to reduce the size";
|
||||
mainProgram = "tapi";
|
||||
homepage = "https://github.com/tpoechtrager/apple-libtapi";
|
||||
license = licenses.ncsa;
|
||||
maintainers = with maintainers; [ matthewbauer ];
|
||||
};
|
||||
})
|
@ -1,14 +0,0 @@
|
||||
diff --git a/src/llvm/cmake/modules/AddLLVM.cmake b/src/llvm/cmake/modules/AddLLVM.cmake
|
||||
index a53016eb0..b65e608a4 100644
|
||||
--- a/cmake/modules/AddLLVM.cmake
|
||||
+++ b/cmake/modules/AddLLVM.cmake
|
||||
@@ -1683,8 +1683,7 @@ function(llvm_setup_rpath name)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
- set(_install_name_dir INSTALL_NAME_DIR "@rpath")
|
||||
- set(_install_rpath "@loader_path/../lib" ${extra_libdir})
|
||||
+ set(_install_name_dir)
|
||||
elseif(UNIX)
|
||||
set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
|
@ -1,21 +0,0 @@
|
||||
diffprojects/libtapi/CMakeLists.txt b/src/llvm/projects/libtapi/CMakeLists.txt
|
||||
index 8ee6d8138..8277be147 100644
|
||||
--- a/projects/libtapi/CMakeLists.txt
|
||||
+++ b/projects/libtapi/CMakeLists.txt
|
||||
@@ -193,7 +193,15 @@ if (NOT DEFINED CLANG_VERSION)
|
||||
set(CLANG_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}")
|
||||
endif ()
|
||||
if (NOT DEFINED CLANG_TABLEGEN_EXE)
|
||||
- set(CLANG_TABLEGEN_EXE "${LLVM_TOOLS_BINARY_DIR}/clang-tblgen")
|
||||
+ if(LLVM_USE_HOST_TOOLS)
|
||||
+ if (NOT CMAKE_CONFIGURATION_TYPES)
|
||||
+ set(CLANG_TABLEGEN_EXE "${LLVM_NATIVE_BUILD}/bin/clang-tblgen")
|
||||
+ else()
|
||||
+ set(CLANG_TABLEGEN_EXE "${LLVM_NATIVE_BUILD}/Release/bin/clang-tblgen")
|
||||
+ endif()
|
||||
+ else()
|
||||
+ set(CLANG_TABLEGEN_EXE "${LLVM_TOOLS_BINARY_DIR}/clang-tblgen")
|
||||
+ endif ()
|
||||
endif ()
|
||||
|
||||
# Include must go first.
|
@ -174,9 +174,6 @@ let
|
||||
overrides = self: super: (overrides self super) // {
|
||||
fetchurl = thisStdenv.fetchurlBoot;
|
||||
fetchpatch = super.fetchpatch.override { inherit (self) fetchurl; };
|
||||
fetchgit = super.fetchgit.override {
|
||||
git = super.git.override { curl = bootstrapTools; };
|
||||
};
|
||||
fetchzip = super.fetchzip.override { inherit (self) fetchurl; };
|
||||
};
|
||||
};
|
||||
@ -192,6 +189,9 @@ in
|
||||
({}: {
|
||||
__raw = true;
|
||||
|
||||
cctools = true;
|
||||
ld64 = true;
|
||||
|
||||
coreutils = null;
|
||||
gnugrep = null;
|
||||
|
||||
@ -202,7 +202,6 @@ in
|
||||
apple_sdk.sdkRoot = null;
|
||||
binutils = null;
|
||||
binutils-unwrapped = null;
|
||||
cctools = null;
|
||||
print-reexports = null;
|
||||
rewrite-tbd = null;
|
||||
sigtool = null;
|
||||
@ -242,6 +241,97 @@ in
|
||||
gnugrep = bootstrapTools;
|
||||
pbzx = bootstrapTools;
|
||||
|
||||
cctools = super.stdenv.mkDerivation {
|
||||
pname = "bootstrap-stage0-cctools";
|
||||
version = "boot";
|
||||
|
||||
buildCommand = ''
|
||||
declare -a cctools=(
|
||||
ar
|
||||
bitcode_strip
|
||||
check_dylib
|
||||
checksyms
|
||||
cmpdylib
|
||||
codesign_allocate
|
||||
ctf_insert
|
||||
depinfo
|
||||
diagtest
|
||||
gas
|
||||
gprof
|
||||
install_name_tool
|
||||
libtool
|
||||
lipo
|
||||
mtoc
|
||||
mtor
|
||||
nm
|
||||
nmedit
|
||||
otool
|
||||
pagestuff
|
||||
ranlib
|
||||
redo_prebinding
|
||||
seg_addr_table
|
||||
seg_hack
|
||||
segedit
|
||||
size
|
||||
strings
|
||||
strip
|
||||
vtool
|
||||
)
|
||||
|
||||
mkdir -p "$out/bin"
|
||||
for tool in "''${cctools[@]}"; do
|
||||
toolsrc="${bootstrapTools}/bin/$tool"
|
||||
if [ -e "$toolsrc" ]; then
|
||||
ln -s "$toolsrc" "$out/bin"
|
||||
fi
|
||||
done
|
||||
|
||||
# Copy only the required headers to avoid accidentally linking headers that belong to other packages,
|
||||
# which can cause problems when building Libsystem in the source-based SDK.
|
||||
declare -a machohdrs=(
|
||||
arch.h
|
||||
fat.h
|
||||
fixup-chains.h
|
||||
getsect.h
|
||||
ldsyms.h
|
||||
loader.h
|
||||
nlist.h
|
||||
ranlib.h
|
||||
reloc.h
|
||||
stab.h
|
||||
swap.h
|
||||
arm
|
||||
arm64
|
||||
hppa
|
||||
i386
|
||||
i860
|
||||
m68k
|
||||
m88k
|
||||
ppc
|
||||
sparc
|
||||
x86_64
|
||||
)
|
||||
|
||||
mkdir -p "$out/include/mach-o"
|
||||
for header in "''${machohdrs[@]}"; do
|
||||
machosrc="${bootstrapTools}/include-Libsystem/mach-o/$header"
|
||||
if [ -e "$machosrc" ]; then
|
||||
cp -r "$machosrc" "$out/include/mach-o/$header"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
isFromBootstrapFiles = true;
|
||||
targetPrefix = "";
|
||||
};
|
||||
};
|
||||
|
||||
ld64 = bootstrapTools // {
|
||||
targetPrefix = "";
|
||||
version = "boot";
|
||||
};
|
||||
|
||||
darwin = super.darwin.overrideScope (selfDarwin: superDarwin: {
|
||||
# Prevent CF from being propagated to the initial stdenv. Packages that require it
|
||||
# will have to manually add it to their build inputs.
|
||||
@ -262,7 +352,21 @@ in
|
||||
|
||||
bintools = selfDarwin.binutils-unwrapped;
|
||||
|
||||
inherit (selfDarwin) postLinkSignHook signingUtils;
|
||||
# Bootstrap tools cctools needs the hook and wrappers to make sure things are signed properly.
|
||||
# This can be dropped once the bootstrap tools cctools has been updated to 1010.6.
|
||||
extraBuildCommands = ''
|
||||
echo 'source ${selfDarwin.postLinkSignHook}' >> $out/nix-support/post-link-hook
|
||||
|
||||
export signingUtils=${selfDarwin.signingUtils}
|
||||
|
||||
wrap \
|
||||
install_name_tool ${../../build-support/bintools-wrapper/darwin-install_name_tool-wrapper.sh} \
|
||||
"${selfDarwin.binutils-unwrapped}/bin/install_name_tool"
|
||||
|
||||
wrap \
|
||||
strip ${../../build-support/bintools-wrapper/darwin-strip-wrapper.sh} \
|
||||
"${selfDarwin.binutils-unwrapped}/bin/strip"
|
||||
'';
|
||||
};
|
||||
|
||||
binutils-unwrapped = (superDarwin.binutils-unwrapped.overrideAttrs (old: {
|
||||
@ -272,93 +376,6 @@ in
|
||||
};
|
||||
})).override { enableManpages = false; };
|
||||
|
||||
cctools = super.stdenv.mkDerivation {
|
||||
pname = "bootstrap-stage0-cctools";
|
||||
version = "boot";
|
||||
|
||||
buildCommand = ''
|
||||
declare -a cctools=(
|
||||
ar
|
||||
bitcode_strip
|
||||
check_dylib
|
||||
checksyms
|
||||
cmpdylib
|
||||
codesign_allocate
|
||||
ctf_insert
|
||||
depinfo
|
||||
diagtest
|
||||
ld
|
||||
gas
|
||||
gprof
|
||||
install_name_tool
|
||||
libtool
|
||||
lipo
|
||||
mtoc
|
||||
mtor
|
||||
nm
|
||||
nmedit
|
||||
otool
|
||||
pagestuff
|
||||
ranlib
|
||||
redo_prebinding
|
||||
seg_addr_table
|
||||
seg_hack
|
||||
segedit
|
||||
size
|
||||
strings
|
||||
strip
|
||||
vtool
|
||||
)
|
||||
|
||||
mkdir -p "$out/bin"
|
||||
for tool in "''${cctools[@]}"; do
|
||||
toolsrc="${bootstrapTools}/bin/$tool"
|
||||
if [ -e "$toolsrc" ]; then
|
||||
ln -s "$toolsrc" "$out/bin"
|
||||
fi
|
||||
done
|
||||
|
||||
# Copy only the required headers to avoid accidentally linking headers that belong to other packages,
|
||||
# which can cause problems when building Libsystem in the source-based SDK.
|
||||
declare -a machohdrs=(
|
||||
arch.h
|
||||
fat.h
|
||||
fixup-chains.h
|
||||
getsect.h
|
||||
ldsyms.h
|
||||
loader.h
|
||||
nlist.h
|
||||
ranlib.h
|
||||
reloc.h
|
||||
stab.h
|
||||
swap.h
|
||||
arm
|
||||
arm64
|
||||
hppa
|
||||
i386
|
||||
i860
|
||||
m68k
|
||||
m88k
|
||||
ppc
|
||||
sparc
|
||||
x86_64
|
||||
)
|
||||
|
||||
mkdir -p "$out/include/mach-o"
|
||||
for header in "''${machohdrs[@]}"; do
|
||||
machosrc="${bootstrapTools}/include-Libsystem/mach-o/$header"
|
||||
if [ -e "$machosrc" ]; then
|
||||
cp -r "$machosrc" "$out/include/mach-o/$header"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
isFromBootstrapFiles = true;
|
||||
targetPrefix = "";
|
||||
};
|
||||
};
|
||||
|
||||
locale = self.stdenv.mkDerivation {
|
||||
name = "bootstrap-stage0-locale";
|
||||
buildCommand = ''
|
||||
@ -468,11 +485,8 @@ in
|
||||
);
|
||||
};
|
||||
|
||||
# The bootstrap tools may use `strip` from cctools, so use a compatible set of flags until LLVM
|
||||
# is rebuilt, and darwin.binutils can use its implementation instead.
|
||||
extraPreHook = ''
|
||||
stripAllFlags=" " # the cctools "strip" command doesn't know "-s"
|
||||
stripDebugFlags="-S" # the cctools "strip" command does something odd with "-p"
|
||||
stripDebugFlags="-S" # llvm-strip does not support "-p" for Mach-O
|
||||
'';
|
||||
})
|
||||
|
||||
@ -482,11 +496,11 @@ in
|
||||
(prevStage:
|
||||
# previous stage0 stdenv:
|
||||
assert lib.all isFromBootstrapFiles (
|
||||
with prevStage; [ bash coreutils cpio gnugrep ] ++ lib.optionals useAppleSDKLibs [ pbzx ]
|
||||
with prevStage; [ bash cctools coreutils cpio gnugrep ld64 ] ++ lib.optionals useAppleSDKLibs [ pbzx ]
|
||||
);
|
||||
|
||||
assert lib.all isFromBootstrapFiles (with prevStage.darwin; [
|
||||
binutils-unwrapped cctools print-reexports rewrite-tbd sigtool
|
||||
binutils-unwrapped print-reexports rewrite-tbd sigtool
|
||||
]);
|
||||
|
||||
assert (! useAppleSDKLibs) -> lib.all isFromBootstrapFiles (with prevStage.darwin; [ Libsystem ]);
|
||||
@ -503,9 +517,10 @@ in
|
||||
|
||||
overrides = self: super: {
|
||||
inherit (prevStage) ccWrapperStdenv
|
||||
coreutils gnugrep;
|
||||
cctools coreutils gnugrep ld64;
|
||||
|
||||
binutils-unwrapped = builtins.throw "nothing in the bootstrap should depend on GNU binutils";
|
||||
binutils-unwrapped = builtins.throw "nothing in the Darwin bootstrap should depend on GNU binutils";
|
||||
curl = builtins.throw "nothing in the Darwin bootstrap can depend on curl";
|
||||
|
||||
# Use this stage’s CF to build CMake. It’s required but can’t be included in the stdenv.
|
||||
cmake = self.cmakeMinimal;
|
||||
@ -533,8 +548,6 @@ in
|
||||
});
|
||||
|
||||
darwin = super.darwin.overrideScope (selfDarwin: superDarwin: {
|
||||
inherit (prevStage.darwin) cctools;
|
||||
|
||||
apple_sdk = superDarwin.apple_sdk // {
|
||||
inherit (prevStage.darwin.apple_sdk) sdkRoot;
|
||||
};
|
||||
@ -555,17 +568,31 @@ in
|
||||
# Rewrap binutils with the real Libsystem
|
||||
binutils = superDarwin.binutils.override {
|
||||
inherit (self) coreutils;
|
||||
inherit (selfDarwin) postLinkSignHook signingUtils;
|
||||
|
||||
bintools = selfDarwin.binutils-unwrapped;
|
||||
libc = selfDarwin.Libsystem;
|
||||
# TODO(@sternenseemann): can this be removed?
|
||||
runtimeShell = "${bootstrapTools}/bin/bash";
|
||||
|
||||
# Bootstrap tools cctools needs the hook to make sure things are signed properly.
|
||||
# This can be dropped once the bootstrap tools cctools has been updated to 1010.6.
|
||||
extraBuildCommands = ''
|
||||
echo 'source ${selfDarwin.postLinkSignHook}' >> $out/nix-support/post-link-hook
|
||||
|
||||
export signingUtils=${selfDarwin.signingUtils}
|
||||
|
||||
wrap \
|
||||
install_name_tool ${../../build-support/bintools-wrapper/darwin-install_name_tool-wrapper.sh} \
|
||||
"${selfDarwin.binutils-unwrapped}/bin/install_name_tool"
|
||||
|
||||
wrap \
|
||||
strip ${../../build-support/bintools-wrapper/darwin-strip-wrapper.sh} \
|
||||
"${selfDarwin.binutils-unwrapped}/bin/strip"
|
||||
'';
|
||||
};
|
||||
|
||||
# Avoid building unnecessary Python dependencies due to building LLVM manpages.
|
||||
binutils-unwrapped = superDarwin.binutils-unwrapped.override {
|
||||
inherit (selfDarwin) cctools;
|
||||
inherit (self) cctools ld64;
|
||||
enableManpages = false;
|
||||
};
|
||||
});
|
||||
@ -588,21 +615,16 @@ in
|
||||
prevStage.gnu-config
|
||||
];
|
||||
|
||||
# The bootstrap tools may use `strip` from cctools, so use a compatible set of flags until LLVM
|
||||
# is rebuilt, and darwin.binutils can use its implementation instead.
|
||||
extraPreHook = ''
|
||||
stripAllFlags=" " # the cctools "strip" command doesn't know "-s"
|
||||
stripDebugFlags="-S" # the cctools "strip" command does something odd with "-p"
|
||||
|
||||
# Don’t assume the ld64 in bootstrap tools supports response files. Only recent versions do.
|
||||
export NIX_LD_USE_RESPONSE_FILE=0
|
||||
extraPreHook = ''
|
||||
stripDebugFlags="-S" # llvm-strip does not support "-p" for Mach-O
|
||||
'';
|
||||
})
|
||||
|
||||
# Build sysctl for use by LLVM’s check phase. It must be built separately to avoid an infinite recursion.
|
||||
(prevStage:
|
||||
# previous stage1 stdenv:
|
||||
assert lib.all isFromBootstrapFiles (with prevStage; [ coreutils gnugrep ]);
|
||||
assert lib.all isFromBootstrapFiles (with prevStage; [ cctools coreutils gnugrep ld64 ]);
|
||||
|
||||
assert lib.all isBuiltByBootstrapFilesCompiler (with prevStage; [
|
||||
autoconf automake bash bison brotli cmake cpio cyrus_sasl db
|
||||
@ -612,9 +634,8 @@ in
|
||||
subversion texinfo unzip which xz zlib zstd
|
||||
]);
|
||||
|
||||
assert lib.all isFromBootstrapFiles (with prevStage.darwin; [ cctools ]);
|
||||
assert lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [
|
||||
locale libtapi print-reexports rewrite-tbd sigtool
|
||||
locale print-reexports rewrite-tbd sigtool
|
||||
]);
|
||||
|
||||
assert (! useAppleSDKLibs) -> lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [ Libsystem configd ]);
|
||||
@ -633,8 +654,8 @@ in
|
||||
|
||||
overrides = self: super: {
|
||||
inherit (prevStage) ccWrapperStdenv
|
||||
autoconf automake bash binutils binutils-unwrapped bison brotli cmake cmakeMinimal
|
||||
coreutils cpio cyrus_sasl db ed expat flex gettext gmp gnugrep groff icu
|
||||
autoconf automake bash binutils-unwrapped bison brotli cctools cmake cmakeMinimal
|
||||
coreutils cpio curl cyrus_sasl db ed expat flex gettext gmp gnugrep groff icu ld64
|
||||
libedit libffi libidn2 libkrb5 libssh2 libtool libunistring libxml2 m4
|
||||
ncurses nghttp2 ninja openldap openssh openssl patchutils pbzx perl pkg-config
|
||||
python3Minimal scons sed serf sharutils sqlite subversion texinfo unzip which xz
|
||||
@ -655,7 +676,7 @@ in
|
||||
|
||||
darwin = super.darwin.overrideScope (_: superDarwin: {
|
||||
inherit (prevStage.darwin)
|
||||
CF sdkRoot Libsystem binutils-unwrapped cctools cctools-port configd darwin-stubs dyld
|
||||
CF sdkRoot Libsystem binutils binutils-unwrapped configd darwin-stubs dtrace dyld
|
||||
launchd libclosure libdispatch libobjc locale objc4 postLinkSignHook
|
||||
print-reexports rewrite-tbd signingUtils sigtool;
|
||||
|
||||
@ -683,10 +704,8 @@ in
|
||||
prevStage.gnu-config
|
||||
];
|
||||
|
||||
# Until LLVM is rebuilt, assume `strip` is the one from cctools.
|
||||
extraPreHook = ''
|
||||
stripAllFlags=" " # the cctools "strip" command doesn't know "-s"
|
||||
stripDebugFlags="-S" # the cctools "strip" command does something odd with "-p"
|
||||
stripDebugFlags="-S" # llvm-strip does not support "-p" for Mach-O
|
||||
'';
|
||||
})
|
||||
|
||||
@ -695,21 +714,23 @@ in
|
||||
# but those libraries will be used in the final stdenv.
|
||||
#
|
||||
# Rebuild coreutils and gnugrep to avoid unwanted references to the bootstrap tools on `PATH`.
|
||||
#
|
||||
# The first build of cctools is deferred until this stage because it depends on LLVM headers
|
||||
# that are not included in the bootstrap tools tarball.
|
||||
(prevStage:
|
||||
# previous stage-sysctl stdenv:
|
||||
assert lib.all isFromBootstrapFiles (with prevStage; [ coreutils gnugrep ]);
|
||||
assert lib.all isFromBootstrapFiles (with prevStage; [ cctools coreutils gnugrep ld64 ]);
|
||||
|
||||
assert lib.all isBuiltByBootstrapFilesCompiler (with prevStage; [
|
||||
atf autoconf automake bash bison brotli cmake cpio cyrus_sasl db
|
||||
ed expat flex gettext gmp groff icu kyua libedit libffi libiconv libidn2 libkrb5 libssh2
|
||||
libtool libunistring libxml2 m4 meson ncurses nghttp2 ninja openldap openssh openssl
|
||||
libtapi libtool libunistring libxml2 m4 meson ncurses nghttp2 ninja openldap openssh openssl
|
||||
patchutils pbzx perl pkg-config.pkg-config python3 python3Minimal scons serf sqlite
|
||||
subversion sysctl.provider texinfo unzip which xz zlib zstd
|
||||
]);
|
||||
|
||||
assert lib.all isFromBootstrapFiles (with prevStage.darwin; [ cctools ]);
|
||||
assert lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [
|
||||
locale libtapi print-reexports rewrite-tbd sigtool
|
||||
locale print-reexports rewrite-tbd sigtool
|
||||
]);
|
||||
|
||||
assert (! useAppleSDKLibs) -> lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [ Libsystem configd ]);
|
||||
@ -726,12 +747,15 @@ in
|
||||
|
||||
overrides = self: super: {
|
||||
inherit (prevStage) ccWrapperStdenv
|
||||
atf autoconf automake bash binutils binutils-unwrapped bison brotli cmake cmakeMinimal
|
||||
cpio cyrus_sasl db ed expat flex gettext gmp groff icu kyua libedit libffi libiconv
|
||||
atf autoconf automake bash binutils-unwrapped bison brotli cmake cmakeMinimal
|
||||
cpio curl cyrus_sasl db ed expat flex gettext gmp groff icu kyua libedit libffi libiconv
|
||||
libidn2 libkrb5 libssh2 libtool libunistring libxml2 m4 meson ncurses nghttp2 ninja
|
||||
openldap openssh openssl patchutils pbzx perl pkg-config python3 python3Minimal
|
||||
scons sed serf sharutils sqlite subversion sysctl texinfo unzip which xz zlib zstd;
|
||||
|
||||
# Disable ld64’s install check phase because the required LTO libraries are not built yet.
|
||||
ld64 = super.ld64.overrideAttrs { doInstallCheck = false; };
|
||||
|
||||
darwin = super.darwin.overrideScope (selfDarwin: superDarwin: {
|
||||
inherit (prevStage.darwin)
|
||||
CF Libsystem configd darwin-stubs dyld launchd libclosure libdispatch libobjc
|
||||
@ -787,8 +811,7 @@ in
|
||||
];
|
||||
|
||||
extraPreHook = ''
|
||||
stripAllFlags=" " # the cctools "strip" command doesn't know "-s"
|
||||
stripDebugFlags="-S" # the cctools "strip" command does something odd with "-p"
|
||||
stripDebugFlags="-S" # llvm-strip does not support "-p" for Mach-O
|
||||
'';
|
||||
})
|
||||
|
||||
@ -797,8 +820,8 @@ in
|
||||
(prevStage:
|
||||
# previous stage-xclang stdenv:
|
||||
assert lib.all isBuiltByBootstrapFilesCompiler (with prevStage; [
|
||||
atf autoconf automake bash bison cmake cmakeMinimal coreutils cpio
|
||||
cyrus_sasl db ed expat flex gettext gmp gnugrep groff icu kyua libedit libtool m4 meson ninja
|
||||
atf autoconf automake bash bison cctools cmake cmakeMinimal coreutils cpio
|
||||
cyrus_sasl db ed expat flex gettext gmp gnugrep groff icu kyua ld64 libedit libtapi libtool m4 meson ninja
|
||||
openbsm openldap openpam openssh patchutils pbzx perl pkg-config.pkg-config python3
|
||||
python3Minimal scons serf sqlite subversion sysctl.provider texinfo unzip which xz
|
||||
]);
|
||||
@ -809,7 +832,7 @@ in
|
||||
]);
|
||||
|
||||
assert lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [
|
||||
cctools locale libtapi print-reexports rewrite-tbd sigtool
|
||||
locale print-reexports rewrite-tbd sigtool
|
||||
]);
|
||||
|
||||
assert (! useAppleSDKLibs) -> lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [ Libsystem configd ]);
|
||||
@ -825,13 +848,13 @@ in
|
||||
|
||||
stageFun prevStage {
|
||||
|
||||
name = "bootstrap-stage2-Libsystem";
|
||||
name = "bootstrap-stage2";
|
||||
|
||||
overrides = self: super: {
|
||||
inherit (prevStage) ccWrapperStdenv
|
||||
atf autoconf automake binutils-unwrapped bison brotli cmake cmakeMinimal coreutils
|
||||
cpio cyrus_sasl db ed expat flex gettext gmp gnugrep groff icu kyua libedit libffi
|
||||
libiconv libidn2 libkrb5 libssh2 libtool libunistring libxml2 m4 meson ncurses nghttp2
|
||||
atf autoconf automake binutils-unwrapped bison brotli cctools cmake cmakeMinimal coreutils
|
||||
cpio curl cyrus_sasl db ed expat flex gettext gmp gnugrep groff icu kyua ld64 libedit libffi
|
||||
libiconv libidn2 libkrb5 libssh2 libtapi libtool libunistring libxml2 m4 meson ncurses nghttp2
|
||||
ninja openbsm openldap openpam openssh openssl patchutils pbzx perl pkg-config
|
||||
python3 python3Minimal scons serf sqlite subversion sysctl texinfo unzip which xz
|
||||
zlib zstd;
|
||||
@ -844,22 +867,39 @@ in
|
||||
|
||||
darwin = super.darwin.overrideScope (selfDarwin: superDarwin: {
|
||||
inherit (prevStage.darwin)
|
||||
CF binutils-unwrapped cctools configd darwin-stubs launchd libobjc libtapi locale
|
||||
objc4 print-reexports rewrite-tbd signingUtils sigtool;
|
||||
binutils-unwrapped configd darwin-stubs launchd locale postLinkSignHook
|
||||
print-reexports rewrite-tbd signingUtils sigtool;
|
||||
|
||||
apple_sdk = superDarwin.apple_sdk // {
|
||||
inherit (prevStage.darwin.apple_sdk) sdkRoot;
|
||||
};
|
||||
|
||||
# Rewrap binutils so it uses the rebuilt Libsystem.
|
||||
binutils = superDarwin.binutils.override {
|
||||
inherit (prevStage) expand-response-params;
|
||||
libc = selfDarwin.Libsystem;
|
||||
} // {
|
||||
passthru = { inherit (prevStage.bintools.passthru) isFromBootstrapFiles; };
|
||||
};
|
||||
});
|
||||
|
||||
llvmPackages = super.llvmPackages // (
|
||||
let
|
||||
tools = super.llvmPackages.tools.extend (_: _: {
|
||||
inherit (prevStage.llvmPackages) clang-unwrapped clangNoCompilerRtWithLibc libclang libllvm llvm;
|
||||
inherit (prevStage.llvmPackages) clang-unwrapped clangNoCompilerRtWithLibc libclang lld libllvm llvm;
|
||||
});
|
||||
|
||||
libraries = super.llvmPackages.libraries.extend (selfLib: superLib: {
|
||||
inherit (prevStage.llvmPackages) compiler-rt libcxx;
|
||||
inherit (prevStage.llvmPackages) libcxx;
|
||||
|
||||
# Make sure compiler-rt is linked against the CF from this stage, which can be
|
||||
# propagated to the final stdenv. CF is required by ASAN.
|
||||
compiler-rt = superLib.compiler-rt.override ({
|
||||
inherit (self.llvmPackages) libllvm;
|
||||
stdenv = self.stdenv.override {
|
||||
extraBuildInputs = [ self.darwin.CF ];
|
||||
};
|
||||
});
|
||||
});
|
||||
in
|
||||
{ inherit tools libraries; inherit (prevStage.llvmPackages) release_version; } // tools // libraries
|
||||
@ -888,147 +928,23 @@ in
|
||||
'';
|
||||
})
|
||||
|
||||
# This stage rebuilds CF, compiler-rt, and the sdkRoot derivation.
|
||||
#
|
||||
# CF requires:
|
||||
# - aarch64-darwin: libobjc (due to being apple_sdk.frameworks.CoreFoundation instead of swift-corefoundation)
|
||||
# - x86_64-darwin: libiconv libxml2 icu zlib
|
||||
(prevStage:
|
||||
# previous stage2-Libsystem stdenv:
|
||||
assert lib.all isBuiltByBootstrapFilesCompiler (with prevStage; [
|
||||
atf autoconf automake bison brotli cmake cmakeMinimal coreutils
|
||||
cpio cyrus_sasl db ed expat flex gettext gmp gnugrep groff icu kyua libedit libidn2
|
||||
libkrb5 libssh2 libtool libunistring m4 meson nghttp2 ninja openbsm openldap openpam openssh
|
||||
openssl patchutils pbzx perl pkg-config.pkg-config python3 python3Minimal scons serf
|
||||
sqlite subversion sysctl.provider texinfo unzip which xz zstd
|
||||
]);
|
||||
|
||||
assert lib.all isBuiltByNixpkgsCompiler (with prevStage; [ bash ]);
|
||||
|
||||
assert lib.all isBuiltByBootstrapFilesCompiler (with prevStage; [
|
||||
libffi libiconv libxml2 ncurses zlib zstd
|
||||
]);
|
||||
|
||||
assert lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [
|
||||
cctools locale libtapi print-reexports rewrite-tbd sigtool
|
||||
]);
|
||||
|
||||
assert (! useAppleSDKLibs) -> lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [ configd ]);
|
||||
assert (! useAppleSDKLibs) -> lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [ Libsystem ]);
|
||||
assert (! useAppleSDKLibs) -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF ]);
|
||||
assert useAppleSDKLibs -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF Libsystem libobjc ]);
|
||||
assert lib.all isFromNixpkgs (with prevStage.darwin; [ binutils-unwrapped dyld launchd libclosure libdispatch xnu ]);
|
||||
|
||||
assert lib.all isBuiltByBootstrapFilesCompiler (with prevStage.llvmPackages; [
|
||||
clang-unwrapped libclang libllvm llvm
|
||||
]);
|
||||
assert lib.all isBuiltByNixpkgsCompiler (with prevStage.llvmPackages; [ libcxx ]);
|
||||
assert prevStage.llvmPackages.compiler-rt == null;
|
||||
|
||||
stageFun prevStage {
|
||||
|
||||
name = "bootstrap-stage2-CF";
|
||||
|
||||
overrides = self: super: {
|
||||
inherit (prevStage) ccWrapperStdenv
|
||||
atf autoconf automake bash bison brotli cmake cmakeMinimal coreutils cpio
|
||||
cyrus_sasl db ed expat flex gettext gmp gnugrep groff kyua libedit libidn2 libkrb5
|
||||
libssh2 libtool libunistring m4 meson ncurses nghttp2 ninja openbsm openldap openpam
|
||||
openssh openssl patchutils pbzx perl pkg-config python3 python3Minimal scons serf
|
||||
sqlite subversion sysctl texinfo unzip which xz zstd;
|
||||
|
||||
# Avoid pulling in a full python and its extra dependencies for the llvm/clang builds.
|
||||
libxml2 = super.libxml2.override { pythonSupport = false; };
|
||||
|
||||
darwin = super.darwin.overrideScope (selfDarwin: superDarwin: {
|
||||
inherit (prevStage.darwin)
|
||||
Libsystem configd darwin-stubs launchd locale print-reexports rewrite-tbd
|
||||
signingUtils sigtool;
|
||||
|
||||
# Rewrap binutils so it uses the rebuilt Libsystem.
|
||||
binutils = superDarwin.binutils.override {
|
||||
inherit (prevStage) expand-response-params;
|
||||
libc = selfDarwin.Libsystem;
|
||||
} // {
|
||||
passthru = { inherit (prevStage.bintools.passthru) isFromBootstrapFiles; };
|
||||
};
|
||||
});
|
||||
|
||||
llvmPackages = super.llvmPackages // (
|
||||
let
|
||||
tools = super.llvmPackages.tools.extend (_: _: {
|
||||
inherit (prevStage.llvmPackages) clang-unwrapped clangNoCompilerRtWithLibc libclang lld libllvm llvm;
|
||||
clang = prevStage.stdenv.cc;
|
||||
});
|
||||
|
||||
libraries = super.llvmPackages.libraries.extend (selfLib: superLib: {
|
||||
inherit (prevStage.llvmPackages) libcxx;
|
||||
|
||||
# Make sure compiler-rt is linked against the CF from this stage, which can be
|
||||
# propagated to the final stdenv. CF is required by ASAN.
|
||||
compiler-rt = superLib.compiler-rt.override ({
|
||||
inherit (self.llvmPackages) libllvm;
|
||||
stdenv = self.stdenv.override {
|
||||
extraBuildInputs = [ self.darwin.CF ];
|
||||
};
|
||||
});
|
||||
});
|
||||
in
|
||||
{ inherit tools libraries; inherit (prevStage.llvmPackages) release_version; } // tools // libraries
|
||||
);
|
||||
|
||||
# Don’t link anything in this stage against CF to prevent propagating CF from prior stages to
|
||||
# the final stdenv, which happens because of the rpath hook. Also don’t use a stdenv with
|
||||
# compiler-rt because it needs to be built in this stage.
|
||||
stdenv =
|
||||
let
|
||||
stdenvNoCF = super.stdenv.override {
|
||||
extraBuildInputs = [ ];
|
||||
};
|
||||
in
|
||||
self.overrideCC stdenvNoCF (self.llvmPackages.clangNoCompilerRtWithLibc.override {
|
||||
inherit (self.llvmPackages) libcxx;
|
||||
|
||||
# Make sure the stdenv is using the Libsystem that will be propagated to the final stdenv.
|
||||
libc = self.darwin.Libsystem;
|
||||
bintools = self.llvmPackages.clangNoCompilerRtWithLibc.bintools.override {
|
||||
libc = self.darwin.Libsystem;
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
extraNativeBuildInputs = lib.optionals localSystem.isAarch64 [
|
||||
prevStage.updateAutotoolsGnuConfigScriptsHook
|
||||
prevStage.gnu-config
|
||||
];
|
||||
|
||||
extraPreHook = ''
|
||||
stripDebugFlags="-S" # llvm-strip does not support "-p" for Mach-O
|
||||
'';
|
||||
})
|
||||
|
||||
# Rebuild LLVM with LLVM. This stage also rebuilds certain dependencies needed by LLVM.
|
||||
#
|
||||
# LLVM requires: libcxx libffi libiconv libxml2 ncurses zlib
|
||||
# LLVM requires: libcxx libffi libiconv libxml2 ncurses python3 zlib
|
||||
(prevStage:
|
||||
# previous stage2-CF stdenv:
|
||||
# previous stage2 stdenv:
|
||||
assert lib.all isBuiltByBootstrapFilesCompiler (with prevStage; [
|
||||
autoconf automake bison brotli cmake cmakeMinimal coreutils cpio cyrus_sasl
|
||||
db ed expat flex gettext gmp gnugrep groff libedit libidn2 libkrb5 libssh2 libtool
|
||||
libunistring m4 meson ncurses nghttp2 ninja openbsm openldap openpam openssh openssl
|
||||
autoconf automake bison brotli cctools cmake cmakeMinimal coreutils cpio cyrus_sasl
|
||||
db ed expat flex gettext gmp gnugrep groff icu ld64 libedit libffi libiconv libidn2 libkrb5 libssh2 libtool
|
||||
libtapi libunistring libxml2 m4 meson ncurses nghttp2 ninja openbsm openldap openpam openssh openssl
|
||||
patchutils pbzx perl pkg-config.pkg-config python3 python3Minimal scons serf sqlite
|
||||
subversion sysctl.provider texinfo unzip which xz zstd
|
||||
]);
|
||||
assert lib.all isBuiltByNixpkgsCompiler (with prevStage; [
|
||||
bash icu libffi libiconv libxml2 zlib
|
||||
subversion sysctl.provider texinfo unzip which xz zstd zlib
|
||||
]);
|
||||
assert lib.all isBuiltByNixpkgsCompiler (with prevStage; [ bash ]);
|
||||
|
||||
assert lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [
|
||||
locale print-reexports rewrite-tbd sigtool
|
||||
]);
|
||||
assert lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [
|
||||
cctools libtapi
|
||||
]);
|
||||
|
||||
assert (! useAppleSDKLibs) -> lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [ configd ]);
|
||||
assert (! useAppleSDKLibs) -> lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [ Libsystem ]);
|
||||
@ -1047,22 +963,22 @@ in
|
||||
|
||||
overrides = self: super: {
|
||||
inherit (prevStage) ccWrapperStdenv
|
||||
autoconf automake bash binutils binutils-unwrapped bison brotli cmake cmakeMinimal
|
||||
coreutils cpio cyrus_sasl db ed expat flex gettext gmp gnugrep groff libedit
|
||||
autoconf automake bash binutils-unwrapped bison brotli cmake cmakeMinimal
|
||||
coreutils cpio curl cyrus_sasl db ed expat flex gettext gmp gnugrep groff libedit
|
||||
libidn2 libkrb5 libssh2 libtool libunistring m4 meson nghttp2 ninja openbsm openldap
|
||||
openpam openssh openssl patchutils pbzx perl pkg-config python3 python3Minimal scons
|
||||
sed serf sharutils sqlite subversion sysctl texinfo unzip which xz zstd
|
||||
|
||||
# CF dependencies - don’t rebuild them.
|
||||
icu libiconv libiconv-darwin libxml2 zlib;
|
||||
sed serf sharutils sqlite subversion sysctl texinfo unzip which xz zstd;
|
||||
|
||||
# Disable tests because they use dejagnu, which fails to run.
|
||||
libffi = super.libffi.override { doCheck = false; };
|
||||
|
||||
# Avoid pulling in a full python and its extra dependencies for the llvm/clang builds.
|
||||
libxml2 = super.libxml2.override { pythonSupport = false; };
|
||||
|
||||
darwin = super.darwin.overrideScope (selfDarwin: superDarwin: {
|
||||
inherit (prevStage.darwin)
|
||||
CF Libsystem binutils binutils-unwrapped cctools cctools-port configd
|
||||
darwin-stubs dyld launchd libclosure libdispatch libobjc libtapi locale objc4
|
||||
CF Libsystem binutils binutils-unwrapped configd
|
||||
darwin-stubs dyld launchd libclosure libdispatch libobjc locale objc4
|
||||
postLinkSignHook print-reexports rewrite-tbd signingUtils sigtool;
|
||||
|
||||
apple_sdk = superDarwin.apple_sdk // {
|
||||
@ -1103,15 +1019,12 @@ in
|
||||
]);
|
||||
|
||||
assert lib.all isBuiltByNixpkgsCompiler (with prevStage; [
|
||||
bash icu libffi libiconv libxml2 zlib
|
||||
bash cctools icu ld64 libtapi libffi libiconv libxml2 zlib
|
||||
]);
|
||||
|
||||
assert lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [
|
||||
locale print-reexports rewrite-tbd sigtool
|
||||
]);
|
||||
assert lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [
|
||||
cctools libtapi
|
||||
]);
|
||||
|
||||
assert (! useAppleSDKLibs) -> lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [ configd ]);
|
||||
assert (! useAppleSDKLibs) -> lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [ Libsystem ]);
|
||||
@ -1129,8 +1042,8 @@ in
|
||||
|
||||
overrides = self: super: {
|
||||
inherit (prevStage) ccWrapperStdenv
|
||||
autoconf automake bash bison cmake cmakeMinimal cyrus_sasl db expat flex groff
|
||||
libedit libtool m4 meson ninja openldap openssh patchutils perl pkg-config python3 scons
|
||||
autoconf automake bash binutils-unwrapped bison cmake cmakeMinimal curl cyrus_sasl db expat flex groff
|
||||
libedit libtool m4 meson ninja openldap openssh patchutils perl pkg-config python3 python3Minimal scons
|
||||
serf sqlite subversion sysctl texinfo unzip which
|
||||
|
||||
# CF dependencies - don’t rebuild them.
|
||||
@ -1258,15 +1171,13 @@ in
|
||||
(prevStage:
|
||||
# previous stage4 stdenv:
|
||||
assert lib.all isBuiltByNixpkgsCompiler (with prevStage; [
|
||||
bash brotli bzip2 cpio diffutils ed file findutils gawk
|
||||
gettext gmp gnugrep gnumake gnused gnutar gzip icu libffi libiconv libidn2 libkrb5
|
||||
libssh2 libunistring libxml2 libyaml ncurses nghttp2 openbsm openpam openssl patch
|
||||
pbzx pcre python3Minimal xar xz zlib zstd
|
||||
bash brotli bzip2 cctools cpio diffutils ed file findutils gawk
|
||||
gettext gmp gnugrep gnumake gnused gnutar gzip icu ld64 libffi libiconv libidn2 libkrb5
|
||||
libssh2 libtapi libunistring libxml2 libyaml ncurses nghttp2 openbsm openpam openssl patch
|
||||
pbzx pcre xar xz zlib zstd
|
||||
]);
|
||||
|
||||
assert lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [
|
||||
cctools libtapi locale print-reexports rewrite-tbd sigtool
|
||||
]);
|
||||
assert lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [ locale print-reexports rewrite-tbd sigtool ]);
|
||||
|
||||
assert (! useAppleSDKLibs) -> lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [ Libsystem configd ]);
|
||||
assert (! useAppleSDKLibs) -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF ]);
|
||||
@ -1279,13 +1190,11 @@ in
|
||||
|
||||
assert lib.all isBuiltByBootstrapFilesCompiler (with prevStage; [
|
||||
autoconf automake bison cmake cmakeMinimal cyrus_sasl db expat flex groff libedit
|
||||
libtool m4 meson ninja openldap openssh patchutils perl pkg-config.pkg-config python3 scons
|
||||
libtool m4 meson ninja openldap openssh patchutils perl pkg-config.pkg-config python3 python3Minimal scons
|
||||
serf sqlite subversion sysctl.provider texinfo unzip which
|
||||
]);
|
||||
|
||||
let
|
||||
doSign = localSystem.isAarch64;
|
||||
|
||||
cc = prevStage.llvmPackages.clang;
|
||||
in
|
||||
{
|
||||
@ -1337,6 +1246,10 @@ in
|
||||
bzip2.bin
|
||||
bzip2.out
|
||||
cc.expand-response-params
|
||||
cctools
|
||||
ld64.out
|
||||
ld64.lib
|
||||
libtapi.out
|
||||
coreutils
|
||||
darwin.binutils
|
||||
darwin.binutils.bintools
|
||||
@ -1363,13 +1276,14 @@ in
|
||||
ncurses.out
|
||||
openbsm
|
||||
openpam
|
||||
openssl.out
|
||||
patch
|
||||
xar
|
||||
xz.bin
|
||||
xz.out
|
||||
zlib.dev
|
||||
zlib.out
|
||||
]
|
||||
++ lib.optionals doSign [ openssl.out ])
|
||||
])
|
||||
++ lib.optionals localSystem.isAarch64 [
|
||||
prevStage.updateAutotoolsGnuConfigScriptsHook
|
||||
prevStage.gnu-config
|
||||
@ -1389,36 +1303,34 @@ in
|
||||
++ (with prevStage.darwin; [
|
||||
CF
|
||||
Libsystem
|
||||
cctools-port
|
||||
dyld
|
||||
libtapi
|
||||
locale
|
||||
apple_sdk.sdkRoot
|
||||
]
|
||||
++ lib.optional useAppleSDKLibs [ objc4 ]
|
||||
++ lib.optionals doSign [ postLinkSignHook sigtool signingUtils ]);
|
||||
++ lib.optionals useAppleSDKLibs [ objc4 ]);
|
||||
|
||||
__stdenvImpureHostDeps = commonImpureHostDeps;
|
||||
__extraImpureHostDeps = commonImpureHostDeps;
|
||||
|
||||
overrides = self: super: {
|
||||
inherit (prevStage)
|
||||
bash binutils brotli bzip2 coreutils cpio diffutils ed file findutils gawk
|
||||
bash brotli bzip2 coreutils cpio diffutils ed file findutils gawk
|
||||
gettext gmp gnugrep gnumake gnused gnutar gzip icu libffi libiconv libiconv-darwin
|
||||
libidn2 libssh2 libunistring libxml2 libyaml ncurses nghttp2 openbsm openpam
|
||||
openssl patch pbzx pcre python3Minimal xar xz zlib zstd;
|
||||
|
||||
darwin = super.darwin.overrideScope (_: superDarwin: {
|
||||
inherit (prevStage.darwin)
|
||||
CF ICU Libsystem darwin-stubs dyld locale libobjc libtapi rewrite-tbd xnu;
|
||||
CF ICU Libsystem darwin-stubs dyld locale libobjc rewrite-tbd xnu;
|
||||
|
||||
apple_sdk = superDarwin.apple_sdk // {
|
||||
inherit (prevStage.darwin.apple_sdk) sdkRoot;
|
||||
};
|
||||
} // lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) {
|
||||
inherit (prevStage.darwin) binutils binutils-unwrapped cctools-port;
|
||||
inherit (prevStage.darwin) binutils binutils-unwrapped;
|
||||
});
|
||||
} // lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) {
|
||||
inherit (prevStage) cctools ld64 libtapi;
|
||||
inherit (prevStage.llvmPackages) clang llvm;
|
||||
|
||||
# Need to get rid of these when cross-compiling.
|
||||
@ -1437,13 +1349,14 @@ in
|
||||
};
|
||||
})
|
||||
|
||||
# This "no-op" stage is just a place to put the assertions about stage6.
|
||||
# This "no-op" stage is just a place to put the assertions about the final stage.
|
||||
(prevStage:
|
||||
# previous final stage stdenv:
|
||||
assert isBuiltByNixpkgsCompiler prevStage.cctools;
|
||||
assert isBuiltByNixpkgsCompiler prevStage.ld64;
|
||||
assert isBuiltByNixpkgsCompiler prevStage.darwin.sigtool;
|
||||
assert isBuiltByNixpkgsCompiler prevStage.darwin.print-reexports;
|
||||
assert isBuiltByNixpkgsCompiler prevStage.darwin.rewrite-tbd;
|
||||
assert isBuiltByNixpkgsCompiler prevStage.darwin.cctools;
|
||||
|
||||
assert isFromNixpkgs prevStage.darwin.CF;
|
||||
assert isFromNixpkgs prevStage.darwin.Libsystem;
|
||||
@ -1457,6 +1370,7 @@ in
|
||||
# Make sure these evaluate since they were disabled explicitly in the bootstrap.
|
||||
assert isBuiltByNixpkgsCompiler prevStage.binutils-unwrapped;
|
||||
assert isFromNixpkgs prevStage.binutils-unwrapped.src;
|
||||
assert isBuiltByNixpkgsCompiler prevStage.curl;
|
||||
|
||||
{ inherit (prevStage) config overlays stdenv; })
|
||||
]
|
||||
|
@ -114,14 +114,9 @@ let
|
||||
export NIX_NO_SELF_RPATH=1
|
||||
'' + lib.optionalString (hostPlatform.isDarwin && hostPlatform.isMacOS) ''
|
||||
export MACOSX_DEPLOYMENT_TARGET=${hostPlatform.darwinMinVersion}
|
||||
''
|
||||
# TODO this should be uncommented, but it causes stupid mass rebuilds. I
|
||||
# think the best solution would just be to fixup linux RPATHs so we don't
|
||||
# need to set `-rpath` anywhere.
|
||||
# + lib.optionalString targetPlatform.isDarwin ''
|
||||
# export NIX_DONT_SET_RPATH_FOR_TARGET=1
|
||||
# ''
|
||||
;
|
||||
'' + lib.optionalString targetPlatform.isDarwin ''
|
||||
export NIX_DONT_SET_RPATH_FOR_TARGET=1
|
||||
'';
|
||||
|
||||
inherit initialPath shell
|
||||
defaultNativeBuildInputs defaultBuildInputs;
|
||||
|
@ -16753,7 +16753,6 @@ with pkgs;
|
||||
noLibc = (self.libc == null);
|
||||
|
||||
inherit bintools libc;
|
||||
inherit (darwin) postLinkSignHook signingUtils;
|
||||
} // extraArgs; in self);
|
||||
|
||||
yaml-language-server = callPackage ../development/tools/language-servers/yaml-language-server { };
|
||||
|
@ -51,6 +51,10 @@ mapAliases ({
|
||||
|
||||
builder = throw "'darwin.builder' has been changed and renamed to 'darwin.linux-builder'. The default ssh port is now 31022. Please update your configuration or override the port back to 22. See https://nixos.org/manual/nixpkgs/unstable/#sec-darwin-builder"; # added 2023-07-06
|
||||
|
||||
### C ###
|
||||
cctools-apple = pkgs.cctools; # added 2024-07-01
|
||||
cctools-llvm = pkgs.cctools; # added 2024-07-01
|
||||
|
||||
### I ###
|
||||
|
||||
insert_dylib = throw "'darwin.insert_dylib' has been renamed to 'insert-dylib'"; # added 2024-04-04
|
||||
|
@ -90,7 +90,7 @@ impure-cmds // appleSourcePackages // chooseLibs // {
|
||||
};
|
||||
|
||||
binutils-unwrapped = callPackage ../os-specific/darwin/binutils {
|
||||
inherit (self) cctools;
|
||||
inherit (pkgs) cctools;
|
||||
inherit (pkgs.llvmPackages) clang-unwrapped llvm llvm-manpages;
|
||||
};
|
||||
|
||||
@ -135,17 +135,7 @@ impure-cmds // appleSourcePackages // chooseLibs // {
|
||||
|
||||
cctools = self.cctools-port;
|
||||
|
||||
cctools-apple = callPackage ../os-specific/darwin/cctools/apple.nix {
|
||||
stdenv = if stdenv.isDarwin then stdenv else pkgs.libcxxStdenv;
|
||||
};
|
||||
|
||||
cctools-llvm = callPackage ../os-specific/darwin/cctools/llvm.nix {
|
||||
stdenv = if stdenv.isDarwin then stdenv else pkgs.libcxxStdenv;
|
||||
};
|
||||
|
||||
cctools-port = callPackage ../os-specific/darwin/cctools/port.nix {
|
||||
stdenv = if stdenv.isDarwin then stdenv else pkgs.libcxxStdenv;
|
||||
};
|
||||
cctools-port = pkgs.cctools;
|
||||
|
||||
# TODO(@connorbaker): See https://github.com/NixOS/nixpkgs/issues/229389.
|
||||
cf-private = self.apple_sdk.frameworks.CoreFoundation;
|
||||
@ -245,7 +235,7 @@ impure-cmds // appleSourcePackages // chooseLibs // {
|
||||
# As the name says, this is broken, but I don't want to lose it since it's a direction we want to go in
|
||||
# libdispatch-broken = callPackage ../os-specific/darwin/swift-corelibs/libdispatch.nix { };
|
||||
|
||||
libtapi = callPackage ../os-specific/darwin/libtapi {};
|
||||
libtapi = pkgs.libtapi;
|
||||
|
||||
ios-deploy = callPackage ../os-specific/darwin/ios-deploy {};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user