darwin.CoreSymbolication: build as a framework

`zlog` in darwin.system_cmds requires the CoreSymbolication framework.

This change does two things:

- Adds a patch with the required missing symbols; and
- Uses the stubs to create `CoreSymbolication.framework`.

Co-authored-by: a-n-n-a-l-e-e <150648636+a-n-n-a-l-e-e@users.noreply.github.com>
This commit is contained in:
Randy Eckenrode 2023-10-01 21:31:22 -04:00
parent 0fb285678d
commit b552612217
No known key found for this signature in database
GPG Key ID: 64C1CD4EC2A600D9
1 changed files with 36 additions and 10 deletions

View File

@ -1,8 +1,14 @@
{ lib, fetchFromGitHub, fetchpatch, stdenv }:
{
lib,
fetchFromGitHub,
fetchpatch,
stdenvNoCC,
darwin-stubs,
}:
stdenv.mkDerivation {
pname = "core-symbolication";
version = "unstable-2018-06-17";
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "CoreSymbolication";
inherit (darwin-stubs) version;
src = fetchFromGitHub {
repo = "CoreSymbolication";
@ -12,15 +18,35 @@ stdenv.mkDerivation {
};
patches = [
# C99 compilation fix
# https://github.com/matthewbauer/CoreSymbolication/pull/1
# Add missing symbol definitions needed to build `zlog` in system_cmds.
# https://github.com/matthewbauer/CoreSymbolication/pull/2
(fetchpatch {
url = "https://github.com/boltzmannrain/CoreSymbolication/commit/1c26cc93f260bda9230a93e91585284e80aa231f.patch";
hash = "sha256-d/ieDEnvZ9kVOjBVUdJzGmdvC1AF3Jk4fbwp04Q6l/I=";
url = "https://github.com/matthewbauer/CoreSymbolication/commit/ae7ac6a7043dbae8e63d6ce5e63dfaf02b5977fe.patch";
hash = "sha256-IuXGMsaR1LIGs+BpDU1b4YlznKm9VhK5DQ+Dthtb1mI=";
})
(fetchpatch {
url = "https://github.com/matthewbauer/CoreSymbolication/commit/6531da946949a94643e6d8424236174ae64fe0ca.patch";
hash = "sha256-+nDX04yY92yVT9KxiAFY2LxKcS7P8JpU539K+YVRqV4=";
})
];
makeFlags = [ "PREFIX=$(out)" "CC=${stdenv.cc.targetPrefix}cc" ];
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out/Library/Frameworks/CoreSymbolication.framework/Versions/A/Headers
ln -s A $out/Library/Frameworks/CoreSymbolication.framework/Versions/Current
ln -s Versions/Current/Headers $out/Library/Frameworks/CoreSymbolication.framework/Headers
ln -s Versions/Current/CoreSymbolication.tbd $out/Library/Frameworks/CoreSymbolication.framework/CoreSymbolication.tbd
cp *.h $out/Library/Frameworks/CoreSymbolication.framework/Versions/A/Headers
cp ${darwin-stubs}/System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/A/CoreSymbolication.tbd \
$out/Library/Frameworks/CoreSymbolication.framework/Versions/A/CoreSymbolication.tbd
runHook postInstall
'';
meta = with lib; {
description = "Reverse engineered headers for Apple's CoreSymbolication framework";
@ -29,4 +55,4 @@ stdenv.mkDerivation {
platforms = platforms.darwin;
maintainers = with maintainers; [ matthewbauer ];
};
}
})