darwin.libresolv: update build for the 14.4 SDK

This commit is contained in:
Randy Eckenrode
2025-10-09 18:23:28 -04:00
parent c8a5838007
commit 006f7e4234
2 changed files with 33 additions and 9 deletions
@@ -3,6 +3,12 @@
# Project settings
project('libresolv', 'c', version : '@version@')
add_project_arguments(
'-DCOMMON_DIGEST_FOR_RFC_1321', # To enable legacy `MD5` APIs in CommonCrypto.
# This is not defined automatically by Clang. Not having them defined causes compilation failures.
'-DTARGET_OS_BRIDGE=0',
language : 'c',
)
# Dependencies
@@ -46,10 +52,12 @@ libresolv = library(
soversion : '9'
)
install_headers(
'arpa/nameser_compat.h',
'dns.h',
'dns_util.h',
'nameser.h',
'resolv.h',
preserve_path : true,
)
install_man(
'resolver.3',
@@ -2,14 +2,31 @@
lib,
apple-sdk,
mkAppleDerivation,
stdenvNoCC,
}:
let
configd = apple-sdk.sourceRelease "configd";
dyld = apple-sdk.sourceRelease "dyld";
Libinfo = apple-sdk.sourceRelease "Libinfo";
Libnotify = apple-sdk.sourceRelease "Libnotify";
xnu = apple-sdk.sourceRelease "xnu";
# `arpa/nameser_compat.h` is included in the Libc source release instead of libresolv.
Libc = apple-sdk.sourceRelease "Libc";
privateHeaders = stdenvNoCC.mkDerivation {
name = "libresolv-deps-private-headers";
buildCommand = ''
install -D -t "$out/include/mach-o" \
'${dyld}/include/mach-o/dyld_priv.h'
substituteInPlace "$out/include/mach-o/dyld_priv.h" \
--replace-fail ', bridgeos(3.0)' "" \
--replace-fail '//@VERSION_DEFS@' 'const dyld_build_version_t dyld_2024_SU_E_os_versions = { 1 /* macOS */, 150400 };'
'';
};
in
mkAppleDerivation {
releaseName = "libresolv";
@@ -20,19 +37,18 @@ mkAppleDerivation {
"man"
];
xcodeHash = "sha256-yHNa6cpI3T4R/iakeHmL6S/c9p+VpYR4fudv2UXUpnY=";
postUnpack = ''
mkdir -p "$sourceRoot/arpa"
ln -s "$NIX_BUILD_TOP/$sourceRoot/nameser.h" "$sourceRoot/arpa/nameser.h"
postPatch = ''
mkdir arpa
cp ${Libc}/include/arpa/nameser_compat.h arpa/nameser_compat.h
cp nameser.h arpa
'';
env.NIX_CFLAGS_COMPILE = "-I${configd}/dnsinfo -I${Libinfo}/lookup.subproj";
xcodeHash = "sha256-yHNa6cpI3T4R/iakeHmL6S/c9p+VpYR4fudv2UXUpnY=";
env.NIX_CFLAGS_COMPILE = "-I${privateHeaders}/include -I${configd}/dnsinfo -I${Libinfo}/lookup.subproj -I${Libnotify}";
postInstall = ''
mkdir -p "$out/include/arpa"
ln -s ../nameser.h "$out/include/arpa"
cp ${Libc}/include/arpa/nameser_compat.h "$out/include/arpa"
ln -s ../nameser.h "''${!outputDev}/include/arpa"
'';
meta = {