diff --git a/pkgs/by-name/cc/cctools/0003-Fix-utimensat-compatability-with-the-10.12-SDK.patch b/pkgs/by-name/cc/cctools/0003-Fix-utimensat-compatability-with-the-10.12-SDK.patch deleted file mode 100644 index 4abe9ee863aa..000000000000 --- a/pkgs/by-name/cc/cctools/0003-Fix-utimensat-compatability-with-the-10.12-SDK.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 989ba5e30cefa0dd8990da158661713c4a21c0fe Mon Sep 17 00:00:00 2001 -From: Randy Eckenrode -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 -+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 - diff --git a/pkgs/by-name/cc/cctools/meson.build b/pkgs/by-name/cc/cctools/meson.build index c2261d98c958..bfb4f06285d7 100644 --- a/pkgs/by-name/cc/cctools/meson.build +++ b/pkgs/by-name/cc/cctools/meson.build @@ -28,26 +28,11 @@ target_prefix = get_option('target_prefix') # Dependencies cc = meson.get_compiler('c') +libcxx = cc.find_library('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 -#include -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 @@ -454,6 +439,7 @@ install_man('man/nmedit.1') otool = executable( f'@target_prefix@otool', c_args : ['-DEFI_SUPPORT'], + dependencies : [libcxx], include_directories : incdirs, install : true, link_with : [libstuff], @@ -553,7 +539,7 @@ install_man('man/strings.1') strip = executable( f'@target_prefix@strip', c_args : ['-DTRIE_SUPPORT'], - dependencies : [libcodedirectory, libprunetrie], + dependencies : [libcxx, libcodedirectory, libprunetrie], include_directories : incdirs, install : true, link_with : [libstuff], diff --git a/pkgs/by-name/cc/cctools/package.nix b/pkgs/by-name/cc/cctools/package.nix index 0368a3c4a985..be2e3898cf75 100644 --- a/pkgs/by-name/cc/cctools/package.nix +++ b/pkgs/by-name/cc/cctools/package.nix @@ -5,7 +5,6 @@ buildPackages, ld64, llvm, - memstreamHook, meson, ninja, openssl, @@ -73,9 +72,6 @@ stdenv.mkDerivation (finalAttrs: { ./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 @@ -102,9 +98,6 @@ stdenv.mkDerivation (finalAttrs: { 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 \ @@ -130,7 +123,7 @@ stdenv.mkDerivation (finalAttrs: { buildInputs = [ ld64 llvm - ] ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [ memstreamHook ]; + ]; mesonBuildType = "release";