uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,30 @@
From 549160574ee44656d50997b27ef83736e0848201 Mon Sep 17 00:00:00 2001
From: toonn <toonn@toonn.io>
Date: Mon, 26 Apr 2021 20:51:05 +0200
Subject: [PATCH] Add missing TARGET_OS_* defines
---
.../Base.subproj/SwiftRuntime/TargetConditionals.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/CoreFoundation/Base.subproj/SwiftRuntime/TargetConditionals.h b/CoreFoundation/Base.subproj/SwiftRuntime/TargetConditionals.h
index 6d42b873..abf746c9 100644
--- a/CoreFoundation/Base.subproj/SwiftRuntime/TargetConditionals.h
+++ b/CoreFoundation/Base.subproj/SwiftRuntime/TargetConditionals.h
@@ -118,6 +118,13 @@
#define TARGET_OS_WIN32 TARGET_OS_WINDOWS
#define TARGET_OS_MAC TARGET_OS_DARWIN
+#define TARGET_OS_OSX TARGET_OS_DARWIN
+
+#define TARGET_OS_IPHONE 0
+#define TARGET_OS_WATCH 0
+#define TARGET_OS_TV 0
+#define TARGET_OS_EMBEDDED 0
+
#if __x86_64__
#define TARGET_CPU_PPC 0
--
2.17.2 (Apple Git-113)

View file

@ -0,0 +1,107 @@
{ lib, stdenv, fetchFromGitHub, fetchurl, ninja, python3, curl, libxml2, objc4, ICU }:
let
# 10.12 adds a new sysdir.h that our version of CF in the main derivation depends on, but
# isn't available publicly, so instead we grab an older version of the same file that did
# not use sysdir.h, but provided the same functionality. Luckily it's simple :) hack hack
sysdir-free-system-directories = fetchurl {
url = "https://raw.githubusercontent.com/apple/swift-corelibs-foundation/9a5d8420f7793e63a8d5ec1ede516c4ebec939f0/CoreFoundation/Base.subproj/CFSystemDirectories.c";
sha256 = "0krfyghj4f096arvvpf884ra5czqlmbrgf8yyc0b3avqmb613pcc";
};
in
stdenv.mkDerivation {
pname = "swift-corefoundation";
version = "unstable-2018-09-14";
src = fetchFromGitHub {
owner = "apple";
repo = "swift-corelibs-foundation";
rev = "71aaba20e1450a82c516af1342fe23268e15de0a";
sha256 = "17kpql0f27xxz4jjw84vpas5f5sn4vdqwv10g151rc3rswbwln1z";
};
nativeBuildInputs = [ ninja python3 ];
buildInputs = [ curl libxml2 objc4 ICU ];
patches = [ ./0001-Add-missing-TARGET_OS_-defines.patch ];
postPatch = ''
cd CoreFoundation
cp ${sysdir-free-system-directories} Base.subproj/CFSystemDirectories.c
# In order, since I can't comment individual lines:
# 1. Disable dispatch support for now
# 2. For the linker too
# 3. Use the legit CoreFoundation.h, not the one telling you not to use it because of Swift
substituteInPlace build.py \
--replace "cf.CFLAGS += '-DDEPLOYMENT" '#' \
--replace "cf.LDFLAGS += '-ldispatch" '#'
# Fix sandbox impurities.
substituteInPlace ../lib/script.py \
--replace '/bin/cp' cp
patchShebangs --build ../configure
# Includes xpc for some initialization routine that they don't define anyway, so no harm here
substituteInPlace PlugIn.subproj/CFBundlePriv.h \
--replace '#if (TARGET_OS_MAC' '#if (0'
# Why do we define __GNU__? Is that normal?
substituteInPlace Base.subproj/CFAsmMacros.h \
--replace '#if defined(__GNU__) ||' '#if 0 &&'
# The MIN macro doesn't seem to be defined sensibly for us. Not sure if our stdenv or their bug
substituteInPlace Base.subproj/CoreFoundation_Prefix.h \
--replace '#if DEPLOYMENT_TARGET_WINDOWS || DEPLOYMENT_TARGET_LINUX' '#if 1'
# Somehow our ICU doesn't have this, probably because it's too old (we'll update it soon when we update the rest of the SDK)
substituteInPlace Locale.subproj/CFLocale.c \
--replace '#if U_ICU_VERSION_MAJOR_NUM' '#if 0 //'
'';
BUILD_DIR = "./Build";
CFLAGS = "-DINCLUDE_OBJC -I${libxml2.dev}/include/libxml2"; # They seem to assume we include objc in some places and not in others, make a PR; also not sure why but libxml2 include path isn't getting picked up from buildInputs
# I'm guessing at the version here. https://github.com/apple/swift-corelibs-foundation/commit/df3ec55fe6c162d590a7653d89ad669c2b9716b1 imported "high sierra"
# and this version is a version from there. No idea how accurate it is.
LDFLAGS = "-current_version 1454.90.0 -compatibility_version 150.0.0 -init ___CFInitialize";
configurePhase = ''
../configure release --sysroot UNUSED
'';
enableParallelBuilding = true;
buildPhase = ''
runHook preBuild
ninja -j $NIX_BUILD_CORES
runHook postBuild
'';
# TODO: their build system sorta kinda can do this, but it doesn't seem to work right now
# Also, this includes a bunch of private headers in the framework, which is not what we want
installPhase = ''
base="$out/Library/Frameworks/CoreFoundation.framework"
mkdir -p $base/Versions/A/{Headers,PrivateHeaders,Modules}
cp ./Build/CoreFoundation/libCoreFoundation.dylib $base/Versions/A/CoreFoundation
# Note that this could easily live in the ldflags above as `-install_name @rpath/...` but
# https://github.com/NixOS/nixpkgs/issues/46434 thwarts that, so for now I'm hacking it up
# after the fact.
install_name_tool -id '@rpath/CoreFoundation.framework/Versions/A/CoreFoundation' $base/Versions/A/CoreFoundation
cp ./Build/CoreFoundation/usr/include/CoreFoundation/*.h $base/Versions/A/Headers
cp ./Build/CoreFoundation/usr/include/CoreFoundation/module.modulemap $base/Versions/A/Modules
ln -s A $base/Versions/Current
for i in CoreFoundation Headers Modules; do
ln -s Versions/Current/$i $base/$i
done
'';
}

View file

@ -0,0 +1,13 @@
{ stdenv, fetchFromGitHub, cmake, apple_sdk_sierra, xnu-new }:
stdenv.mkDerivation rec {
name = "swift-corelibs-libdispatch";
src = fetchFromGitHub {
owner = "apple";
repo = name;
rev = "f83b5a498bad8e9ff8916183cf6e8ccf677c346b";
sha256 = "1czkyyc9llq2mnqfp19mzcfsxzas0y8zrk0gr5hg60acna6jkz2l";
};
nativeBuildInputs = [ cmake ];
buildInputs = [ apple_sdk_sierra.sdk xnu-new ];
}