darwin.apple-source-releases: 15.2 -> 15.6 (#454402)

This commit is contained in:
Emily
2025-10-25 02:57:43 +00:00
committed by GitHub
24 changed files with 288 additions and 173 deletions
@@ -4,6 +4,7 @@
buildPackages,
mkAppleDerivation,
unifdef,
bashNonInteractive,
}:
let
@@ -19,6 +20,7 @@ mkAppleDerivation (finalAttrs: {
./patches/0001-Support-setting-an-upper-bound-on-versions.patch
];
buildInputs = [ bashNonInteractive ];
nativeBuildInputs = [ unifdef ];
buildPhase = ''
@@ -63,6 +65,7 @@ mkAppleDerivation (finalAttrs: {
Availability.h
AvailabilityInternal.h
AvailabilityInternalLegacy.h
AvailabilityInternalPrivate.h
AvailabilityMacros.h
AvailabilityVersions.h
os/availability.h
@@ -189,10 +189,10 @@ index 8ebd250..5bb9edb 100755
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")
@@ -327,9 +352,9 @@ static const std::array<VersionSetEntry, {}> sVersionMap = {{{{
output.write(f"#endif /* defined(__has_feature) && defined(__has_attribute) */\n")
def AVAILABILITY_MACRO_IMPL(self, output, prefix, dispatcher, **optionals):
av_version_hash = zlib.adler32(avVersion.encode()) # This does not need to cryptographically secure as it is meant to detect accidental failures
- count = len(versions.platforms())
- for platformString in versions.platforms():
- platform = versions.platforms()[platformString]
@@ -241,4 +241,3 @@ index 8ebd250..5bb9edb 100755
if getattr(args, platform, None):
--
2.45.2
@@ -3,8 +3,10 @@
bootstrapStdenv,
buildPackages,
fetchpatch2,
icu76, # The ICU version should correspond to the same one used by Apples ICU package
mkAppleDerivation,
python3,
stdenvNoCC,
testers,
}:
@@ -12,6 +14,19 @@
# - ../../../development/libraries/icu/make-icu.nix
# - https://github.com/apple-oss-distributions/ICU/blob/main/makefile
let
privateHeaders = stdenvNoCC.mkDerivation {
name = "ICU-deps-private-headers";
buildCommand = ''
mkdir -p "$out/include/os"
cat <<EOF > "$out/include/os/feature_private.h"
#pragma once
extern "C" bool _os_feature_enabled_impl(const char*, const char*);
#define os_feature_enabled(a, b) _os_feature_enabled_impl(#a, #b)
EOF
'';
};
stdenv = bootstrapStdenv;
withStatic = stdenv.hostPlatform.isStatic;
@@ -26,13 +41,6 @@ let
patches = [
# Skip MessageFormatTest test, which is known to crash sometimes and should be suppressed if it does.
./patches/suppress-icu-check-crash.patch
# Python 3.13 compatibility
(fetchpatch2 {
url = "https://github.com/unicode-org/icu/commit/60d6bd71efc0cde8f861b109ff87dbbf9fc96586.patch?full_index=1";
hash = "sha256-aJBSVvKidPUjD956jLjyRk8fewUZ9f+Ip4ka6rjevzU=";
stripLen = 2;
})
];
preConfigure = ''
@@ -67,6 +75,7 @@ let
env.NIX_CFLAGS_COMPILE = toString [
"-DU_SHOW_CPLUSPLUS_API=1"
"-DU_SHOW_INTERNAL_API=1"
"-I${privateHeaders}/include"
];
passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
@@ -93,24 +102,38 @@ let
++ lib.optional withStatic "static";
outputBin = "dev";
postPatch = lib.optionalString self.finalPackage.doCheck ''
# Skip test for missing encodingSamples data.
substituteInPlace test/cintltst/ucsdetst.c \
--replace-fail "&TestMailFilterCSS" "NULL"
postPatch =
lib.optionalString self.finalPackage.doCheck (
''
# Skip test for missing encodingSamples data.
substituteInPlace test/cintltst/ucsdetst.c \
--replace-fail "&TestMailFilterCSS" "NULL"
# Disable failing tests
substituteInPlace test/cintltst/cloctst.c \
--replace-fail 'TESTCASE(TestCanonicalForm);' ""
# Disable failing tests
substituteInPlace test/cintltst/cloctst.c \
--replace-fail 'TESTCASE(TestCanonicalForm);' ""
substituteInPlace test/intltest/rbbitst.cpp \
--replace-fail 'TESTCASE_AUTO(TestExternalBreakEngineWithFakeYue);' ""
substituteInPlace test/intltest/rbbitst.cpp \
--replace-fail 'TESTCASE_AUTO(TestExternalBreakEngineWithFakeYue);' ""
# Otherwise `make install` is broken.
substituteInPlace Makefile.in \
--replace-fail '$(top_srcdir)/../LICENSE' "$NIX_BUILD_TOP/source/icu/LICENSE"
substituteInPlace config/dist-data.sh \
--replace-fail "\''${top_srcdir}/../LICENSE" "$NIX_BUILD_TOP/source/icu/LICENSE"
'';
# Add missing test data. Its not included in the source release.
chmod u+w "$NIX_BUILD_TOP/source/icu"
tar -C "$NIX_BUILD_TOP/source" -axf ${lib.escapeShellArg icu76.src} icu/testdata
''
+ lib.optionalString stdenv.hostPlatform.isx86_64 ''
# These tests fail under Rosetta 2 with a floating-point exception.
substituteInPlace test/intltest/caltest.cpp \
--replace-fail 'TESTCASE_AUTO(Test22633RollTwiceGetTimeOverflow);' "" \
--replace-fail 'TESTCASE_AUTO(Test22750Roll);' ""
''
)
+ ''
# Otherwise `make install` is broken.
substituteInPlace Makefile.in \
--replace-fail '$(top_srcdir)/../LICENSE' "$NIX_BUILD_TOP/source/icu/LICENSE"
substituteInPlace config/dist-data.sh \
--replace-fail "\''${top_srcdir}/../LICENSE" "$NIX_BUILD_TOP/source/icu/LICENSE"
'';
# remove dependency on bootstrap-tools in early stdenv build
postInstall =
@@ -21,7 +21,7 @@ in
mkAppleDerivation {
releaseName = "PowerManagement";
xcodeHash = "sha256-l6lm8aaiJg4H2BQVCjlFldpfhnmPAlsiMK7Cghzuh1E=";
xcodeHash = "sha256-cjTF4dR6S55mLwp4GkQhkkNk9sMMKDc/5JTm46Z7/KE=";
env.NIX_CFLAGS_COMPILE = "-I${privateHeaders}/include";
@@ -38,7 +38,7 @@ mkAppleDerivation {
"man"
];
xcodeHash = "sha256-2p/JyMPw6acHphvzkaJXPXGwxCUEoxryCejww5kPHvQ=";
xcodeHash = "sha256-QhkylTnnCy4qG8fpUMlKqDGKz58jysL0YF4lFGJzPzE=";
postPatch = ''
# Meson generators require using @BASENAME@ in the output.
@@ -1,11 +1,28 @@
{
lib,
apple-sdk,
mkAppleDerivation,
pkg-config,
shell_cmds,
stdenvNoCC,
zlib,
}:
let
xnu = apple-sdk.sourceRelease "xnu";
privateHeaders = stdenvNoCC.mkDerivation {
name = "doc_cmds-deps-private-headers";
buildCommand = ''
install -D -m644 -t "$out/include/System/sys" \
'${xnu}/bsd/sys/codesign.h'
install -D -m644 -t "$out/include/kern" \
'${xnu}/osfmk/kern/cs_blobs.h'
'';
};
in
mkAppleDerivation {
releaseName = "doc_cmds";
@@ -14,11 +31,13 @@ mkAppleDerivation {
"man"
];
xcodeHash = "sha256-7/ADsfXTKqQhgratg2Twj7JgfFV0/U9rEvtsnX+NFPw=";
xcodeHash = "sha256-Nt6yHx3K8OkrdSWuX9s+JJIkeA5S6HDBAtTtrEjbk4w=";
nativeBuildInputs = [ pkg-config ];
buildInputs = [ zlib ];
env.NIX_CFLAGS_COMPILE = "-I${privateHeaders}/include";
postInstall = ''
HOST_PATH='${lib.getBin shell_cmds}/bin' patchShebangs --host "$out/libexec"
'';
@@ -40,6 +40,7 @@ common_inc = [
'dyld',
'include',
'mach_o',
'include/mach-o',
]
@@ -86,6 +87,79 @@ lsl_dep = declare_dependency(
link_with : lsl,
)
libmach_o = static_library(
'mach_o',
dependencies : [ lsl_dep ],
include_directories : [
common_inc,
'mach_o',
],
sources : [
'mach_o/Architecture.cpp',
'mach_o/Archive.cpp',
'mach_o/BindOpcodes.cpp',
'mach_o/ChainedFixups.cpp',
'mach_o/CompactUnwind.cpp',
'mach_o/DataInCode.cpp',
'mach_o/DwarfDebug.cpp',
'mach_o/Error.cpp',
'mach_o/ExportsTrie.cpp',
'mach_o/Fixups.cpp',
'mach_o/FunctionStarts.cpp',
'mach_o/FunctionVariants.cpp',
'mach_o/GradedArchitectures.cpp',
'mach_o/Header.cpp',
'mach_o/Image.cpp',
'mach_o/Instructions.cpp',
# 'mach_o/LinkerOptimizationHints.cpp',
'mach_o/LoggingStub.cpp',
'mach_o/Misc.cpp',
'mach_o/NListSymbolTable.cpp',
'mach_o/ObjC.cpp',
'mach_o/Platform.cpp',
'mach_o/Policy.cpp',
'mach_o/RebaseOpcodes.cpp',
'mach_o/SplitSeg.cpp',
'mach_o/Symbol.cpp',
'mach_o/Universal.cpp',
'mach_o/Version32.cpp',
'mach_o/Version64.cpp',
],
)
libmach_o_dep = declare_dependency(
include_directories : [ 'mach_o' ],
link_with : libmach_o,
)
libmach_o_writer = static_library(
'mach_o_writer',
dependencies : [ lsl_dep ],
include_directories : [
common_inc,
'mach_o_writer',
],
sources : [
'mach_o_writer/ArchiveWriter.cpp',
'mach_o_writer/BindOpcodesWriter.cpp',
'mach_o_writer/ChainedFixupsWriter.cpp',
'mach_o_writer/ChunkBumpAllocator.cpp',
'mach_o_writer/CompactUnwindWriter.cpp',
'mach_o_writer/DataInCodeWriter.cpp',
'mach_o_writer/ExportsTrieWriter.cpp',
'mach_o_writer/FunctionStartsWriter.cpp',
'mach_o_writer/FunctionVariantsWriter.cpp',
'mach_o_writer/HeaderWriter.cpp',
'mach_o_writer/LinkerOptimizationHintsWriter.cpp',
'mach_o_writer/NListSymbolTableWriter.cpp',
'mach_o_writer/RebaseOpcodesWriter.cpp',
'mach_o_writer/SplitSegWriter.cpp',
'mach_o_writer/UniversalWriter.cpp',
],
)
libmach_o_writer_dep = declare_dependency(
include_directories : [ 'mach_o_writer' ],
link_with : libmach_o_writer,
)
# These files need to be built with `BUILDING_LIBDYLD` not `BUILDING_DYLDINFO`.
# `dyld_info` cant just link against `libdyld` because the symbols it needs are not publicly exported.
@@ -110,15 +184,17 @@ libminidyld = static_library(
'common/MachOLayout.cpp',
'common/MachOLoaded.cpp',
'libdyld/CrashReporterAnnotations.c',
'mach_o/ChainedFixups.cpp',
'mach_o/GradedArchitectures.cpp',
],
)
libdsc_extractor = shared_library(
'dsc_extractor',
cpp_args : [ '-DBUILDING_SHARED_CACHE_EXTRACTOR=1' ],
dependencies : [ corecrypto_dep, lsl_dep ],
dependencies : [
corecrypto_dep,
libmach_o_dep,
lsl_dep
],
include_directories : [
common_inc,
'cache-builder',
@@ -132,6 +208,7 @@ libdsc_extractor = shared_library(
sources : [
'common/DyldSharedCache.cpp',
'common/MachOFile.cpp',
'common/TargetPolicy.cpp',
'other-tools/dsc_extractor.cpp',
'other-tools/dsc_iterator.cpp',
'common/MachOLayout.cpp',
@@ -156,6 +233,7 @@ executable(
],
dependencies : [
corecrypto_dep,
libmach_o_dep,
llvm_dep,
lsl_dep,
],
@@ -175,31 +253,10 @@ executable(
'common/MachOFile.cpp',
'common/MetadataVisitor.cpp',
'common/SwiftVisitor.cpp',
'mach_o/Architecture.cpp',
'mach_o/Archive.cpp',
'mach_o/BindOpcodes.cpp',
'mach_o/ChainedFixups.cpp',
'mach_o/CompactUnwind.cpp',
'mach_o/Error.cpp',
'mach_o/ExportsTrie.cpp',
'mach_o/Fixups.cpp',
'mach_o/FunctionStarts.cpp',
'mach_o/Header.cpp',
'mach_o/Image.cpp',
'mach_o/Instructions.cpp',
'mach_o/LoggingStub.cpp',
'mach_o/Misc.cpp',
'mach_o/NListSymbolTable.cpp',
'mach_o/ObjC.cpp',
'mach_o/Platform.cpp',
'mach_o/Policy.cpp',
'mach_o/RebaseOpcodes.cpp',
'mach_o/SplitSeg.cpp',
'mach_o/Symbol.cpp',
'mach_o/Universal.cpp',
'mach_o/Version32.cpp',
'mach_o/Version64.cpp',
'common/TargetPolicy.cpp',
'other-tools/dyld_info.cpp',
'other-tools/MiscFileUtils.cpp',
'other-tools/SymbolicatedImage.cpp',
],
)
install_man('doc/man/man1/dyld_info.1')
@@ -44,7 +44,8 @@ let
install -D -m644 -t "$out/include/System" \
'${Libc}/stdlib/FreeBSD/atexit.h'
mkdir -p "$out/include/System/sys"
install -D -m644 -t "$out/include/System/sys" \
'${xnu}/bsd/sys/csr.h'
substitute '${xnu}/bsd/sys/fsgetpath.h' "$out/include/System/sys/fsgetpath.h" \
--replace-fail '#ifdef __APPLE_API_PRIVATE' '#if 1'
@@ -92,13 +93,11 @@ mkAppleDerivation {
propagatedBuildOutputs = [ ];
xcodeHash = "sha256-NfaENSF699xjc+eKtOm1RyXUCMD6xTaJ5+9arLllqyw=";
xcodeHash = "sha256-4yOJouk9AjEt7W3+0cQRMUDDqBhU+J9c16ZQSzUF5go=";
patches = [
# Disable use of private kdebug API
./patches/0001-Disable-kdebug-trace.patch
# dyld_info requires `startsWith`, but its not normally built for `dyld_info`.
./patches/0002-Provide-startsWith-for-dyld_info.patch
# dyld_info tries to weakly link against libLTO using this macro.
./patches/0003-Add-weaklinking_h.patch
# The LLVMOpInfoCallback args comment out one of the args. Fix that for compatibility with nixpkgs LLVM.
@@ -109,6 +108,9 @@ mkAppleDerivation {
# `dsc_extractor` builds a dylib, but it includes a program that can perform cache extraction.
# This extracts just the driver into a file to make building the actual program easier.
./patches/0006-Add-dsc_extractor_bin_cpp.patch
# Fix missing symbol for `mach_o::ChainedFixups::PointerFormat::writeChainEntry`,
# which isnt actually needed by `dyld_info` or `dsc_extractor`.
./patches/0007-Fix-missing-writeChainEntry.patch
];
postPatch = ''
@@ -144,6 +146,9 @@ mkAppleDerivation {
substituteInPlace dyld/Loader.h \
--replace-fail 'dyld_priv.h' 'mach-o/dyld_priv.h'
substituteInPlace common/DyldSharedCache.h \
--replace-fail 'dyld_cache_format.h' 'mach-o/dyld_cache_format.h'
# Remove unused header include (since the compat shims dont provide it).
substituteInPlace other-tools/dsc_extractor.cpp \
--replace-fail '#include <CommonCrypto/CommonHMAC.h>' ""
@@ -1,20 +0,0 @@
diff --git a/common/MachOFile.cpp b/common/MachOFile.cpp
index 3e7b95bcfe..265ae7c475 100644
--- a/common/MachOFile.cpp
+++ b/common/MachOFile.cpp
@@ -2493,7 +2493,14 @@
}
#endif // BUILDING_APP_CACHE_UTIL || BUILDING_DYLDINFO
-#if BUILDING_CACHE_BUILDER || BUILDING_CACHE_BUILDER_UNIT_TESTS
+#if BUILDING_DYLDINFO || BUILDING_CACHE_BUILDER || BUILDING_CACHE_BUILDER_UNIT_TESTS
+
+#if BUILDING_DYLDINFO
+static bool startsWith(const char* buffer, const char* valueToFind) {
+ return strncmp(buffer, valueToFind, strlen(valueToFind)) == 0;
+}
+#endif
+
static bool platformExcludesPrebuiltClosure_macOS(const char* path) {
// We no longer support ROSP, so skip all paths which start with the special prefix
if ( startsWith(path, "/System/Library/Templates/Data/") )
@@ -1,7 +1,7 @@
diff --git a/other-tools/dyld_info.cpp b/other-tools/dyld_info.cpp
index 2de4978ba5..2ce27257d9 100644
--- a/other-tools/dyld_info.cpp
+++ b/other-tools/dyld_info.cpp
--- a/other-tools/SymbolicatedImage.cpp
+++ b/other-tools/SymbolicatedImage.cpp
@@ -991,7 +991,7 @@
return ((SymbolicatedImage*)di)->lookupSymbol(referencePC, referenceValue, *referenceType, *referenceName);
}
@@ -0,0 +1,13 @@
diff --git a/mach_o/ChainedFixups.h b/mach_o/ChainedFixups.h
index 10ff8847e0..336f80dd81 100644
--- a/mach_o/ChainedFixups.h
+++ b/mach_o/ChainedFixups.h
@@ -78,7 +78,7 @@
std::span<const uint64_t> segOffsetTable, uint32_t pageIndex, uint32_t pageSize,
void (^callback)(const Fixup& f, bool& stop)) const;
virtual Fixup parseChainEntry(const void* loc, const MappedSegment* seg, uint64_t preferedLoadAddress=0, std::span<const uint64_t> segOffsetTable={}) const = 0;
- virtual void writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const;
+ virtual void writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const = 0;
protected:
constexpr PointerFormat() { }
@@ -91,7 +91,7 @@ mkAppleDerivation {
"xattr"
];
xcodeHash = "sha256-u23AoLa7J0eFtf4dXKkVO59eYL2I3kRsHcWPfT03MCU=";
xcodeHash = "sha256-KEZYuaDxLdprF+wGiszUdTXPQBfLNj0xP9Y0uarNjSs=";
patches = [
# Fixes build of ls
@@ -23,8 +23,6 @@ mkAppleDerivation (finalAttrs: {
];
patches = [
# Clang 18 requires that no non-private symbols by defined after cfi_startproc. Apply the upstream libffi fix.
./patches/llvm-18-compatibility.patch
# Fix a memory leak when using the trampoline dylib. See https://github.com/libffi/libffi/pull/621#discussion_r955298301.
./patches/fix-tramponline-memory-leak.patch
# Fix automake-18.18 compatibility, https://github.com/libffi/libffi/issues/853#issuecomment-2909994482
@@ -1,34 +0,0 @@
diff --git a/src/aarch64/sysv.S b/src/aarch64/sysv.S
index eeaf3f8..329889c 100644
--- a/src/aarch64/sysv.S
+++ b/src/aarch64/sysv.S
@@ -76,8 +76,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
x5 closure
*/
- cfi_startproc
CNAME(ffi_call_SYSV):
+ cfi_startproc
/* Sign the lr with x1 since that is where it will be stored */
SIGN_LR_WITH_REG(x1)
@@ -268,8 +268,8 @@ CNAME(ffi_closure_SYSV_V):
#endif
.align 4
- cfi_startproc
CNAME(ffi_closure_SYSV):
+ cfi_startproc
SIGN_LR
stp x29, x30, [sp, #-ffi_closure_SYSV_FS]!
cfi_adjust_cfa_offset (ffi_closure_SYSV_FS)
@@ -500,8 +500,8 @@ CNAME(ffi_go_closure_SYSV_V):
#endif
.align 4
- cfi_startproc
CNAME(ffi_go_closure_SYSV):
+ cfi_startproc
stp x29, x30, [sp, #-ffi_closure_SYSV_FS]!
cfi_adjust_cfa_offset (ffi_closure_SYSV_FS)
cfi_rel_offset (x29, 0)
@@ -26,8 +26,8 @@ libresolv = library(
'dns_async.c',
'dns_util.c',
'dst_api.c',
'dst_hmac_link.c',
'dst_support.c',
'hmac_link.c',
'mtctxres.c',
'ns_date.c',
'ns_name.c',
'ns_netint.c',
@@ -47,7 +47,9 @@ libresolv = library(
'res_query.c',
'res_send.c',
'res_sendsigned.c',
'res_state.c',
'res_update.c',
'support.c',
],
soversion : '9'
)
@@ -38,12 +38,14 @@ mkAppleDerivation {
];
postPatch = ''
mkdir arpa
cp ${Libc}/include/arpa/nameser_compat.h arpa/nameser_compat.h
cp nameser.h arpa
# Use CommonCryptos implementation of MD5. The upstream build appears to use corecrypto, which we cant use.
substituteInPlace hmac_link.c \
--replace-fail '<md5.h>' '<CommonCrypto/CommonDigest.h>'
'';
xcodeHash = "sha256-yHNa6cpI3T4R/iakeHmL6S/c9p+VpYR4fudv2UXUpnY=";
xcodeHash = "sha256-Q5jHee9rxge6HJtf9/sFK15FsS02GQmx7L0BBDiyGIs=";
env.NIX_CFLAGS_COMPILE = "-I${privateHeaders}/include -I${configd}/dnsinfo -I${Libinfo}/lookup.subproj -I${Libnotify}";
@@ -123,6 +123,7 @@ let
#pragma once
#include_next <net/route.h>
$(sed -n \
-e '/^#define RTM_/p' \
-e '/^struct rt_msghdr_ext\s*{/,/^};/p' \
-e '/^struct rt_reach_info\s*{/,/^};/p' \
-e '/^struct rtstat_64\s*{/,/^};/p' \
@@ -294,9 +295,11 @@ let
-e '/^#define SIOCGIFAGENTDATA\s/p' \
-e '/^#define SIOCGIFAGENTIDS\s/p' \
-e '/^#define SIOCGIFCLAT46ADDR\s/p' \
-e '/^#define SIOCGIFCONSTRAINED\s/p' \
-e '/^#define SIOCGIFDELEGATE\s/p' \
-e '/^#define SIOCGIFDESC\s/p' \
-e '/^#define SIOCGIFEFLAGS\s/p' \
-e '/^#define SIOCGIFGENERATIONID\s/p' \
-e '/^#define SIOCGIFGETRTREFCNT\s/p' \
-e '/^#define SIOCGIFINTERFACESTATE\s/p' \
-e '/^#define SIOCGIFLINKPARAMS\s/p' \
@@ -321,6 +324,7 @@ let
-e '/^#define SIOCSIF2KCL\s/p' \
-e '/^#define SIOCSIFCONSTRAINED\s/p' \
-e '/^#define SIOCSIFDESC\s/p' \
-e '/^#define SIOCSIFDISABLEINPUT\s/p' \
-e '/^#define SIOCSIFDISABLEOUTPUT\s/p' \
-e '/^#define SIOCSIFEXPENSIVE\s/p' \
-e '/^#define SIOCSIFINTERFACESTATE\s/p' \
@@ -331,7 +335,6 @@ let
-e '/^#define SIOCSIFMPKLOG\s/p' \
-e '/^#define SIOCSIFNOACKPRIO\s/p' \
-e '/^#define SIOCSIFNOTRAFFICSHAPING\s/p' \
-e '/^#define SIOCSIFDISABLEINPUT\s/p' \
-e '/^#define SIOCSIFPROBECONNECTIVITY\s/p' \
-e '/^#define SIOCSIFSUBFAMILY\s/p' \
-e '/^#define SIOCSIFTHROTTLE\s/p' \
@@ -343,6 +346,7 @@ let
#undef ifreq
#include_next <sys/sockio.h>
EOF
ln -s "$out/include/sys/sockio.h" "$out/include/sys/sockio_private.h"
cat <<EOF > "$out/include/sys/sys_domain.h"
#pragma once
@@ -385,7 +389,7 @@ mkAppleDerivation {
"man"
];
xcodeHash = "sha256-HkcIvKB4ektuk+3J/Sque8Pr5dMeNFZRlENuiu3KdsA=";
xcodeHash = "sha256-1RJ/s9vnfCGY2Vc2XH8dg8rB+0lwK2IBC7zIx4PuXWQ=";
patches = [
# Some private headers depend on corecrypto, which we cant use.
@@ -14,7 +14,7 @@ mkAppleDerivation {
"man"
];
xcodeHash = "sha256-FLCJY40l74ExO0WTaA8hb9guhOBXeui2GqWL/7QeJJk=";
xcodeHash = "sha256-Ox8Ii2sUuledUttZ64DaHC0iFlUybs3lNZ23IDeziPM=";
nativeBuildInputs = [ pkg-config ];
@@ -37,7 +37,7 @@ mkAppleDerivation {
"man"
];
xcodeHash = "sha256-pE92mVI0KTHOVKBA4T5R1rHy5//uipOimas7DaTVe0U=";
xcodeHash = "sha256-7dNq0nE2MmFM9U+epTrkCoM1lrswm98m3RWuLDsAuDk=";
env.NIX_CFLAGS_COMPILE = "-I${privateHeaders}/include";
@@ -24,7 +24,7 @@ mkAppleDerivation {
"man"
];
xcodeHash = "sha256-26N7AZV/G+ryc2Nu1v91rEdb1a6jDpnj6t5rzEG2YA4=";
xcodeHash = "sha256-fY8k7qzqqiv/KvGIB4a82qbNsm23QPnGOadrZmNoi54=";
postPatch = ''
# Fix `mktemp` templates
@@ -1,6 +1,8 @@
{
lib,
AvailabilityVersions,
apple-sdk,
apple-sdk_15,
libutil,
mkAppleDerivation,
ncurses,
@@ -18,12 +20,15 @@ let
OpenDirectory = apple-sdk.sourceRelease "OpenDirectory";
libplatform = apple-sdk.sourceRelease "libplatform";
xnu = apple-sdk.sourceRelease "xnu";
xnu = apple-sdk_15.sourceRelease "xnu"; # Needed for `posix_spawn_secflag_options`
privateHeaders = stdenvNoCC.mkDerivation {
name = "system_cmds-deps-private-headers";
buildCommand = ''
mkdir -p "$out/include/sys"
'${lib.getExe AvailabilityVersions}' ${lib.getVersion apple-sdk} "$out"
install -D -t "$out/include/CFOpenDirectory" \
'${OpenDirectory}/Core/CFOpenDirectoryPriv.h' \
'${OpenDirectory}/Core/CFODTrigger.h'
@@ -105,6 +110,12 @@ mkAppleDerivation {
xcodeHash = "sha256-gdtn3zNIneZKy6+X0mQ51CFVLNM6JQYLbd/lotG5/Tw=";
patches = [
# `posix_spawnattr_set_use_sec_transition_shims_np` is only available on macOS 15.2 or newer.
# Disable the feature that requires it when running on older systems.
./patches/conditionalize-security-transition-shims.patch
];
postPatch = ''
# Replace hard-coded, impure system paths with the output path in the store.
sed -e "s|PATH=[^;]*|PATH='$out/bin'|" -i "pagesize/pagesize.sh"
@@ -0,0 +1,33 @@
diff --git a/taskpolicy/taskpolicy.c b/taskpolicy/taskpolicy.c
index b031f944b2..4ad82018ed 100644
--- a/taskpolicy/taskpolicy.c
+++ b/taskpolicy/taskpolicy.c
@@ -126,7 +126,12 @@
flag_s = true;
break;
case 'S':
- sec_transition_shims = parse_sec_transition_shims(optarg);
+ if (__builtin_available(macOS 15.2, *)) {
+ sec_transition_shims = parse_sec_transition_shims(optarg);
+ } else {
+ fprintf(stderr, "Running with security transition shims is only supported on macOS 15.2 and newer.\n");
+ exit(EX_USAGE);
+ }
break;
case '?':
default:
@@ -246,9 +251,11 @@
if (ret != 0) errc(EX_NOINPUT, ret, "posix_spawnattr_set_darwin_role_np");
}
- if (sec_transition_shims) {
- ret = posix_spawnattr_set_use_sec_transition_shims_np(&attr, sec_transition_shims);
- if (ret != 0) errc(EX_NOINPUT, ret, "setting security transition shims");
+ if (__builtin_available(macOS 15.2, *)) {
+ if (sec_transition_shims) {
+ ret = posix_spawnattr_set_use_sec_transition_shims_np(&attr, sec_transition_shims);
+ if (ret != 0) errc(EX_NOINPUT, ret, "setting security transition shims");
+ }
}
ret = posix_spawnp(&pid, argv[0], NULL, &attr, argv, environ);
@@ -45,7 +45,7 @@ mkAppleDerivation {
"man"
];
xcodeHash = "sha256-dZ+yJyfflhmUyx3gitRXC115QxS87SGC4/HjMa199Ts=";
xcodeHash = "sha256-4nwDGUBSx5jjeLQ3EGQFdPZE2MfNGcBvlTU/Sye6OIk=";
postPatch = ''
# Improve compatiblity with libmd in nixpkgs.
@@ -1,27 +1,27 @@
{
"AvailabilityVersions": {
"hash": "sha256-PT54BPSRkQiIHrpxZCdjo6XvNuWxESabLndCBYjulfs=",
"version": "143.6"
"hash": "sha256-eQ46qHk4AuHA+hRZq1IG2UtvZr/X2vtlOvi6hnG+FyA=",
"version": "151"
},
"Csu": {
"hash": "sha256-l8RI8aiin7ovZuoDh54thDmd/b502w+dtjN5ZoISZBg=",
"version": "88"
},
"ICU": {
"hash": "sha256-7ImBX4SlrFaLnHdQ4bm4F8q9IpHhQMaeVOO6pnnhyzQ=",
"version": "74222.203"
"hash": "sha256-dIgrTjHcQm8dy2Ku5wNIHuPjHfoV+48TM0PNDDn6ZPk=",
"version": "76104.4"
},
"IOKitTools": {
"hash": "sha256-Oknsvzn4nv77WU7f0WPS446iwR2BM2q4iw46r/qctAE=",
"version": "125"
},
"PowerManagement": {
"hash": "sha256-APkvbp0FhNrypQcDUuREUYOnNLOZGOKhsj5JLcDgvAU=",
"version": "1740.60.27"
"hash": "sha256-ssg655SPT7gWnJWDaxambMKCopr+vLPYERW0IMKT0T8=",
"version": "1754.140.4"
},
"adv_cmds": {
"hash": "sha256-alJOcKeHmIh67ZmN7/YdIouCP/qzakkhimsuZaOkr+c=",
"version": "231"
"hash": "sha256-O+SB8sj3yqPv7GEBQQgvq+Y7kQRZI/i/UVa17J/OhZM=",
"version": "235"
},
"basic_cmds": {
"hash": "sha256-RQve2GqS9ke9hd8kupRMgoOKalTS229asi5tBGrBmS8=",
@@ -29,47 +29,47 @@
},
"bootstrap_cmds": {
"hash": "sha256-6JG0sysgqLlgcpIOXfN+F0/gxpIIHZZ5et3gmDBoBGQ=",
"version": "136"
"version": "138"
},
"copyfile": {
"hash": "sha256-Vz1fo4p2b6S8xfyDPu1FNgMkH1aX0tkpXCZkdzkRdq0=",
"version": "213.40.2"
"hash": "sha256-hIHlY0prIFY0j8z0Hvlv2psrwLj41jYfKBM0KutLxew=",
"version": "224"
},
"developer_cmds": {
"hash": "sha256-jgQUjN9zmqi0/7XpqzbRsJjZIYeMrxXT1Zf3qi7+o+8=",
"version": "83"
},
"diskdev_cmds": {
"hash": "sha256-v3TFHLUlumt/sHxkOTyxDA4iG8ci5ZmMn7HCb4+9Uo0=",
"version": "737.60.1"
"hash": "sha256-TD/sJkzIquTgq1zP/B7eBArxeTcp1Lqa8e8cJ1jnkHU=",
"version": "737.140.4"
},
"doc_cmds": {
"hash": "sha256-/Mf+RhaTU9O5i95gddZ2h9eDjLezwj3nP6FvryMF54E=",
"version": "66"
"hash": "sha256-nnwKXKKjgJXcLCArD38Dme2L1WyR1U0rwn7zI+NCftw=",
"version": "69"
},
"dyld": {
"hash": "sha256-DDhV7X81nhd3oeJuICEvF8FU43yE/afQ/LYgDNtXswA=",
"version": "1241.17"
"hash": "sha256-pbpSD5OeSMOcMJFAd7kyLINPROjqsafsCSphVGyIPyg=",
"version": "1286.10"
},
"file_cmds": {
"hash": "sha256-/79jS//IBZiQBumGA60lKDmddQCzl/r8QnviD6lGXNg=",
"version": "448.0.3"
"hash": "sha256-Rf/XA6uEaj7Wps2s8Oc/OhQVBjz8XiqJlj+cxjiQfQU=",
"version": "457.140.3"
},
"libffi": {
"hash": "sha256-YjRMS3H3hIEfQm5MVSxGNTBtFc/9al7iQGDeZy6m/0U=",
"version": "39"
"hash": "sha256-xHefZVsZg9kUXV0t/HLdjPkkD/hn/4bvdRVJ4PsQLeM=",
"version": "40"
},
"libiconv": {
"hash": "sha256-eaUp0z7HqX0AW2C90gDVFeiJnmGRxPDuzyb1Jlm1pNc=",
"version": "109"
"hash": "sha256-50DC6LePtvdAh9FLa/esiwCUmYDxKofN6hCiv9+dmgQ=",
"version": "109.100.2"
},
"libpcap": {
"hash": "sha256-RViIXv5zP2Bcive5qrcfb9vNWwhSe6fGCaToSgDYNxU=",
"version": "137"
"hash": "sha256-DqINoombdui5N6lNHcZ07c7LrVum4f8fFK89ymdCd0c=",
"version": "140"
},
"libresolv": {
"hash": "sha256-ndGcicbHizPazTCB0P3aioDOv7IJPmTOgLnioFHH2+o=",
"version": "83"
"hash": "sha256-GtPVlL1mD58um5hOFd3HQKQ7pqutBe9jZKgQw8pOkPE=",
"version": "91"
},
"libutil": {
"hash": "sha256-tUsl22Z0HUVSkSoohFXkhicNFCW+RARvpTS0q6yaQFk=",
@@ -80,36 +80,36 @@
"version": "38.0.1"
},
"misc_cmds": {
"hash": "sha256-qPqcV9d4mKeu9ZD3rt3p5m1p/NyLy6np19ULC6FmnMI=",
"version": "44"
"hash": "sha256-04uBS16nNrg73Fqh4Obev7nQDjTTlY4f5+pEv3i0FIU=",
"version": "45"
},
"network_cmds": {
"hash": "sha256-aGBsxdYW21QjTILxcR8tHufQKvkvmai9MKOCxBNZvmI=",
"version": "698.60.4"
"hash": "sha256-sfZX6aA8mspfRKARIYFXX+bmlLHDoi485HQOvbRNP1Y=",
"version": "705.100.5"
},
"patch_cmds": {
"hash": "sha256-foIoIMe+zgPISFmE10q4cwEUBhiah4nbD7UtjBumZYU=",
"version": "66"
"hash": "sha256-fDY2NOT3DnU5pm06cHSs+JJcA/EFP8Lxjg7sErUerJ0=",
"version": "72"
},
"remote_cmds": {
"hash": "sha256-a5ELSGJSTlyCb3bPdJqYSX320UzIkS2FiHxSpELIgls=",
"version": "303.0.2"
"hash": "sha256-8c/NgQZ+K6jJ3aoYK78/BsEkM1gmRS+9z0437+SvcCw=",
"version": "306"
},
"removefile": {
"hash": "sha256-h1jb4DcgDHwi9eiUguc2e5OLP8ZHxCN3B4Myp/DFDBg=",
"version": "75"
"hash": "sha256-Z5UD0mk/s80CQB0PZWDzSl2JWXmnVmwUvlNb28+hR3k=",
"version": "81"
},
"shell_cmds": {
"hash": "sha256-bcu9NNS7NW5oc5yrOk+GxZcQo0AP0+mOnph9HhLdRts=",
"version": "319.0.1"
"hash": "sha256-hoMssbZCrmzyJTgEAzOS4L7DhY9z/yXIcvHRhL6W5qc=",
"version": "326"
},
"system_cmds": {
"hash": "sha256-9nNJeVJo4XwGSHh+SJydhVt+I8+Rb5hCsPiFYKQ8/28=",
"version": "1012.60.2"
"hash": "sha256-mEo+v0m+aP42XHHwibGKPkT55JFYLTOD5YT5IYQ8Hr0=",
"version": "1026.140.2"
},
"text_cmds": {
"hash": "sha256-76dagwRcAf5fpoyH5FDR5kdCldv6Mgre6aFBzxaCRkg=",
"version": "190.0.1"
"hash": "sha256-5BBH/v1mJpExz65VDX6oh3dFCz49E+JMqJxkO96Y/xo=",
"version": "195"
},
"top": {
"hash": "sha256-e+k/jE49BMZZ24ge9JCa2ct5f1og6ewWb6U5ZMWdIEc=",