apple_sdk: use multiple outputs

This commit is contained in:
Matthew Bauer 2018-06-08 23:57:36 -04:00
parent 709f52a4e2
commit 06fa867498
8 changed files with 26 additions and 25 deletions

View File

@ -38,7 +38,7 @@ in stdenv.mkDerivation {
'' + stdenv.lib.optionalString stdenv.isDarwin (with darwin; ''
sed -i '/^[[:space:]]*\*x86-darwin\*)$/,/^[[:space:]]*\*) ;;/ c\
\ \*x86-darwin\*)\
\ INCLFILE=${apple_sdk.sdk}/include/unistd.h\
\ INCLFILE=${stdenv.lib.getDev apple_sdk.sdk}/include/unistd.h\
\ ;;\
\ \*) ;;
' base/runtime/config/gen-posix-names.sh

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, xar, xz, cpio, pkgs, python }:
{ stdenv, fetchurl, xar, xz, cpio, pkgs, python, lib }:
let
# TODO: make this available to other packages and generalize the unpacking a bit
@ -27,6 +27,7 @@ let
buildInputs = [ xar xz cpio python ];
phases = [ "unpackPhase" "installPhase" "fixupPhase" ];
outputs = [ "out" "dev" "man" ];
unpackPhase = ''
xar -x -f $src
@ -87,13 +88,13 @@ let
# ApplicationServices in the 10.9 SDK
local isChild
if [ -d "${sdk}/Library/Frameworks/$path/Versions/$current/Headers" ]; then
if [ -d "${sdk.out}/Library/Frameworks/$path/Versions/$current/Headers" ]; then
isChild=1
cp -R "${sdk}/Library/Frameworks/$path/Versions/$current/Headers" .
cp -R "${sdk.out}/Library/Frameworks/$path/Versions/$current/Headers" .
else
isChild=0
current="$(readlink "/System/Library/Frameworks/$name.framework/Versions/Current")"
cp -R "${sdk}/Library/Frameworks/$name.framework/Versions/$current/Headers" .
cp -R "${sdk.out}/Library/Frameworks/$name.framework/Versions/$current/Headers" .
fi
ln -s -L "/System/Library/Frameworks/$path/Versions/$current/$name"
ln -s -L "/System/Library/Frameworks/$path/Versions/$current/Resources"
@ -103,9 +104,9 @@ let
fi
if [ $isChild -eq 1 ]; then
pushd "${sdk}/Library/Frameworks/$path/Versions/$current" >/dev/null
pushd "${sdk.out}/Library/Frameworks/$path/Versions/$current" >/dev/null
else
pushd "${sdk}/Library/Frameworks/$name.framework/Versions/$current" >/dev/null
pushd "${sdk.out}/Library/Frameworks/$name.framework/Versions/$current" >/dev/null
fi
local children=$(echo Frameworks/*.framework)
if [ "$name" == "ApplicationServices" ]; then
@ -159,8 +160,8 @@ in rec {
installPhase = ''
mkdir -p $out/include
pushd $out/include >/dev/null
ln -s "${sdk}/include/xpc"
ln -s "${sdk}/include/launch.h"
ln -s "${lib.getDev sdk}/include/xpc"
ln -s "${lib.getDev sdk}/include/launch.h"
popd >/dev/null
'';
};
@ -178,7 +179,7 @@ in rec {
installPhase = ''
mkdir -p $out/include $out/lib
ln -s "${sdk}/include/Xplugin.h" $out/include/Xplugin.h
ln -s "${lib.getDev sdk}/include/Xplugin.h" $out/include/Xplugin.h
ln -s "/usr/lib/libXplugin.1.dylib" $out/lib/libXplugin.dylib
'';
};
@ -190,8 +191,8 @@ in rec {
installPhase = ''
mkdir -p $out/include
pushd $out/include >/dev/null
ln -s "${sdk}/include/utmp.h"
ln -s "${sdk}/include/utmpx.h"
ln -s "${lib.getDev sdk}/include/utmp.h"
ln -s "${lib.getDev sdk}/include/utmpx.h"
popd >/dev/null
'';
};

View File

@ -13,7 +13,7 @@ appleDerivation {
lib/RawSigner.h lib/MD2Object.h lib/HMACSHA1.h lib/bfContext.h lib/rc4Context.h; do
substituteInPlace ''$file --replace \
'"CoreServices/../Frameworks/CarbonCore.framework/Headers/MacTypes.h"' \
'"${apple_sdk.sdk}/include/MacTypes.h"'
'"${stdenv.lib.getDev apple_sdk.sdk}/include/MacTypes.h"'
done
for file in lib/castContext.h lib/gladmanContext.h lib/desContext.h lib/rc4Context.h; do

View File

@ -25,7 +25,7 @@ appleDerivation {
mkdir -p include/securityd_client
cp Security-*/libsecurityd/lib/*.h include/securityd_client
mkdir -p include/xpc
cp ${apple_sdk.sdk}/include/xpc/*.h include/xpc
cp ${apple_sdk.sdk.out}/include/xpc/*.h include/xpc
sed -i '1i #define bool int' lib/security_codesigning.d
dtrace -h -C -s lib/security_codesigning.d -o codesigning_dtrace.h

View File

@ -1,4 +1,4 @@
{ appleDerivation, apple_sdk, libsecurity_cdsa_plugin, libsecurity_cdsa_utilities, libsecurity_utilities, osx_private_sdk }:
{ appleDerivation, apple_sdk, libsecurity_cdsa_plugin, libsecurity_cdsa_utilities, libsecurity_utilities, osx_private_sdk, lib }:
appleDerivation {
buildInputs = [
libsecurity_utilities
@ -7,7 +7,7 @@ appleDerivation {
];
patchPhase = ''
cp ${osx_private_sdk}/include/sandbox_private.h .
substituteInPlace sandbox_private.h --replace '<sandbox.h>' '"${apple_sdk.sdk}/include/sandbox.h"'
substituteInPlace sandbox_private.h --replace '<sandbox.h>' '"${lib.getDev apple_sdk.sdk}/include/sandbox.h"'
substituteInPlace lib/AtomicFile.cpp --replace '<sandbox.h>' '"sandbox_private.h"'
'';
}

View File

@ -15,13 +15,13 @@ name: version: sha256: args: let
grep -Rl MacErrors.h . | while read file; do
substituteInPlace "''$file" --replace \
'<CoreServices/../Frameworks/CarbonCore.framework/Headers/MacErrors.h>' \
'"${pkgs.darwin.apple_sdk.sdk}/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/MacErrors.h"'
'"${pkgs.darwin.apple_sdk.sdk.out}/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/MacErrors.h"'
done || true # grep returns 1 if it can't find the string
grep -Rl MacTypes.h . | while read file; do
substituteInPlace "''$file" --replace \
'<CoreServices/../Frameworks/CarbonCore.framework/Headers/MacTypes.h>' \
'"${pkgs.darwin.apple_sdk.sdk}/include/MacTypes.h"'
'"${pkgs.darwin.apple_sdk.sdk.out}/include/MacTypes.h"'
done || true # grep returns 1 if it can't find the string
'';
preBuild = ''

View File

@ -1,4 +1,4 @@
{ CF, Security, appleDerivation, apple_sdk, libsecurity_asn1, libsecurity_cdsa_client, libsecurity_cdsa_utilities, libsecurity_cdsa_utils, libsecurity_ocspd, libsecurity_pkcs12, libsecurity_utilities, libsecurityd, openssl, osx_private_sdk, security_dotmac_tp }:
{ CF, Security, appleDerivation, apple_sdk, libsecurity_asn1, libsecurity_cdsa_client, libsecurity_cdsa_utilities, libsecurity_cdsa_utils, libsecurity_ocspd, libsecurity_pkcs12, libsecurity_utilities, libsecurityd, openssl, osx_private_sdk, security_dotmac_tp, lib }:
appleDerivation {
buildInputs = [
libsecurity_utilities
@ -19,7 +19,7 @@ appleDerivation {
substituteInPlace lib/SecCertificate.cpp --replace '#include <Security/SecCertificatePriv.h>' ""
cp ${osx_private_sdk}/include/xpc/private.h xpc
cp ${apple_sdk.sdk}/include/xpc/*.h xpc
cp ${lib.getDev apple_sdk.sdk}/include/xpc/*.h xpc
cp ${osx_private_sdk}/include/sandbox_private.h lib/sandbox.h
substituteInPlace lib/SecItemPriv.h \
@ -29,7 +29,7 @@ appleDerivation {
substituteInPlace lib/Keychains.cpp --replace \
'<CoreServices/../Frameworks/CarbonCore.framework/Headers/MacErrors.h>' \
'"${apple_sdk.sdk}/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/MacErrors.h"'
'"${apple_sdk.sdk.out}/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/MacErrors.h"'
substituteInPlace lib/CertificateValues.cpp --replace \
'#include <Security/SecCertificatePriv.h>' ""
@ -42,6 +42,6 @@ appleDerivation {
substituteInPlace lib/KCEventNotifier.h --replace \
'CoreFoundation/CFNotificationCenter.h' \
'${apple_sdk.sdk}/Library/Frameworks/CoreFoundation.framework/Versions/A/Headers/CFNotificationCenter.h'
'${apple_sdk.sdk.out}/Library/Frameworks/CoreFoundation.framework/Versions/A/Headers/CFNotificationCenter.h'
'';
}

View File

@ -21,10 +21,10 @@ stdenv.mkDerivation rec {
substituteInPlace cmsutil.c --replace \
'<CoreServices/../Frameworks/CarbonCore.framework/Headers/MacErrors.h>' \
'"${apple_sdk.sdk}/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/MacErrors.h"'
'"${apple_sdk.sdk.out}/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/MacErrors.h"'
substituteInPlace createFVMaster.c --replace \
'<CoreServices/../Frameworks/CarbonCore.framework/Headers/MacErrors.h>' \
'"${apple_sdk.sdk}/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/MacErrors.h"'
'"${apple_sdk.sdk.out}/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/MacErrors.h"'
'';
postUnpack = ''