Merge pull request #147453 from reckenrode/libresolv-hack

libresolv: fix build on aarch64-darwin
This commit is contained in:
Domen Kožar 2022-01-04 15:16:06 +01:00 committed by GitHub
commit 6b1ea4c5bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 8 deletions

View file

@ -1,14 +1,15 @@
{ stdenv, appleDerivation', launchd, bootstrap_cmds, xnu, ppp, IOKit, eap8021x, Security }:
{ lib, stdenv, appleDerivation', launchd, bootstrap_cmds, xnu, ppp, IOKit, eap8021x, Security
, headersOnly ? false }:
appleDerivation' stdenv {
meta.broken = stdenv.cc.nativeLibc;
nativeBuildInputs = [ bootstrap_cmds ];
buildInputs = [ launchd ppp IOKit eap8021x ];
nativeBuildInputs = lib.optionals (!headersOnly) [ bootstrap_cmds ];
buildInputs = lib.optionals (!headersOnly) [ launchd ppp IOKit eap8021x ];
propagatedBuildInputs = [ Security ];
propagatedBuildInputs = lib.optionals (!headersOnly) [ Security ];
patchPhase = ''
patchPhase = lib.optionalString (!headersOnly) ''
HACK=$PWD/hack
mkdir $HACK
cp -r ${xnu}/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/net $HACK
@ -63,6 +64,8 @@ appleDerivation' stdenv {
EOF
'';
dontBuild = headersOnly;
buildPhase = ''
pushd SystemConfiguration.fproj >/dev/null
@ -206,7 +209,7 @@ appleDerivation' stdenv {
installPhase = ''
mkdir -p $out/include
cp dnsinfo/*.h $out/include/
'' + lib.optionalString (!headersOnly) ''
mkdir -p $out/Library/Frameworks/
mv SystemConfiguration.fproj/SystemConfiguration.framework $out/Library/Frameworks
'';

View file

@ -297,6 +297,12 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // {
top = applePackage "top" "osx-10.11.6" "0i9120rfwapgwdvjbfg0ya143i29s1m8zbddsxh39pdc59xnsg5l" {};
PowerManagement = applePackage "PowerManagement" "osx-10.11.6" "1llimhvp0gjffd47322lnjq7cqwinx0c5z7ikli04ad5srpa68mh" {};
# `configdHeaders` cant use an override because `pkgs.darwin.configd` on aarch64-darwin will
# be replaced by SystemConfiguration.framework from the macOS SDK.
configdHeaders = applePackage "configd" "osx-10.8.5" "1gxakahk8gallf16xmhxhprdxkh3prrmzxnmxfvj0slr0939mmr2" {
headersOnly = true;
Security = null;
};
libutilHeaders = pkgs.darwin.libutil.override { headersOnly = true; };
hfsHeaders = pkgs.darwin.hfs.override { headersOnly = true; };
libresolvHeaders= pkgs.darwin.libresolv.override { headersOnly = true; };

View file

@ -1,9 +1,9 @@
{ lib, appleDerivation', stdenv, stdenvNoCC, Libinfo, configd, mDNSResponder
{ lib, appleDerivation', stdenv, stdenvNoCC, Libinfo, configdHeaders, mDNSResponder
, headersOnly ? false
}:
appleDerivation' (if headersOnly then stdenvNoCC else stdenv) {
buildInputs = lib.optionals (!headersOnly) [ Libinfo configd mDNSResponder ];
buildInputs = lib.optionals (!headersOnly) [ Libinfo configdHeaders mDNSResponder ];
buildPhase = lib.optionalString (!headersOnly) ''
$CC -I. -c dns_util.c