Merge pull request #228146 from wegank/darwin-darling-headers-pre
darwin.darling: drop
This commit is contained in:
@@ -1,12 +1,36 @@
|
||||
{ lib, stdenv, buildPackages
|
||||
{ lib, stdenv, buildPackages, fetchzip
|
||||
, appleDerivation', xnu, Libc, Libm, libdispatch, Libinfo
|
||||
, dyld, Csu, architecture, libclosure, CarbonHeaders, ncurses, CommonCrypto
|
||||
, copyfile, removefile, libresolvHeaders, libresolv, Libnotify, libplatform, libpthread
|
||||
, mDNSResponder, launchd, libutilHeaders, hfsHeaders, darling, darwin-stubs
|
||||
, mDNSResponder, launchd, libutilHeaders, hfsHeaders, darwin-stubs
|
||||
, headersOnly ? false
|
||||
, withLibresolv ? !headersOnly
|
||||
}:
|
||||
|
||||
let
|
||||
darling.src = fetchzip {
|
||||
url = "https://github.com/darlinghq/darling/archive/d2cc5fa748003aaa70ad4180fff0a9a85dc65e9b.tar.gz";
|
||||
sha256 = "11b51fw47nl505h63bgx5kqiyhf3glhp1q6jkpb6nqfislnzzkrf";
|
||||
postFetch = ''
|
||||
# The archive contains both `src/opendirectory` and `src/OpenDirectory`,
|
||||
# pre-create the directory to choose the canonical case on
|
||||
# case-insensitive filesystems.
|
||||
mkdir -p $out/src/OpenDirectory
|
||||
|
||||
cd $out
|
||||
tar -xzf $downloadedFile --strip-components=1
|
||||
rm -r $out/src/libm
|
||||
|
||||
# If `src/opendirectory` and `src/OpenDirectory` refer to different
|
||||
# things, then combine them into `src/OpenDirectory` to match the result
|
||||
# on case-insensitive filesystems.
|
||||
if [ "$(stat -c %i src/opendirectory)" != "$(stat -c %i src/OpenDirectory)" ]; then
|
||||
mv src/opendirectory/* src/OpenDirectory/
|
||||
rmdir src/opendirectory
|
||||
fi
|
||||
'';
|
||||
};
|
||||
in
|
||||
appleDerivation' stdenv {
|
||||
dontBuild = true;
|
||||
dontFixup = true;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{ appleDerivation, xcbuildHook, CoreSymbolication, apple_sdk
|
||||
, xnu, bison, flex, darling, stdenv, fixDarwinDylibNames }:
|
||||
, xnu, bison, flex, stdenv, fixDarwinDylibNames }:
|
||||
|
||||
appleDerivation {
|
||||
nativeBuildInputs = [ xcbuildHook flex bison fixDarwinDylibNames ];
|
||||
buildInputs = [ CoreSymbolication apple_sdk.frameworks.CoreSymbolication darling xnu ];
|
||||
buildInputs = [ CoreSymbolication apple_sdk.frameworks.CoreSymbolication xnu ];
|
||||
# -fcommon: workaround build failure on -fno-common toolchains:
|
||||
# duplicate symbol '_kCSRegionMachHeaderName' in: libproc.o dt_module_apple.o
|
||||
env.NIX_CFLAGS_COMPILE = "-DCTF_OLD_VERSIONS -DPRIVATE -DYYDEBUG=1 -I${xnu}/Library/Frameworks/System.framework/Headers -Wno-error=implicit-function-declaration -fcommon";
|
||||
@@ -21,6 +21,8 @@ appleDerivation {
|
||||
--replace /usr/bin/ld ${stdenv.cc.bintools.bintools}/bin/ld \
|
||||
--replace /usr/lib/dtrace/dt_cpp.h $out/include/dt_cpp.h \
|
||||
--replace /usr/lib/dtrace $out/lib/dtrace
|
||||
substituteInPlace libproc/libproc.c \
|
||||
--replace "#include <sandbox/rootless.h>" ""
|
||||
'';
|
||||
|
||||
# hack to handle xcbuild's broken lex handling
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
{stdenv, lib, fetchzip}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "darling";
|
||||
name = pname;
|
||||
|
||||
src = fetchzip {
|
||||
url = "https://github.com/darlinghq/darling/archive/d2cc5fa748003aaa70ad4180fff0a9a85dc65e9b.tar.gz";
|
||||
sha256 = "11b51fw47nl505h63bgx5kqiyhf3glhp1q6jkpb6nqfislnzzkrf";
|
||||
postFetch = ''
|
||||
# The archive contains both `src/opendirectory` and `src/OpenDirectory`,
|
||||
# pre-create the directory to choose the canonical case on
|
||||
# case-insensitive filesystems.
|
||||
mkdir -p $out/src/OpenDirectory
|
||||
|
||||
cd $out
|
||||
tar -xzf $downloadedFile --strip-components=1
|
||||
rm -r $out/src/libm
|
||||
|
||||
# If `src/opendirectory` and `src/OpenDirectory` refer to different
|
||||
# things, then combine them into `src/OpenDirectory` to match the result
|
||||
# on case-insensitive filesystems.
|
||||
if [ "$(stat -c %i src/opendirectory)" != "$(stat -c %i src/OpenDirectory)" ]; then
|
||||
mv src/opendirectory/* src/OpenDirectory/
|
||||
rmdir src/opendirectory
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
# only packaging sandbox for now
|
||||
buildPhase = ''
|
||||
cc -c src/sandbox/sandbox.c -o src/sandbox/sandbox.o
|
||||
cc -dynamiclib -flat_namespace src/sandbox/sandbox.o -o libsystem_sandbox.dylib
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/lib
|
||||
cp -rL src/sandbox/include/ $out/
|
||||
cp libsystem_sandbox.dylib $out/lib/
|
||||
|
||||
mkdir -p $out/include
|
||||
cp src/libaks/include/* $out/include
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
maintainers = with maintainers; [ matthewbauer ];
|
||||
license = licenses.gpl3;
|
||||
description = "Darwin/macOS emulation layer for Linux";
|
||||
platforms = platforms.darwin;
|
||||
};
|
||||
}
|
||||
@@ -216,8 +216,6 @@ impure-cmds // appleSourcePackages // chooseLibs // {
|
||||
# As the name says, this is broken, but I don't want to lose it since it's a direction we want to go in
|
||||
# libdispatch-broken = callPackage ../os-specific/darwin/swift-corelibs/libdispatch.nix { };
|
||||
|
||||
darling = callPackage ../os-specific/darwin/darling/default.nix { };
|
||||
|
||||
libtapi = callPackage ../os-specific/darwin/libtapi {};
|
||||
|
||||
ios-deploy = callPackage ../os-specific/darwin/ios-deploy {};
|
||||
|
||||
Reference in New Issue
Block a user