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,20 @@
{ lib, appleDerivation', stdenvNoCC }:
appleDerivation' stdenvNoCC {
dontBuild = true;
installPhase = ''
mkdir -p $out/include
cp MacTypes.h $out/include
cp ConditionalMacros.h $out/include
substituteInPlace $out/include/MacTypes.h \
--replace "CarbonCore/" ""
'';
meta = with lib; {
maintainers = with maintainers; [ copumpkin ];
platforms = platforms.darwin;
license = licenses.apsl20;
};
}

View file

@ -0,0 +1,42 @@
{ lib, appleDerivation', stdenvNoCC }:
appleDerivation' stdenvNoCC {
installPhase = ''
mkdir -p $out/include/CommonCrypto
cp include/* $out/include/CommonCrypto
'';
appleHeaders = ''
CommonCrypto/CommonBaseXX.h
CommonCrypto/CommonBigNum.h
CommonCrypto/CommonCMACSPI.h
CommonCrypto/CommonCRC.h
CommonCrypto/CommonCrypto.h
CommonCrypto/CommonCryptoError.h
CommonCrypto/CommonCryptoPriv.h
CommonCrypto/CommonCryptor.h
CommonCrypto/CommonCryptorSPI.h
CommonCrypto/CommonDH.h
CommonCrypto/CommonDigest.h
CommonCrypto/CommonDigestSPI.h
CommonCrypto/CommonECCryptor.h
CommonCrypto/CommonHMAC.h
CommonCrypto/CommonHMacSPI.h
CommonCrypto/CommonKeyDerivation.h
CommonCrypto/CommonKeyDerivationSPI.h
CommonCrypto/CommonNumerics.h
CommonCrypto/CommonRSACryptor.h
CommonCrypto/CommonRandom.h
CommonCrypto/CommonRandomSPI.h
CommonCrypto/CommonSymmetricKeywrap.h
CommonCrypto/aes.h
CommonCrypto/lionCompat.h
CommonCrypto/module.modulemap
'';
meta = with lib; {
maintainers = with maintainers; [ copumpkin ];
platforms = platforms.darwin;
license = licenses.apsl20;
};
}

View file

@ -0,0 +1,28 @@
{ lib, appleDerivation', stdenv }:
appleDerivation' stdenv {
prePatch = ''
substituteInPlace Makefile \
--replace /usr/lib /lib \
--replace /usr/local/lib /lib \
--replace /usr/bin "" \
--replace /bin/ "" \
--replace "CC = " "#" \
--replace "SDK_DIR = " "SDK_DIR = . #" \
# Mac OS didn't support rpaths back before 10.5, but we don't care about it.
substituteInPlace Makefile \
--replace -mmacosx-version-min=10.4 -mmacosx-version-min=10.6 \
--replace -mmacosx-version-min=10.5 -mmacosx-version-min=10.6
'';
installFlags = [ "DSTROOT=$(out)" ];
meta = with lib; {
description = "Apple's common startup stubs for darwin";
maintainers = with maintainers; [ copumpkin ];
platforms = platforms.darwin;
license = licenses.apsl20;
};
}

View file

@ -0,0 +1,86 @@
{ appleDerivation, lib, stdenv, buildPackages, python3 }:
let
formatVersionNumeric = version:
let
versionParts = lib.versions.splitVersion version;
major = lib.toInt (lib.elemAt versionParts 0);
minor = lib.toInt (lib.elemAt versionParts 1);
patch = if lib.length versionParts > 2 then lib.toInt (lib.elemAt versionParts 2) else 0;
in toString (major * 10000 + minor * 100 + patch);
in
appleDerivation {
nativeBuildInputs = [ python3 ];
depsBuildBuild = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [ buildPackages.stdenv.cc ];
postPatch = ''
substituteInPlace makefile \
--replace "/usr/bin/" "" \
--replace "xcrun --sdk macosx --find" "echo -n" \
--replace "xcrun --sdk macosx.internal --show-sdk-path" "echo -n /dev/null" \
--replace "-install_name " "-install_name $out"
substituteInPlace icuSources/config/mh-darwin \
--replace "-install_name " "-install_name $out/"
# drop using impure /var/db/timezone/icutz
substituteInPlace makefile \
--replace '-DU_TIMEZONE_FILES_DIR=\"\\\"$(TZDATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_PACKAGE=\"\\\"$(TZDATA_PACKAGE)\\\"\"' ""
# FIXME: This will cause `ld: warning: OS version (12.0) too small, changing to 13.0.0`, APPLE should fix it.
substituteInPlace makefile \
--replace "ZIPPERING_LDFLAGS=-Wl,-iosmac_version_min,12.0" "ZIPPERING_LDFLAGS="
# skip test for missing encodingSamples data
substituteInPlace icuSources/test/cintltst/ucsdetst.c \
--replace "&TestMailFilterCSS" "NULL"
patchShebangs icuSources
'' + lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
# This looks like a bug in the makefile. It defines ENV_BUILDHOST to
# propagate the correct value of CC, CXX, etc, but has the following double
# expansion that results in the empty string.
substituteInPlace makefile \
--replace '$($(ENV_BUILDHOST))' '$(ENV_BUILDHOST)'
'';
# APPLE is using makefile to save its default configuration and call ./configure, so we hack makeFlags
# instead of configuring ourself, trying to stay abreast of APPLE.
dontConfigure = true;
makeFlags = [
"DSTROOT=$(out)"
# remove /usr prefix on include and lib
"PRIVATE_HDR_PREFIX="
"libdir=/lib/"
"DATA_INSTALL_DIR=/share/icu/"
"DATA_LOOKUP_DIR=$(DSTROOT)$(DATA_INSTALL_DIR)"
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ # darwin* platform properties are only defined on darwin
# hack to use our lower macos version
"MAC_OS_X_VERSION_MIN_REQUIRED=${formatVersionNumeric stdenv.hostPlatform.darwinMinVersion}"
"ICU_TARGET_VERSION=-m${stdenv.hostPlatform.darwinPlatform}-version-min=${stdenv.hostPlatform.darwinMinVersion}"
]
++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
"CROSS_BUILD=YES"
"BUILD_TYPE="
"RC_ARCHS=${stdenv.hostPlatform.darwinArch}"
"HOSTCC=cc"
"HOSTCXX=c++"
"CC=${stdenv.cc.targetPrefix}cc"
"CXX=${stdenv.cc.targetPrefix}c++"
"HOSTISYSROOT="
"OSX_HOST_VERSION_MIN_STRING=${stdenv.buildPlatform.darwinMinVersion}"
];
doCheck = true;
checkTarget = "check";
postInstall = ''
# we don't need all those in usr/local
rm -rf $out/usr
'';
}

View file

@ -0,0 +1,190 @@
{ lib, appleDerivation', stdenv, IOKitSrcs, xnu, darwin-stubs }:
# Someday it'll make sense to split these out into their own packages, but today is not that day.
appleDerivation' stdenv {
srcs = lib.attrValues IOKitSrcs;
sourceRoot = ".";
phases = [ "unpackPhase" "installPhase" ];
__propagatedImpureHostDeps = [
"/System/Library/Frameworks/IOKit.framework/IOKit"
"/System/Library/Frameworks/IOKit.framework/Resources"
"/System/Library/Frameworks/IOKit.framework/Versions"
];
installPhase = ''
mkdir -p $out/Library/Frameworks/IOKit.framework
###### IMPURITIES
ln -s /System/Library/Frameworks/IOKit.framework/Resources \
$out/Library/Frameworks/IOKit.framework
###### STUBS
cp ${darwin-stubs}/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit.tbd \
$out/Library/Frameworks/IOKit.framework
###### HEADERS
export dest=$out/Library/Frameworks/IOKit.framework/Headers
mkdir -p $dest
pushd $dest
mkdir audio avc DV firewire graphics hid hidsystem i2c kext ndrvsupport
mkdir network ps pwr_mgt sbp2 scsi serial storage stream usb video
popd
# root: complete
cp IOKitUser-*/IOCFBundle.h $dest
cp IOKitUser-*/IOCFPlugIn.h $dest
cp IOKitUser-*/IOCFSerialize.h $dest
cp IOKitUser-*/IOCFUnserialize.h $dest
cp IOKitUser-*/IOCFURLAccess.h $dest
cp IOKitUser-*/IODataQueueClient.h $dest
cp IOKitUser-*/IOKitLib.h $dest
cp IOKitUser-*/iokitmig.h $dest
cp ${xnu}/Library/PrivateFrameworks/IOKit.framework/Versions/A/Headers/*.h $dest
# audio: complete
cp IOAudioFamily-*/IOAudioDefines.h $dest/audio
cp IOKitUser-*/audio.subproj/IOAudioLib.h $dest/audio
cp IOAudioFamily-*/IOAudioTypes.h $dest/audio
# avc: complete
cp IOFireWireAVC-*/IOFireWireAVC/IOFireWireAVCConsts.h $dest/avc
cp IOFireWireAVC-*/IOFireWireAVCLib/IOFireWireAVCLib.h $dest/avc
# DV: complete
cp IOFWDVComponents-*/DVFamily.h $dest/DV
# firewire: complete
cp IOFireWireFamily-*/IOFireWireFamily.kmodproj/IOFireWireFamilyCommon.h $dest/firewire
cp IOFireWireFamily-*/IOFireWireLib.CFPlugInProj/IOFireWireLib.h $dest/firewire
cp IOFireWireFamily-*/IOFireWireLib.CFPlugInProj/IOFireWireLibIsoch.h $dest/firewire
cp IOFireWireFamily-*/IOFireWireFamily.kmodproj/IOFWIsoch.h $dest/firewire
# graphics: missing AppleGraphicsDeviceControlUserCommand.h
cp IOGraphics-*/IOGraphicsFamily/IOKit/graphics/IOAccelClientConnect.h $dest/graphics
cp IOGraphics-*/IOGraphicsFamily/IOKit/graphics/IOAccelSurfaceConnect.h $dest/graphics
cp IOGraphics-*/IOGraphicsFamily/IOKit/graphics/IOAccelTypes.h $dest/graphics
cp IOGraphics-*/IOGraphicsFamily/IOKit/graphics/IOFramebufferShared.h $dest/graphics
cp IOGraphics-*/IOGraphicsFamily/IOKit/graphics/IOGraphicsEngine.h $dest/graphics
cp IOGraphics-*/IOGraphicsFamily/IOKit/graphics/IOGraphicsInterface.h $dest/graphics
cp IOGraphics-*/IOGraphicsFamily/IOKit/graphics/IOGraphicsInterfaceTypes.h $dest/graphics
cp IOKitUser-*/graphics.subproj/IOGraphicsLib.h $dest/graphics
cp IOGraphics-*/IOGraphicsFamily/IOKit/graphics/IOGraphicsTypes.h $dest/graphics
# hid: complete
cp IOKitUser-*/hid.subproj/IOHIDBase.h $dest/hid
cp IOKitUser-*/hid.subproj/IOHIDDevice.h $dest/hid
cp IOKitUser-*/hid.subproj/IOHIDDevicePlugIn.h $dest/hid
cp IOKitUser-*/hid.subproj/IOHIDElement.h $dest/hid
cp IOKitUser-*/hid.subproj/IOHIDLib.h $dest/hid
cp IOKitUser-*/hid.subproj/IOHIDManager.h $dest/hid
cp IOKitUser-*/hid.subproj/IOHIDQueue.h $dest/hid
cp IOKitUser-*/hid.subproj/IOHIDTransaction.h $dest/hid
cp IOKitUser-*/hid.subproj/IOHIDValue.h $dest/hid
cp IOHIDFamily-*/IOHIDFamily/IOHIDKeys.h $dest/hid
cp IOHIDFamily-*/IOHIDFamily/IOHIDUsageTables.h $dest/hid
cp IOHIDFamily-*/IOHIDLib/IOHIDLibObsolete.h $dest/hid
# hidsystem: complete
cp IOHIDFamily-*/IOHIDSystem/IOKit/hidsystem/ev_keymap.h $dest/hidsystem
cp IOKitUser-*/hidsystem.subproj/event_status_driver.h $dest/hidsystem
cp IOKitUser-*/hidsystem.subproj/IOHIDLib.h $dest/hidsystem
cp IOHIDFamily-*/IOHIDSystem/IOKit/hidsystem/IOHIDParameter.h $dest/hidsystem
cp IOHIDFamily-*/IOHIDSystem/IOKit/hidsystem/IOHIDShared.h $dest/hidsystem
cp IOHIDFamily-*/IOHIDSystem/IOKit/hidsystem/IOHIDTypes.h $dest/hidsystem
cp IOHIDFamily-*/IOHIDSystem/IOKit/hidsystem/IOLLEvent.h $dest/hidsystem
# i2c: complete
cp IOGraphics-*/IOGraphicsFamily/IOKit/i2c/IOI2CInterface.h $dest/i2c
# kext: complete
cp IOKitUser-*/kext.subproj/KextManager.h $dest/kext
# ndrvsupport: complete
cp IOGraphics-*/IONDRVSupport/IOKit/ndrvsupport/IOMacOSTypes.h $dest/ndrvsupport
cp IOGraphics-*/IONDRVSupport/IOKit/ndrvsupport/IOMacOSVideo.h $dest/ndrvsupport
# network: complete
cp IONetworkingFamily-*/IOEthernetController.h $dest/network
cp IONetworkingFamily-*/IOEthernetInterface.h $dest/network
cp IONetworkingFamily-*/IOEthernetStats.h $dest/network
cp IONetworkingFamily-*/IONetworkController.h $dest/network
cp IONetworkingFamily-*/IONetworkData.h $dest/network
cp IONetworkingFamily-*/IONetworkInterface.h $dest/network
cp IOKitUser-*/network.subproj/IONetworkLib.h $dest/network
cp IONetworkingFamily-*/IONetworkMedium.h $dest/network
cp IONetworkingFamily-*/IONetworkStack.h $dest/network
cp IONetworkingFamily-*/IONetworkStats.h $dest/network
cp IONetworkingFamily-*/IONetworkUserClient.h $dest/network
# ps: missing IOUPSPlugIn.h
cp IOKitUser-*/ps.subproj/IOPowerSources.h $dest/ps
cp IOKitUser-*/ps.subproj/IOPSKeys.h $dest/ps
# pwr_mgt: complete
cp IOKitUser-*/pwr_mgt.subproj/IOPMKeys.h $dest/pwr_mgt
cp IOKitUser-*/pwr_mgt.subproj/IOPMLib.h $dest/pwr_mgt
cp ${xnu}/Library/PrivateFrameworks/IOKit.framework/Versions/A/Headers/pwr_mgt/*.h $dest/pwr_mgt
cp IOKitUser-*/pwr_mgt.subproj/IOPMLibPrivate.h $dest/pwr_mgt # Private
# sbp2: complete
cp IOFireWireSBP2-*/IOFireWireSBP2Lib/IOFireWireSBP2Lib.h $dest/sbp2
# scsi: omitted for now
# serial: complete
cp IOSerialFamily-*/IOSerialFamily.kmodproj/IOSerialKeys.h $dest/serial
cp IOSerialFamily-*/IOSerialFamily.kmodproj/ioss.h $dest/serial
# storage: complete
# Needs ata subdirectory
cp IOStorageFamily-*/IOAppleLabelScheme.h $dest/storage
cp IOStorageFamily-*/IOApplePartitionScheme.h $dest/storage
cp IOBDStorageFamily-*/IOBDBlockStorageDevice.h $dest/storage
cp IOBDStorageFamily-*/IOBDMedia.h $dest/storage
cp IOBDStorageFamily-*/IOBDMediaBSDClient.h $dest/storage
cp IOBDStorageFamily-*/IOBDTypes.h $dest/storage
cp IOStorageFamily-*/IOBlockStorageDevice.h $dest/storage
cp IOStorageFamily-*/IOBlockStorageDriver.h $dest/storage
cp IOCDStorageFamily-*/IOCDBlockStorageDevice.h $dest/storage
cp IOCDStorageFamily-*/IOCDMedia.h $dest/storage
cp IOCDStorageFamily-*/IOCDMediaBSDClient.h $dest/storage
cp IOCDStorageFamily-*/IOCDPartitionScheme.h $dest/storage
cp IOCDStorageFamily-*/IOCDTypes.h $dest/storage
cp IODVDStorageFamily-*/IODVDBlockStorageDevice.h $dest/storage
cp IODVDStorageFamily-*/IODVDMedia.h $dest/storage
cp IODVDStorageFamily-*/IODVDMediaBSDClient.h $dest/storage
cp IODVDStorageFamily-*/IODVDTypes.h $dest/storage
cp IOStorageFamily-*/IOFDiskPartitionScheme.h $dest/storage
cp IOStorageFamily-*/IOFilterScheme.h $dest/storage
cp IOFireWireSerialBusProtocolTransport-*/IOFireWireStorageCharacteristics.h $dest/storage
cp IOStorageFamily-*/IOGUIDPartitionScheme.h $dest/storage
cp IOStorageFamily-*/IOMedia.h $dest/storage
cp IOStorageFamily-*/IOMediaBSDClient.h $dest/storage
cp IOStorageFamily-*/IOPartitionScheme.h $dest/storage
cp IOStorageFamily-*/IOStorage.h $dest/storage
cp IOStorageFamily-*/IOStorageCardCharacteristics.h $dest/storage
cp IOStorageFamily-*/IOStorageDeviceCharacteristics.h $dest/storage
cp IOStorageFamily-*/IOStorageProtocolCharacteristics.h $dest/storage
# stream: missing altogether
# usb: complete
cp IOUSBFamily-630.4.5/IOUSBFamily/Headers/IOUSBLib.h $dest/usb
cp IOUSBFamily-630.4.5/IOUSBUserClient/Headers/IOUSBUserClient.h $dest/usb
cp IOUSBFamily-560.4.2/IOUSBFamily/Headers/USB.h $dest/usb # This file is empty in 630.4.5!
cp IOUSBFamily-630.4.5/IOUSBFamily/Headers/USBSpec.h $dest/usb
# video: missing altogether
'';
meta = with lib; {
maintainers = with maintainers; [ joelteon copumpkin ];
platforms = platforms.darwin;
license = licenses.apsl20;
};
}

View file

@ -0,0 +1,47 @@
From 187d0e8847d080790b22724352e51de50d214dd8 Mon Sep 17 00:00:00 2001
From: toonn <toonn@toonn.io>
Date: Tue, 27 Jul 2021 15:12:14 +0200
Subject: [PATCH] Define TARGET_OS_EMBEDDED in std{lib,io} if not defined
Originally attempted including `TargetConditionals.h` but this had
knock-on effects, for example, breaking the zlib build because of
`TARGET_OS_MAC` getting defined.
This should be the lowest impact solution and corresponds to the default
behavior IIUC.
---
include/stdio.h | 3 +++
include/stdlib.h | 3 +++
2 files changed, 6 insertions(+)
diff --git a/include/stdio.h b/include/stdio.h
index d0cf7a5..487496e 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -351,6 +351,9 @@ __END_DECLS
/* Additional functionality provided by:
* POSIX.2-1992 C Language Binding Option
*/
+#ifndef TARGET_OS_EMBEDDED
+# define TARGET_OS_EMBEDDED 0
+#endif
#if TARGET_OS_EMBEDDED
#define __swift_unavailable_on(osx_msg, ios_msg) __swift_unavailable(ios_msg)
#else
diff --git a/include/stdlib.h b/include/stdlib.h
index c04d3a7..0b454ba 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -183,6 +183,9 @@ unsigned long long
#ifndef LIBC_ALIAS_SYSTEM
//End-Libc
+#ifndef TARGET_OS_EMBEDDED
+# define TARGET_OS_EMBEDDED 0
+#endif
#if TARGET_OS_EMBEDDED
#define __swift_unavailable_on(osx_msg, ios_msg) __swift_unavailable(ios_msg)
#else
--
2.17.2 (Apple Git-113)

View file

@ -0,0 +1,13 @@
{ appleDerivation', stdenvNoCC, ed, unifdef }:
appleDerivation' stdenvNoCC {
nativeBuildInputs = [ ed unifdef ];
installPhase = ''
export SRCROOT=$PWD
export DSTROOT=$out
export PUBLIC_HEADERS_FOLDER_PATH=include
export PRIVATE_HEADERS_FOLDER_PATH=include
bash xcodescripts/headers.sh
'';
}

View file

@ -0,0 +1,51 @@
/*
* Copyright (c) 2010 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
/***********************************************************************
* Not to be installed in /usr/local/include
***********************************************************************/
#ifndef _LIBC_CRASHREPORTERCLIENT_H
#define _LIBC_CRASHREPORTERCLIENT_H
#include "stdint.h"
/* Fake the CrashReporterClient API */
#define CRGetCrashLogMessage() 0
#define CRSetCrashLogMessage(m) true
#define CRASH_REPORTER_CLIENT_HIDDEN __attribute__((visibility("hidden")))
#define CRASHREPORTER_ANNOTATIONS_VERSION 4
#define CRASHREPORTER_ANNOTATIONS_SECTION "__crash_info"
struct crashreporter_annotations_t {
uint64_t version; // unsigned long
uint64_t message; // char *
uint64_t signature_string; // char *
uint64_t backtrace; // char *
uint64_t message2; // char *
uint64_t thread; // uint64_t
uint64_t dialog_mode; // unsigned int
};
#endif

View file

@ -0,0 +1,38 @@
{ appleDerivation', stdenvNoCC, ed, unifdef, Libc_old, Libc_10-9 }:
appleDerivation' stdenvNoCC {
nativeBuildInputs = [ ed unifdef ];
patches = [
./0001-Define-TARGET_OS_EMBEDDED-in-std-lib-io-if-not-defin.patch
];
# TODO: asl.h actually comes from syslog project now
installPhase = ''
export SRCROOT=$PWD
export DSTROOT=$out
export PUBLIC_HEADERS_FOLDER_PATH=include
export PRIVATE_HEADERS_FOLDER_PATH=include
bash xcodescripts/headers.sh
cp ${./CrashReporterClient.h} $out/include/CrashReporterClient.h
cp ${Libc_10-9}/include/NSSystemDirectories.h $out/include
# Ugh Apple stopped releasing this stuff so we need an older one...
cp ${Libc_old}/include/spawn.h $out/include
cp ${Libc_old}/include/setjmp.h $out/include
cp ${Libc_old}/include/ucontext.h $out/include
cp ${Libc_old}/include/pthread*.h $out/include
cp ${Libc_old}/include/sched.h $out/include
cp -R ${Libc_old}/include/malloc $out/include
mkdir -p $out/include/libkern
cp ${Libc_old}/include/asl.h $out/include
cp ${Libc_old}/include/libproc.h $out/include
cp ${Libc_old}/include/libkern/OSAtomic.h $out/include/libkern
cp ${Libc_old}/include/libkern/OSCacheControl.h $out/include/libkern
'';
appleHeaders = builtins.readFile ./headers.txt;
}

View file

@ -0,0 +1,138 @@
CrashReporterClient.h
NSSystemDirectories.h
_locale.h
_types.h
_types/_intmax_t.h
_types/_nl_item.h
_types/_uint16_t.h
_types/_uint32_t.h
_types/_uint64_t.h
_types/_uint8_t.h
_types/_uintmax_t.h
_types/_wctrans_t.h
_types/_wctype_t.h
_wctype.h
_xlocale.h
aio.h
alloca.h
ar.h
arpa/ftp.h
arpa/inet.h
arpa/nameser_compat.h
arpa/telnet.h
arpa/tftp.h
asl.h
assert.h
bitstring.h
cpio.h
crt_externs.h
ctype.h
db.h
dirent.h
disktab.h
err.h
errno.h
execinfo.h
fcntl.h
fmtmsg.h
fnmatch.h
fsproperties.h
fstab.h
fts.h
ftw.h
get_compat.h
getopt.h
glob.h
inttypes.h
iso646.h
langinfo.h
libc.h
libc_private.h
libgen.h
libkern/OSAtomic.h
libkern/OSCacheControl.h
libproc.h
limits.h
locale.h
malloc/malloc.h
memory.h
monetary.h
monitor.h
mpool.h
msgcat.h
ndbm.h
nl_types.h
nlist.h
os/assumes.h
os/debug_private.h
paths.h
poll.h
printf.h
protocols/routed.h
protocols/rwhod.h
protocols/talkd.h
protocols/timed.h
pthread.h
pthread_impl.h
pthread_spis.h
pthread_workqueue.h
ranlib.h
readpassphrase.h
regex.h
runetype.h
sched.h
search.h
secure/_common.h
secure/_stdio.h
secure/_string.h
semaphore.h
setjmp.h
sgtty.h
signal.h
spawn.h
stab.h
standards.h
stddef.h
stdint.h
stdio.h
stdlib.h
strhash.h
string.h
stringlist.h
strings.h
struct.h
sys/acl.h
sys/rbtree.h
sys/statvfs.h
sysexits.h
syslog.h
tar.h
termios.h
time.h
timeconv.h
ttyent.h
tzfile.h
ucontext.h
ulimit.h
unistd.h
util.h
utime.h
utmpx.h
utmpx_thread.h
vis.h
wchar.h
wctype.h
wordexp.h
xlocale.h
xlocale/__wctype.h
xlocale/_ctype.h
xlocale/_inttypes.h
xlocale/_langinfo.h
xlocale/_monetary.h
xlocale/_regex.h
xlocale/_stdio.h
xlocale/_stdlib.h
xlocale/_string.h
xlocale/_time.h
xlocale/_wchar.h
xlocale/_wctype.h

View file

@ -0,0 +1,50 @@
{ appleDerivation', stdenvNoCC }:
appleDerivation' stdenvNoCC {
installPhase = ''
substituteInPlace xcodescripts/install_files.sh \
--replace "/usr/local/" "/" \
--replace "/usr/" "/" \
--replace '-o "$INSTALL_OWNER" -g "$INSTALL_GROUP"' "" \
--replace "ln -h" "ln -n"
export DSTROOT=$out
sh xcodescripts/install_files.sh
'';
appleHeaders = ''
aliasdb.h
bootparams.h
configuration_profile.h
grp.h
ifaddrs.h
ils.h
kvbuf.h
libinfo.h
libinfo_muser.h
membership.h
membershipPriv.h
netdb.h
netdb_async.h
ntsid.h
printerdb.h
pwd.h
rpc/auth.h
rpc/auth_unix.h
rpc/clnt.h
rpc/pmap_clnt.h
rpc/pmap_prot.h
rpc/pmap_rmt.h
rpc/rpc.h
rpc/rpc_msg.h
rpc/svc.h
rpc/svc_auth.h
rpc/types.h
rpc/xdr.h
rpcsvc/yp_prot.h
rpcsvc/ypclnt.h
si_data.h
si_module.h
thread_data.h
'';
}

View file

@ -0,0 +1,11 @@
{ appleDerivation', stdenvNoCC }:
appleDerivation' stdenvNoCC {
installPhase = ''
mkdir -p $out/include
cp Source/Intel/math.h $out/include
cp Source/Intel/fenv.h $out/include
cp Source/complex.h $out/include
'';
}

View file

@ -0,0 +1,9 @@
{ appleDerivation', stdenvNoCC }:
appleDerivation' stdenvNoCC {
installPhase = ''
mkdir -p $out/include
cp notify.h $out/include
cp notify_keys.h $out/include
'';
}

View file

@ -0,0 +1,22 @@
{ lib, appleDerivation, developer_cmds }:
appleDerivation {
buildInputs = [ developer_cmds ];
installPhase = ''
export DSTROOT=$out
export SRCROOT=$PWD
export OBJROOT=$PWD
. ./xcodescripts/install_rpcsvc.sh
mv $out/usr/* $out
rmdir $out/usr/
'';
meta = with lib; {
maintainers = with maintainers; [ matthewbauer ];
platforms = platforms.darwin;
license = licenses.apsl20;
};
}

View file

@ -0,0 +1,146 @@
{ lib, stdenv, buildPackages
, 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
, headersOnly ? false
, withLibresolv ? !headersOnly
}:
appleDerivation' stdenv {
dontBuild = true;
dontFixup = true;
installPhase = ''
export NIX_ENFORCE_PURITY=
mkdir -p $out/lib $out/include
function copyHierarchy () {
mkdir -p $1
while read f; do
mkdir -p $1/$(dirname $f)
cp --parents -pn $f $1
done
}
# Set up our include directories
(cd ${xnu}/include && find . -name '*.h' -or -name '*.defs' | copyHierarchy $out/include)
cp ${xnu}/Library/Frameworks/Kernel.framework/Versions/A/Headers/Availability*.h $out/include
cp ${xnu}/Library/Frameworks/Kernel.framework/Versions/A/Headers/stdarg.h $out/include
for dep in ${Libc} ${Libm} ${Libinfo} ${dyld} ${architecture} \
${libclosure} ${CarbonHeaders} ${libdispatch} ${ncurses.dev} \
${CommonCrypto} ${copyfile} ${removefile} ${libresolvHeaders} \
${Libnotify} ${libplatform} ${mDNSResponder} ${launchd} \
${libutilHeaders} ${libpthread} ${hfsHeaders}; do
(cd $dep/include && find . -name '*.h' | copyHierarchy $out/include)
done
(cd ${buildPackages.darwin.cctools.dev}/include/mach-o && find . -name '*.h' | copyHierarchy $out/include/mach-o)
mkdir -p $out/include/os
cp ${darling.src}/src/libc/os/activity.h $out/include/os
cp ${darling.src}/src/libc/os/log.h $out/include/os
cp ${darling.src}/src/duct/include/os/trace.h $out/include/os
cat <<EOF > $out/include/os/availability.h
#ifndef __OS_AVAILABILITY__
#define __OS_AVAILABILITY__
#include <AvailabilityInternal.h>
#if defined(__has_feature) && defined(__has_attribute) && __has_attribute(availability)
#define API_AVAILABLE(...) __API_AVAILABLE_GET_MACRO(__VA_ARGS__, __API_AVAILABLE4, __API_AVAILABLE3, __API_AVAILABLE2, __API_AVAILABLE1)(__VA_ARGS__)
#define API_DEPRECATED(...) __API_DEPRECATED_MSG_GET_MACRO(__VA_ARGS__, __API_DEPRECATED_MSG5, __API_DEPRECATED_MSG4, __API_DEPRECATED_MSG3, __API_DEPRECATED_MSG2, __API_DEPRECATED_MSG1)(__VA_ARGS__)
#define API_DEPRECATED_WITH_REPLACEMENT(...) __API_DEPRECATED_REP_GET_MACRO(__VA_ARGS__, __API_DEPRECATED_REP5, __API_DEPRECATED_REP4, __API_DEPRECATED_REP3, __API_DEPRECATED_REP2, __API_DEPRECATED_REP1)(__VA_ARGS__)
#define API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__, __API_UNAVAILABLE3, __API_UNAVAILABLE2, __API_UNAVAILABLE1)(__VA_ARGS__)
#else
#define API_AVAILABLE(...)
#define API_DEPRECATED(...)
#define API_DEPRECATED_WITH_REPLACEMENT(...)
#define API_UNAVAILABLE(...)
#endif
#endif
EOF
cat <<EOF > $out/include/TargetConditionals.h
#ifndef __TARGETCONDITIONALS__
#define __TARGETCONDITIONALS__
#define TARGET_OS_MAC 1
#define TARGET_OS_WIN32 0
#define TARGET_OS_UNIX 0
#define TARGET_OS_OSX 1
#define TARGET_OS_IPHONE 0
#define TARGET_OS_IOS 0
#define TARGET_OS_WATCH 0
#define TARGET_OS_BRIDGE 0
#define TARGET_OS_TV 0
#define TARGET_OS_SIMULATOR 0
#define TARGET_OS_EMBEDDED 0
#define TARGET_OS_EMBEDDED_OTHER 0 /* Used in configd */
#define TARGET_IPHONE_SIMULATOR TARGET_OS_SIMULATOR /* deprecated */
#define TARGET_OS_NANO TARGET_OS_WATCH /* deprecated */
#define TARGET_OS_LINUX 0
#define TARGET_CPU_PPC 0
#define TARGET_CPU_PPC64 0
#define TARGET_CPU_68K 0
#define TARGET_CPU_X86 0
#define TARGET_CPU_X86_64 1
#define TARGET_CPU_ARM 0
#define TARGET_CPU_ARM64 0
#define TARGET_CPU_MIPS 0
#define TARGET_CPU_SPARC 0
#define TARGET_CPU_ALPHA 0
#define TARGET_RT_MAC_CFM 0
#define TARGET_RT_MAC_MACHO 1
#define TARGET_RT_LITTLE_ENDIAN 1
#define TARGET_RT_BIG_ENDIAN 0
#define TARGET_RT_64_BIT 1
#endif /* __TARGETCONDITIONALS__ */
EOF
'' + lib.optionalString (!headersOnly) ''
# The startup object files
cp ${Csu}/lib/* $out/lib
cp -vr \
${darwin-stubs}/usr/lib/libSystem.B.tbd \
${darwin-stubs}/usr/lib/system \
$out/lib
substituteInPlace $out/lib/libSystem.B.tbd \
--replace "/usr/lib/system/" "$out/lib/system/"
ln -s libSystem.B.tbd $out/lib/libSystem.tbd
# Set up links to pretend we work like a conventional unix (Apple's design, not mine!)
for name in c dbm dl info m mx poll proc pthread rpcsvc util gcc_s.10.4 gcc_s.10.5; do
ln -s libSystem.tbd $out/lib/lib$name.tbd
done
'' + lib.optionalString withLibresolv ''
# This probably doesn't belong here, but we want to stay similar to glibc, which includes resolv internally...
cp ${libresolv}/lib/libresolv.9.dylib $out/lib/libresolv.9.dylib
resolv_libSystem=$(${stdenv.cc.bintools.targetPrefix}otool -L "$out/lib/libresolv.9.dylib" | tail -n +3 | grep -o "$NIX_STORE.*-\S*") || true
echo $libs
chmod +w $out/lib/libresolv.9.dylib
${stdenv.cc.bintools.targetPrefix}install_name_tool \
-id $out/lib/libresolv.9.dylib \
-change "$resolv_libSystem" /usr/lib/libSystem.dylib \
$out/lib/libresolv.9.dylib
ln -s libresolv.9.dylib $out/lib/libresolv.dylib
'';
appleHeaders = builtins.readFile ./headers.txt;
meta = with lib; {
description = "The Mac OS libc/libSystem (tapi library with pure headers)";
maintainers = with maintainers; [ copumpkin gridaphobe ];
platforms = platforms.darwin;
license = licenses.apsl20;
};
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
_mach_init_routine

View file

@ -0,0 +1,10 @@
{ appleDerivation, xcbuildHook, IOKit }:
appleDerivation {
nativeBuildInputs = [ xcbuildHook ];
buildInputs = [ IOKit ];
xcbuildFlags = [ "-target" "caffeinate" ];
installPhase = ''
install -D Products/Deployment/caffeinate $out/bin/caffeinate
'';
}

View file

@ -0,0 +1,117 @@
{ appleDerivation', stdenv, darwin-stubs }:
appleDerivation' stdenv {
phases = [ "unpackPhase" "installPhase" ];
__propagatedImpureHostDeps = [
"/System/Library/Frameworks/Security.framework/Security"
"/System/Library/Frameworks/Security.framework/Resources"
"/System/Library/Frameworks/Security.framework/PlugIns"
"/System/Library/Frameworks/Security.framework/XPCServices"
"/System/Library/Frameworks/Security.framework/Versions"
];
installPhase = ''
mkdir -p $out/Library/Frameworks/Security.framework
###### IMPURITIES
ln -s /System/Library/Frameworks/Security.framework/{Resources,Plugins,XPCServices} \
$out/Library/Frameworks/Security.framework
###### STUBS
cp ${darwin-stubs}/System/Library/Frameworks/Security.framework/Versions/A/Security.tbd \
$out/Library/Frameworks/Security.framework
###### HEADERS
export dest=$out/Library/Frameworks/Security.framework/Headers
mkdir -p $dest
cp libsecurity_asn1/lib/SecAsn1Coder.h $dest
cp libsecurity_asn1/lib/SecAsn1Templates.h $dest
cp libsecurity_asn1/lib/SecAsn1Types.h $dest
cp libsecurity_asn1/lib/oidsalg.h $dest
cp libsecurity_asn1/lib/oidsattr.h $dest
cp libsecurity_authorization/lib/AuthSession.h $dest
cp libsecurity_authorization/lib/Authorization.h $dest
cp libsecurity_authorization/lib/AuthorizationDB.h $dest
cp libsecurity_authorization/lib/AuthorizationPlugin.h $dest
cp libsecurity_authorization/lib/AuthorizationTags.h $dest
cp libsecurity_cms/lib/CMSDecoder.h $dest
cp libsecurity_cms/lib/CMSEncoder.h $dest
cp libsecurity_codesigning/lib/CSCommon.h $dest
cp libsecurity_codesigning/lib/CodeSigning.h $dest
cp libsecurity_codesigning/lib/SecCode.h $dest
cp libsecurity_codesigning/lib/SecCodeHost.h $dest
cp libsecurity_codesigning/lib/SecRequirement.h $dest
cp libsecurity_codesigning/lib/SecStaticCode.h $dest
cp libsecurity_codesigning/lib/SecTask.h $dest
cp libsecurity_cssm/lib/certextensions.h $dest
cp libsecurity_cssm/lib/cssm.h $dest
cp libsecurity_cssm/lib/cssmaci.h $dest
cp libsecurity_cssm/lib/cssmapi.h $dest
cp libsecurity_cssm/lib/cssmapple.h $dest
cp libsecurity_cssm/lib/cssmcli.h $dest
cp libsecurity_cssm/lib/cssmconfig.h $dest
cp libsecurity_cssm/lib/cssmcspi.h $dest
cp libsecurity_cssm/lib/cssmdli.h $dest
cp libsecurity_cssm/lib/cssmerr.h $dest
cp libsecurity_cssm/lib/cssmkrapi.h $dest
cp libsecurity_cssm/lib/cssmkrspi.h $dest
cp libsecurity_cssm/lib/cssmspi.h $dest
cp libsecurity_cssm/lib/cssmtpi.h $dest
cp libsecurity_cssm/lib/cssmtype.h $dest
cp libsecurity_cssm/lib/eisl.h $dest
cp libsecurity_cssm/lib/emmspi.h $dest
cp libsecurity_cssm/lib/emmtype.h $dest
cp libsecurity_cssm/lib/oidsbase.h $dest
cp libsecurity_cssm/lib/oidscert.h $dest
cp libsecurity_cssm/lib/oidscrl.h $dest
cp libsecurity_cssm/lib/x509defs.h $dest
cp libsecurity_keychain/lib/SecACL.h $dest
cp libsecurity_keychain/lib/SecAccess.h $dest
cp libsecurity_keychain/lib/SecBase.h $dest
cp libsecurity_keychain/lib/SecCertificate.h $dest
cp libsecurity_keychain/lib/SecCertificatePriv.h $dest # Private
cp libsecurity_keychain/lib/SecCertificateOIDs.h $dest
cp libsecurity_keychain/lib/SecIdentity.h $dest
cp libsecurity_keychain/lib/SecIdentitySearch.h $dest
cp libsecurity_keychain/lib/SecImportExport.h $dest
cp libsecurity_keychain/lib/SecItem.h $dest
cp libsecurity_keychain/lib/SecKey.h $dest
cp libsecurity_keychain/lib/SecKeychain.h $dest
cp libsecurity_keychain/lib/SecKeychainItem.h $dest
cp libsecurity_keychain/lib/SecKeychainSearch.h $dest
cp libsecurity_keychain/lib/SecPolicy.h $dest
cp libsecurity_keychain/lib/SecPolicySearch.h $dest
cp libsecurity_keychain/lib/SecRandom.h $dest
cp libsecurity_keychain/lib/SecTrust.h $dest
cp libsecurity_keychain/lib/SecTrustSettings.h $dest
cp libsecurity_keychain/lib/SecTrustedApplication.h $dest
cp libsecurity_keychain/lib/Security.h $dest
cp libsecurity_manifest/lib/SecureDownload.h $dest
cp libsecurity_mds/lib/mds.h $dest
cp libsecurity_mds/lib/mds_schema.h $dest
cp libsecurity_ssl/lib/CipherSuite.h $dest
cp libsecurity_ssl/lib/SecureTransport.h $dest
cp libsecurity_transform/lib/SecCustomTransform.h $dest
cp libsecurity_transform/lib/SecDecodeTransform.h $dest
cp libsecurity_transform/lib/SecDigestTransform.h $dest
cp libsecurity_transform/lib/SecEncodeTransform.h $dest
cp libsecurity_transform/lib/SecEncryptTransform.h $dest
cp libsecurity_transform/lib/SecReadTransform.h $dest
cp libsecurity_transform/lib/SecSignVerifyTransform.h $dest
cp libsecurity_transform/lib/SecTransform.h $dest
cp libsecurity_transform/lib/SecTransformReadTransform.h $dest
'';
}

View file

@ -0,0 +1,19 @@
{ appleDerivation, xcbuildHook, xpc, dtrace, xnu }:
appleDerivation {
nativeBuildInputs = [ xcbuildHook dtrace ];
# buildInputs = [ Foundation xpc darling ];
buildInputs = [ xpc xnu ];
xcbuildFlags = [ "-target" "Security_frameworks_osx" ];
# NIX_CFLAGS_COMPILE = "-Wno-error -I${xnu}/include/libkern -DPRIVATE -I${xnu}/Library/Frameworks/System.framework/Headers";
preBuild = ''
dtrace -h -C -s OSX/libsecurity_utilities/lib/security_utilities.d -o OSX/libsecurity_utilities/lib/utilities_dtrace.h
xcodebuild SYMROOT=$PWD/Products OBJROOT=$PWD/Intermediates -target copyHeadersToSystem
NIX_CFLAGS_COMPILE+=" -F./Products/Release"
ln -s $PWD/Products/Release/Security.bundle/Contents $PWD/Products/Release/Security.framework
'';
}

View file

@ -0,0 +1,92 @@
{ lib, stdenv, buildPackages, appleDerivation, fetchzip, bsdmake, perl, flex, bison
}:
# this derivation sucks
# locale data was removed after adv_cmds-118, so our base is that because it's easier than
# replicating the bizarre bsdmake file structure
#
# sadly adv_cmds-118 builds a mklocale and colldef that generate files that our libc can no
# longer understand
#
# the more recent adv_cmds release is used for everything else in this package
let recentAdvCmds = fetchzip {
url = "https://opensource.apple.com/tarballs/adv_cmds/adv_cmds-158.tar.gz";
sha256 = "0z081kcprzg5jcvqivfnwvvv6wfxzkjg2jc2lagsf8c7j7vgm8nn";
};
in appleDerivation {
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ bsdmake perl bison flex ];
buildInputs = [ flex ];
patchPhase = ''
substituteInPlace BSDmakefile \
--replace chgrp true \
--replace /Developer/Makefiles/bin/compress-man-pages.pl true \
--replace "ps.tproj" "" --replace "gencat.tproj" "" --replace "md.tproj" "" \
--replace "tabs.tproj" "" --replace "cap_mkdb.tproj" "" \
--replace "!= tconf --test TARGET_OS_EMBEDDED" "= NO"
substituteInPlace Makefile --replace perl true
for subproject in colldef mklocale monetdef msgdef numericdef timedef; do
substituteInPlace usr-share-locale.tproj/$subproject/BSDmakefile \
--replace /usr/share/locale "" \
--replace '-o ''${BINOWN} -g ''${BINGRP}' "" \
--replace "rsync -a" "cp -r"
done
'';
preBuild = ''
cp -r --no-preserve=all ${recentAdvCmds}/colldef .
pushd colldef
mv locale/collate.h .
flex -t -8 -i scan.l > scan.c
yacc -d parse.y
clang *.c -o colldef -lfl
popd
mv colldef/colldef colldef.tproj/colldef
cp -r --no-preserve=all ${recentAdvCmds}/mklocale .
pushd mklocale
flex -t -8 -i lex.l > lex.c
yacc -d yacc.y
clang *.c -o mklocale -lfl
popd
mv mklocale/mklocale mklocale.tproj/mklocale
'';
buildPhase = ''
runHook preBuild
bsdmake -C usr-share-locale.tproj
${stdenv.cc.targetPrefix}clang ${recentAdvCmds}/ps/*.c -o ps
'';
installPhase = ''
bsdmake -C usr-share-locale.tproj install DESTDIR="$locale/share/locale"
# need to get rid of runtime dependency on flex
# install -d 0755 $locale/bin
# install -m 0755 colldef.tproj/colldef $locale/bin
# install -m 0755 mklocale.tproj/mklocale $locale/bin
install -d 0755 $ps/bin
install ps $ps/bin/ps
touch "$out"
'';
outputs = [
"out"
"ps"
"locale"
];
setOutputFlags = false;
meta = {
platforms = lib.platforms.darwin;
maintainers = with lib.maintainers; [ gridaphobe ];
};
}

View file

@ -0,0 +1,51 @@
{ lib, appleDerivation, xcbuild, ncurses, libutil }:
appleDerivation {
# We can't just run the root build, because https://github.com/facebook/xcbuild/issues/264
patchPhase = ''
substituteInPlace adv_cmds.xcodeproj/project.pbxproj \
--replace '/usr/lib/libtermcap.dylib' 'libncurses.dylib'
'';
# pkill requires special private headers that are unavailable in
# NixPkgs. These ones are needed:
# - xpc/xpxc.h
# - os/base_private.h
# - _simple.h
# We disable it here for now. TODO: build pkill inside adv_cmds
buildPhase = ''
targets=$(xcodebuild -list \
| awk '/Targets:/{p=1;print;next} p&&/^\s*$/{p=0};p' \
| tail -n +2 | sed 's/^[ \t]*//' \
| grep -v -e Desktop -e Embedded -e mklocale -e pkill -e pgrep -e colldef)
for i in $targets; do
xcodebuild SYMROOT=$PWD/Products OBJROOT=$PWD/Intermediates -target $i
done
'';
# temporary install phase until xcodebuild has "install" support
installPhase = ''
for f in Products/Release/*; do
if [ -f $f ]; then
install -D $f $out/bin/$(basename $f)
fi
done
mkdir -p $out/System/Library/LaunchDaemons
install fingerd/finger.plist $out/System/Library/LaunchDaemons
# from variant_links.sh
# ln -s $out/bin/pkill $out/bin/pgrep
# ln -s $out/share/man/man1/pkill.1 $out/share/man/man1/pgrep.1
'';
nativeBuildInputs = [ xcbuild ];
buildInputs = [ ncurses libutil ];
meta = {
platforms = lib.platforms.darwin;
maintainers = with lib.maintainers; [ matthewbauer ];
};
}

View file

@ -0,0 +1,39 @@
{ lib, appleDerivation', stdenvNoCC }:
appleDerivation' stdenvNoCC {
dontBuild = true;
postPatch = ''
substituteInPlace Makefile \
--replace '/bin/mkdir' 'mkdir' \
--replace '/usr/bin/install' 'install'
'';
installFlags = [ "EXPORT_DSTDIR=/include/architecture" ];
DSTROOT = "$(out)";
appleHeaders = ''
architecture/alignment.h
architecture/byte_order.h
architecture/i386/alignment.h
architecture/i386/asm_help.h
architecture/i386/byte_order.h
architecture/i386/cpu.h
architecture/i386/desc.h
architecture/i386/fpu.h
architecture/i386/frame.h
architecture/i386/io.h
architecture/i386/pio.h
architecture/i386/reg_help.h
architecture/i386/sel.h
architecture/i386/table.h
architecture/i386/tss.h
'';
meta = with lib; {
maintainers = with maintainers; [ copumpkin ];
platforms = platforms.darwin;
license = licenses.apsl20;
};
}

View file

@ -0,0 +1,32 @@
{ lib, appleDerivation, xcbuildHook }:
appleDerivation {
nativeBuildInputs = [ xcbuildHook ];
# These PBXcp calls should be patched in xcbuild to allow them to
# automatically be prefixed.
patchPhase = ''
substituteInPlace basic_cmds.xcodeproj/project.pbxproj \
--replace "dstPath = /usr/share/man/man1;" "dstPath = $out/share/man/man1;" \
--replace "dstPath = /usr/share/man/man5;" "dstPath = $out/share/man/man5;"
'';
# temporary install phase until xcodebuild has "install" support
installPhase = ''
for f in Products/Release/*; do
if [ -f $f ]; then
install -D $f $out/bin/$(basename $f)
fi
done
for n in 1; do
mkdir -p $out/share/man/man$n
install */*.$n $out/share/man/man$n
done
'';
meta = {
platforms = lib.platforms.darwin;
maintainers = with lib.maintainers; [ matthewbauer ];
};
}

View file

@ -0,0 +1,43 @@
{ lib, appleDerivation, stdenv, bison, flex }:
let
# Hard to get CC to pull this off without infinite recursion
targetTargetPrefix = lib.optionalString
(with stdenv; hostPlatform != targetPlatform)
(stdenv.targetPlatform.config + "-");
in
appleDerivation {
nativeBuildInputs = [ bison flex ];
buildPhase = ''
cd migcom.tproj
# redundant file, don't know why apple not removing it.
rm handler.c
yacc -d parser.y
flex --header-file=lexxer.yy.h -o lexxer.yy.c lexxer.l
$CC -std=gnu99 -Os -dead_strip -DMIG_VERSION=\"$pname-$version\" -I. -o migcom *.c
'';
installPhase = ''
mkdir -p $out/bin $out/libexec $out/share/man/man1
chmod +x mig.sh
cp mig.sh $out/bin/mig
cp migcom $out/libexec
ln -s $out/libexec/migcom $out/bin/migcom
cp mig.1 $out/share/man/man1
cp migcom.1 $out/share/man/man1
substituteInPlace $out/bin/mig \
--replace 'arch=`/usr/bin/arch`' 'arch=${stdenv.targetPlatform.darwinArch}' \
--replace '/usr/bin/' "" \
--replace '/bin/rmdir' "rmdir" \
--replace 'C=''${MIGCC}' "C=${targetTargetPrefix}cc"
'';
}

View file

@ -0,0 +1,49 @@
{ lib, appleDerivation, makeWrapper }:
appleDerivation {
nativeBuildInputs = [ makeWrapper ];
patchPhase = ''
substituteInPlace mk/bsd.prog.mk \
--replace '-o ''${BINOWN} -g ''${BINGRP}' "" \
--replace '-o ''${SCRIPTSOWN_''${.ALLSRC:T}}' "" \
--replace '-g ''${SCRIPTSGRP_''${.ALLSRC:T}}' ""
substituteInPlace mk/bsd.lib.mk --replace '-o ''${LIBOWN} -g ''${LIBGRP}' ""
substituteInPlace mk/bsd.info.mk --replace '-o ''${INFOOWN} -g ''${INFOGRP}' ""
substituteInPlace mk/bsd.doc.mk --replace '-o ''${BINOWN} -g ''${BINGRP}' ""
substituteInPlace mk/bsd.man.mk --replace '-o ''${MANOWN} -g ''${MANGRP}' ""
substituteInPlace mk/bsd.files.mk \
--replace '-o ''${''${group}OWN_''${.ALLSRC:T}}' "" \
--replace '-g ''${''${group}GRP_''${.ALLSRC:T}}' "" \
--replace '-o ''${''${group}OWN} -g ''${''${group}GRP}' ""
substituteInPlace mk/bsd.incs.mk \
--replace '-o ''${''${group}OWN_''${.ALLSRC:T}}' "" \
--replace '-g ''${''${group}GRP_''${.ALLSRC:T}}' "" \
--replace '-o ''${''${group}OWN} -g ''${''${group}GRP}' ""
'';
buildPhase = ''
objs=()
for file in $(find . -name '*.c'); do
obj="$(basename "$file" .c).o"
objs+=("$obj")
$CC -c "$file" -o "$obj" -DDEFSHELLNAME='"sh"' -D__FBSDID=__RCSID -mdynamic-no-pic -g
done
$CC "''${objs[@]}" -o bsdmake
'';
installPhase = ''
install -d 0644 $out/bin
install -m 0755 bsdmake $out/bin
install -d 0644 $out/share/mk
install -m 0755 mk/* $out/share/mk
'';
preFixup = ''
wrapProgram "$out/bin/bsdmake" --add-flags "-m $out/share/mk"
'';
meta = {
platforms = lib.platforms.darwin;
};
}

View file

@ -0,0 +1,216 @@
{ lib, stdenv, appleDerivation', launchd, bootstrap_cmds, xnu, ppp, IOKit, eap8021x, Security
, headersOnly ? false }:
appleDerivation' stdenv {
meta.broken = stdenv.cc.nativeLibc;
nativeBuildInputs = lib.optionals (!headersOnly) [ bootstrap_cmds ];
buildInputs = lib.optionals (!headersOnly) [ launchd ppp IOKit eap8021x ];
propagatedBuildInputs = lib.optionals (!headersOnly) [ Security ];
patchPhase = lib.optionalString (!headersOnly) ''
HACK=$PWD/hack
mkdir $HACK
cp -r ${xnu}/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/net $HACK
substituteInPlace SystemConfiguration.fproj/SCNetworkReachabilityInternal.h \
--replace '#include <xpc/xpc.h>' ""
substituteInPlace SystemConfiguration.fproj/SCNetworkReachability.c \
--replace ''$'#define\tHAVE_VPN_STATUS' ""
substituteInPlace SystemConfiguration.fproj/reachability/SCNetworkReachabilityServer_client.c \
--replace '#include <xpc/xpc.h>' '#include "fake_xpc.h"' \
--replace '#include <xpc/private.h>' "" \
# Our neutered CoreFoundation doesn't have this function, but I think we'll live...
substituteInPlace SystemConfiguration.fproj/SCNetworkConnectionPrivate.c \
--replace 'CFPreferencesAppValueIsForced(serviceID, USER_PREFERENCES_APPLICATION_ID)' 'FALSE' \
--replace 'CFPreferencesAppValueIsForced(userPrivate->serviceID, USER_PREFERENCES_APPLICATION_ID)' 'FALSE'
cat >SystemConfiguration.fproj/fake_xpc.h <<EOF
typedef void *xpc_type_t;
typedef void *xpc_object_t;
typedef void *xpc_connection_t;
xpc_type_t xpc_get_type(xpc_object_t object);
xpc_object_t xpc_dictionary_create(const char * const *keys, const xpc_object_t *values, size_t count);
char *xpc_copy_description(xpc_object_t object);
int64_t xpc_dictionary_get_int64(xpc_object_t xdict, const char *key);
uint64_t xpc_dictionary_get_uint64(xpc_object_t xdict, const char *key);
void xpc_connection_set_event_handler(xpc_connection_t connection, void *handler);
extern const struct _xpc_type_s _xpc_type_error;
#define XPC_TYPE_ERROR (&_xpc_type_error)
extern const struct _xpc_type_s _xpc_type_dictionary;
#define XPC_TYPE_DICTIONARY (&_xpc_type_dictionary)
extern const struct _xpc_type_s _xpc_type_array;
#define XPC_TYPE_ARRAY (&_xpc_type_array)
extern const struct _xpc_dictionary_s _xpc_error_connection_interrupted;
#define XPC_ERROR_CONNECTION_INTERRUPTED (&_xpc_error_connection_interrupted)
extern const struct _xpc_dictionary_s _xpc_error_connection_invalid;
#define XPC_ERROR_CONNECTION_INVALID (&_xpc_error_connection_invalid)
extern const char *const _xpc_error_key_description;
#define XPC_ERROR_KEY_DESCRIPTION _xpc_error_key_description
#define XPC_CONNECTION_MACH_SERVICE_PRIVILEGED (1 << 1)
EOF
'';
dontBuild = headersOnly;
buildPhase = ''
pushd SystemConfiguration.fproj >/dev/null
mkdir -p SystemConfiguration.framework/Resources
cp ../get-mobility-info SystemConfiguration.framework/Resources
cp Info.plist SystemConfiguration.framework/Resources
cp -r English.lproj SystemConfiguration.framework/Resources
cp NetworkConfiguration.plist SystemConfiguration.framework/Resources
mkdir -p SystemConfiguration.framework/Headers
mkdir -p SystemConfiguration.framework/PrivateHeaders
# The standard public headers
cp SCSchemaDefinitions.h SystemConfiguration.framework/Headers
cp SystemConfiguration.h SystemConfiguration.framework/Headers
cp SCDynamicStore.h SystemConfiguration.framework/Headers
cp SCDynamicStoreCopySpecific.h SystemConfiguration.framework/Headers
cp SCPreferences.h SystemConfiguration.framework/Headers
cp CaptiveNetwork.h SystemConfiguration.framework/Headers
cp SCPreferencesPath.h SystemConfiguration.framework/Headers
cp SCDynamicStoreKey.h SystemConfiguration.framework/Headers
cp SCPreferencesSetSpecific.h SystemConfiguration.framework/Headers
cp SCNetworkConfiguration.h SystemConfiguration.framework/Headers
cp SCNetworkConnection.h SystemConfiguration.framework/Headers
cp SCNetworkReachability.h SystemConfiguration.framework/Headers
cp DHCPClientPreferences.h SystemConfiguration.framework/Headers
cp SCNetwork.h SystemConfiguration.framework/Headers
cp SCDynamicStoreCopyDHCPInfo.h SystemConfiguration.framework/Headers
# TODO: Do we want to preserve private headers or just make them public?
cp SCDPlugin.h SystemConfiguration.framework/PrivateHeaders
cp SCPrivate.h SystemConfiguration.framework/PrivateHeaders
cp SCDynamicStorePrivate.h SystemConfiguration.framework/PrivateHeaders
cp SCDynamicStoreCopySpecificPrivate.h SystemConfiguration.framework/PrivateHeaders
cp SCDynamicStoreSetSpecificPrivate.h SystemConfiguration.framework/PrivateHeaders
cp SCValidation.h SystemConfiguration.framework/PrivateHeaders
cp SCPreferencesPrivate.h SystemConfiguration.framework/PrivateHeaders
cp DeviceOnHold.h SystemConfiguration.framework/PrivateHeaders
cp LinkConfiguration.h SystemConfiguration.framework/PrivateHeaders
cp SCPreferencesPathKey.h SystemConfiguration.framework/PrivateHeaders
cp SCPreferencesSetSpecificPrivate.h SystemConfiguration.framework/PrivateHeaders
cp SCNetworkConnectionPrivate.h SystemConfiguration.framework/PrivateHeaders
cp SCPreferencesGetSpecificPrivate.h SystemConfiguration.framework/PrivateHeaders
cp SCSchemaDefinitionsPrivate.h SystemConfiguration.framework/PrivateHeaders
cp SCNetworkConfigurationPrivate.h SystemConfiguration.framework/PrivateHeaders
cp SCPreferencesKeychainPrivate.h SystemConfiguration.framework/PrivateHeaders
cp SCNetworkSignature.h SystemConfiguration.framework/PrivateHeaders
cp SCNetworkSignaturePrivate.h SystemConfiguration.framework/PrivateHeaders
cp VPNPrivate.h SystemConfiguration.framework/PrivateHeaders
cp VPNConfiguration.h SystemConfiguration.framework/PrivateHeaders
cp VPNTunnelPrivate.h SystemConfiguration.framework/PrivateHeaders
cp VPNTunnel.h SystemConfiguration.framework/PrivateHeaders
mkdir derived
cat >derived/SystemConfiguration_vers.c <<EOF
const unsigned char SystemConfigurationVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:SystemConfiguration PROJECT:configd-" "\n"; const double SystemConfigurationVersionNumber __attribute__ ((used)) = (double)0.;
EOF
mig -arch x86_64 -header derived/shared_dns_info.h -user derived/shared_dns_infoUser.c -sheader /dev/null -server /dev/null ../dnsinfo/shared_dns_info.defs
mig -arch x86_64 -header derived/config.h -user derived/configUser.c -sheader /dev/null -server /dev/null config.defs
mig -arch x86_64 -header derived/helper.h -user derived/helperUser.c -sheader /dev/null -server /dev/null helper/helper.defs
mig -arch x86_64 -header derived/pppcontroller.h -user derived/pppcontrollerUser.c -sheader /dev/null -server /dev/null pppcontroller.defs
$CC -I. -Ihelper -Iderived -F. -c SCSchemaDefinitions.c -o SCSchemaDefinitions.o
$CC -I. -Ihelper -Iderived -F. -c SCD.c -o SCD.o
$CC -I. -Ihelper -Iderived -F. -c SCDKeys.c -o SCDKeys.o
$CC -I. -Ihelper -Iderived -F. -c SCDPrivate.c -o SCDPrivate.o
$CC -I. -Ihelper -Iderived -F. -c SCDPlugin.c -o SCDPlugin.o
$CC -I. -Ihelper -Iderived -F. -c CaptiveNetwork.c -o CaptiveNetwork.o
$CC -I. -Ihelper -Iderived -F. -c SCDOpen.c -o SCDOpen.o
$CC -I. -Ihelper -Iderived -F. -c SCDList.c -o SCDList.o
$CC -I. -Ihelper -Iderived -F. -c SCDAdd.c -o SCDAdd.o
$CC -I. -Ihelper -Iderived -F. -c SCDGet.c -o SCDGet.o
$CC -I. -Ihelper -Iderived -F. -c SCDSet.c -o SCDSet.o
$CC -I. -Ihelper -Iderived -F. -c SCDRemove.c -o SCDRemove.o
$CC -I. -Ihelper -Iderived -F. -c SCDNotify.c -o SCDNotify.o
$CC -I. -Ihelper -Iderived -F. -c SCDNotifierSetKeys.c -o SCDNotifierSetKeys.o
$CC -I. -Ihelper -Iderived -F. -c SCDNotifierAdd.c -o SCDNotifierAdd.o
$CC -I. -Ihelper -Iderived -F. -c SCDNotifierRemove.c -o SCDNotifierRemove.o
$CC -I. -Ihelper -Iderived -F. -c SCDNotifierGetChanges.c -o SCDNotifierGetChanges.o
$CC -I. -Ihelper -Iderived -F. -c SCDNotifierWait.c -o SCDNotifierWait.o
$CC -I. -Ihelper -Iderived -F. -c SCDNotifierInformViaCallback.c -o SCDNotifierInformViaCallback.o
$CC -I. -Ihelper -Iderived -F. -c SCDNotifierInformViaFD.c -o SCDNotifierInformViaFD.o
$CC -I. -Ihelper -Iderived -F. -c SCDNotifierInformViaSignal.c -o SCDNotifierInformViaSignal.o
$CC -I. -Ihelper -Iderived -F. -c SCDNotifierCancel.c -o SCDNotifierCancel.o
$CC -I. -Ihelper -Iderived -F. -c SCDSnapshot.c -o SCDSnapshot.o
$CC -I. -Ihelper -Iderived -F. -c SCP.c -o SCP.o
$CC -I. -Ihelper -Iderived -F. -c SCPOpen.c -o SCPOpen.o
$CC -I. -Ihelper -Iderived -F. -c SCPLock.c -o SCPLock.o
$CC -I. -Ihelper -Iderived -F. -c SCPUnlock.c -o SCPUnlock.o
$CC -I. -Ihelper -Iderived -F. -c SCPList.c -o SCPList.o
$CC -I. -Ihelper -Iderived -F. -c SCPGet.c -o SCPGet.o
$CC -I. -Ihelper -Iderived -F. -c SCPAdd.c -o SCPAdd.o
$CC -I. -Ihelper -Iderived -F. -c SCPSet.c -o SCPSet.o
$CC -I. -Ihelper -Iderived -F. -c SCPRemove.c -o SCPRemove.o
$CC -I. -Ihelper -Iderived -F. -c SCPCommit.c -o SCPCommit.o
$CC -I. -Ihelper -Iderived -F. -c SCPApply.c -o SCPApply.o
$CC -I. -Ihelper -Iderived -F. -c SCPPath.c -o SCPPath.o
$CC -I. -Ihelper -Iderived -F. -c SCDConsoleUser.c -o SCDConsoleUser.o
$CC -I. -Ihelper -Iderived -F. -c SCDHostName.c -o SCDHostName.o
$CC -I. -Ihelper -Iderived -F. -c SCLocation.c -o SCLocation.o
$CC -I. -Ihelper -Iderived -F. -c SCNetwork.c -o SCNetwork.o
$CC -I. -Ihelper -Iderived -F. -c derived/pppcontrollerUser.c -o pppcontrollerUser.o
$CC -I. -Ihelper -Iderived -F. -c SCNetworkConnection.c -o SCNetworkConnection.o
$CC -I. -Ihelper -Iderived -F. -c SCNetworkConnectionPrivate.c -o SCNetworkConnectionPrivate.o
$CC -I. -Ihelper -Iderived -I../dnsinfo -F. -c SCNetworkReachability.c -o SCNetworkReachability.o
$CC -I. -Ihelper -Iderived -F. -c SCProxies.c -o SCProxies.o
$CC -I. -Ihelper -Iderived -F. -c DHCP.c -o DHCP.o
$CC -I. -Ihelper -Iderived -F. -c moh.c -o moh.o
$CC -I. -Ihelper -Iderived -F. -c DeviceOnHold.c -o DeviceOnHold.o
$CC -I. -Ihelper -Iderived -I $HACK -F. -c LinkConfiguration.c -o LinkConfiguration.o
$CC -I. -Ihelper -Iderived -F. -c dy_framework.c -o dy_framework.o
$CC -I. -Ihelper -Iderived -I $HACK -F. -c VLANConfiguration.c -o VLANConfiguration.o
$CC -I. -Ihelper -Iderived -F. -c derived/configUser.c -o configUser.o
$CC -I. -Ihelper -Iderived -F. -c SCPreferencesPathKey.c -o SCPreferencesPathKey.o
$CC -I. -Ihelper -Iderived -I../dnsinfo -F. -c derived/shared_dns_infoUser.c -o shared_dns_infoUser.o
$CC -I. -Ihelper -Iderived -F. -c SCNetworkConfigurationInternal.c -o SCNetworkConfigurationInternal.o
$CC -I. -Ihelper -Iderived -F. -c SCNetworkInterface.c -o SCNetworkInterface.o
$CC -I. -Ihelper -Iderived -F. -c SCNetworkProtocol.c -o SCNetworkProtocol.o
$CC -I. -Ihelper -Iderived -F. -c SCNetworkService.c -o SCNetworkService.o
$CC -I. -Ihelper -Iderived -F. -c SCNetworkSet.c -o SCNetworkSet.o
$CC -I. -Ihelper -Iderived -I $HACK -F. -c BondConfiguration.c -o BondConfiguration.o
$CC -I. -Ihelper -Iderived -I $HACK -F. -c BridgeConfiguration.c -o BridgeConfiguration.o
$CC -I. -Ihelper -Iderived -F. -c helper/SCHelper_client.c -o SCHelper_client.o
$CC -I. -Ihelper -Iderived -F. -c SCPreferencesKeychainPrivate.c -o SCPreferencesKeychainPrivate.o
$CC -I. -Ihelper -Iderived -F. -c SCNetworkSignature.c -o SCNetworkSignature.o
$CC -I. -Ihelper -Iderived -F. -c VPNPrivate.c -o VPNPrivate.o
$CC -I. -Ihelper -Iderived -F. -c VPNConfiguration.c -o VPNConfiguration.o
$CC -I. -Ihelper -Iderived -F. -c VPNTunnel.c -o VPNTunnel.o
$CC -I. -Ihelper -Iderived -F. -c derived/helperUser.c -o helperUser.o
$CC -I. -Ihelper -Iderived -F. -c reachability/SCNetworkReachabilityServer_client.c -o SCNetworkReachabilityServer_client.o
$CC -I. -Ihelper -Iderived -F. -c reachability/rb.c -o rb.o
$CC -I. -Ihelper -Iderived -F. -c derived/SystemConfiguration_vers.c -o SystemConfiguration_vers.o
$CC -dynamiclib *.o -install_name $out/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration -dead_strip -framework CoreFoundation -single_module -o SystemConfiguration.framework/SystemConfiguration
popd >/dev/null
'';
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

@ -0,0 +1,9 @@
{ appleDerivation', stdenvNoCC }:
appleDerivation' stdenvNoCC {
dontBuild = true;
installPhase = ''
mkdir -p $out/include/
cp copyfile.h $out/include/
'';
}

View file

@ -0,0 +1,315 @@
{ lib, stdenv, fetchurl, fetchzip, pkgs }:
let
# This attrset can in theory be computed automatically, but for that to work nicely we need
# import-from-derivation to work properly. Currently it's rather ugly when we try to bootstrap
# a stdenv out of something like this. With some care we can probably get rid of this, but for
# now it's staying here.
versions = {
"osx-10.12.6" = {
xnu = "3789.70.16";
libiconv = "50";
Libnotify = "165.20.1";
objc4 = "709.1";
dyld = "433.5";
CommonCrypto = "60092.50.5";
copyfile = "138";
ppp = "838.50.1";
libclosure = "67";
Libinfo = "503.50.4";
Libsystem = "1238.60.2";
removefile = "45";
libresolv = "64";
libplatform = "126.50.8";
mDNSResponder = "765.50.9";
libutil = "47.30.1";
libunwind = "35.3";
Libc = "1158.50.2";
dtrace = "209.50.12";
libpthread = "218.60.3";
hfs = "366.70.1";
};
"osx-10.11.6" = {
PowerManagement = "572.50.1";
dtrace = "168";
xnu = "3248.60.10";
libpthread = "138.10.4";
libiconv = "44";
Libnotify = "150.40.1";
objc4 = "680";
eap8021x = "222.40.1";
dyld = "360.22";
architecture = "268";
CommonCrypto = "60075.50.1";
copyfile = "127";
Csu = "85";
ppp = "809.50.2";
libclosure = "65";
Libinfo = "477.50.4";
Libsystem = "1226.10.1";
removefile = "41";
libresolv = "60";
# Their release page is a bit of a mess here, so I'm going to lie a bit and say this version
# is the right one, even though it isn't. The version I have here doesn't appear to be linked
# to any OS releases, but Apple also doesn't mention mDNSResponder from 10.11 to 10.11.6, and
# neither of those versions are publicly available.
libplatform = "125";
mDNSResponder = "625.41.2";
# IOKit contains a set of packages with different versions, so we don't have a general version
IOKit = "";
libutil = "43";
libunwind = "35.3";
Librpcsvc = "26";
developer_cmds= "62";
network_cmds = "481.20.1";
basic_cmds = "55";
adv_cmds = "163";
file_cmds = "264.1.1";
shell_cmds = "187";
system_cmds = "550.6";
diskdev_cmds = "593";
top = "108";
text_cmds = "99";
};
"osx-10.11.5" = {
Libc = "1082.50.1"; # 10.11.6 still unreleased :/
};
"osx-10.10.5" = {
adv_cmds = "158";
CF = "1153.18";
ICU = "531.48";
libdispatch = "442.1.4";
Security = "57031.40.6";
IOAudioFamily = "203.3";
IOFireWireFamily = "458";
IOFWDVComponents = "207.4.1";
IOFireWireAVC = "423";
IOFireWireSBP2 = "427";
IOFireWireSerialBusProtocolTransport = "251.0.1";
IOGraphics = "485.40.1";
IOHIDFamily = "606.40.1";
IONetworkingFamily = "101";
IOSerialFamily = "74.20.1";
IOStorageFamily = "182.1.1";
IOBDStorageFamily = "14";
IOCDStorageFamily = "51";
IODVDStorageFamily = "35";
IOKitUser = "1050.20.2";
};
"osx-10.9.5" = {
launchd = "842.92.1";
libauto = "185.5";
Libc = "997.90.3"; # We use this, but not from here
Libsystem = "1197.1.1";
Security = "55471.14.18";
security_dotmac_tp = "55107.1";
IOStorageFamily = "172";
};
"osx-10.8.5" = {
configd = "453.19";
Libc = "825.40.1";
IOUSBFamily = "630.4.5";
};
"osx-10.8.4" = {
IOUSBFamily = "560.4.2";
};
"osx-10.7.4" = {
Libm = "2026";
};
"osx-10.6.2" = {
CarbonHeaders = "18.1";
};
"osx-10.5.8" = {
adv_cmds = "119";
};
"dev-tools-7.0" = {
bootstrap_cmds = "93";
};
"dev-tools-5.1" = {
bootstrap_cmds = "86";
};
"dev-tools-3.2.6" = {
bsdmake = "24";
};
};
fetchApple' = pname: version: sha256: let
# When cross-compiling, fetchurl depends on libiconv, resulting
# in an infinite recursion without this. It's not clear why this
# worked fine when not cross-compiling
fetch = if pname == "libiconv"
then stdenv.fetchurlBoot
else fetchurl;
in fetch {
url = "http://www.opensource.apple.com/tarballs/${pname}/${pname}-${version}.tar.gz";
inherit sha256;
};
fetchApple = sdkName: sha256: pname: let
version = versions.${sdkName}.${pname};
in fetchApple' pname version sha256;
appleDerivation'' = stdenv: pname: version: sdkName: sha256: attrs: stdenv.mkDerivation ({
inherit pname version;
src = if attrs ? srcs then null else (fetchApple' pname version sha256);
enableParallelBuilding = true;
# In rare cases, APPLE may drop some headers quietly on new release.
doInstallCheck = attrs ? appleHeaders;
passAsFile = [ "appleHeaders" ];
installCheckPhase = ''
cd $out/include
result=$(diff -u "$appleHeadersPath" <(find * -type f | sort) --label "Listed in appleHeaders" --label "Found in \$out/include" || true)
if [ -z "$result" ]; then
echo "Apple header list is matched."
else
echo >&2 "\
Apple header list is inconsistent, please ensure no header file is unexpectedly dropped.
$result
"
exit 1
fi
'';
} // attrs // {
meta = (with lib; {
platforms = platforms.darwin;
license = licenses.apsl20;
}) // (attrs.meta or {});
});
IOKitSpecs = {
IOAudioFamily = fetchApple "osx-10.10.5" "0ggq7za3iq8g02j16rj67prqhrw828jsw3ah3bxq8a1cvr55aqnq";
IOFireWireFamily = fetchApple "osx-10.10.5" "059qa1m668kwvchl90cqcx35b31zaqdg61zi11y1imn5s389y2g1";
IOFWDVComponents = fetchApple "osx-10.10.5" "1brr0yn6mxgapw3bvlhyissfksifzj2mqsvj9vmps6zwcsxjfw7m";
IOFireWireAVC = fetchApple "osx-10.10.5" "194an37gbqs9s5s891lmw6prvd1m2362602s8lj5m89fp9h8mbal";
IOFireWireSBP2 = fetchApple "osx-10.10.5" "1mym158kp46y1vfiq625b15ihh4jjbpimfm7d56wlw6l2syajqvi";
IOFireWireSerialBusProtocolTransport = fetchApple "osx-10.10.5" "09kiq907qpk94zbij1mrcfcnyyc5ncvlxavxjrj4v5braxm78lhi";
IOGraphics = fetchApple "osx-10.10.5" "1z0x3yrv0p8pfdqnvwf8rvrf9wip593lhm9q6yzbclz3fn53ad0p";
IOHIDFamily = fetchApple "osx-10.10.5" "0yibagwk74imp3j3skjycm703s5ybdqw0qlsmnml6zwjpbrz5894";
IONetworkingFamily = fetchApple "osx-10.10.5" "04as1hc8avncijf61mp9dmplz8vb1inhirkd1g74gah08lgrfs9j";
IOSerialFamily = fetchApple "osx-10.10.5" "0jh12aanxcigqi9w6wqzbwjdin9m48zwrhdj3n4ki0h41sg89y91";
IOStorageFamily = fetchApple "osx-10.9.5" "0w5yr8ppl82anwph2zba0ppjji6ipf5x410zhcm1drzwn4bbkxrj";
IOBDStorageFamily = fetchApple "osx-10.10.5" "1rbvmh311n853j5qb6hfda94vym9wkws5w736w2r7dwbrjyppc1q";
IOCDStorageFamily = fetchApple "osx-10.10.5" "1905sxwmpxdcnm6yggklc5zimx1558ygm3ycj6b34f9h48xfxzgy";
IODVDStorageFamily = fetchApple "osx-10.10.5" "1fv82rn199mi998l41c0qpnlp3irhqp2rb7v53pxbx7cra4zx3i6";
# There should be an IOStreamFamily project here, but they haven't released it :(
IOUSBFamily = fetchApple "osx-10.8.5" "1znqb6frxgab9mkyv7csa08c26p9p0ip6hqb4wm9c7j85kf71f4j"; # This is from 10.8 :(
IOUSBFamily_older = fetchApple "osx-10.8.4" "113lmpz8n6sibd27p42h8bl7a6c3myc6zngwri7gnvf8qlajzyml" "IOUSBFamily"; # This is even older :(
IOKitUser = fetchApple "osx-10.10.5" "1jzndziv97bhjxmla8nib5fpcswbvsxr04447g251ls81rw313lb";
# There should be an IOVideo here, but they haven't released it :(
};
IOKitSrcs = lib.mapAttrs (name: value: if lib.isFunction value then value name else value) IOKitSpecs;
in
# darwin package set
self:
let
macosPackages_11_0_1 = import ./macos-11.0.1.nix { inherit applePackage'; };
developerToolsPackages_11_3_1 = import ./developer-tools-11.3.1.nix { inherit applePackage'; };
applePackage' = namePath: version: sdkName: sha256:
let
pname = builtins.head (lib.splitString "/" namePath);
appleDerivation' = stdenv: appleDerivation'' stdenv pname version sdkName sha256;
appleDerivation = appleDerivation' stdenv;
callPackage = self.newScope { inherit appleDerivation' appleDerivation; };
in callPackage (./. + "/${namePath}");
applePackage = namePath: sdkName: sha256: let
pname = builtins.head (lib.splitString "/" namePath);
version = versions.${sdkName}.${pname};
in applePackage' namePath version sdkName sha256;
# Only used for bootstrapping. Its convenient because it was the last version to come with a real makefile.
adv_cmds-boot = applePackage "adv_cmds/boot.nix" "osx-10.5.8" "102ssayxbg9wb35mdmhswbnw0bg7js3pfd8fcbic83c5q3bqa6c6" {};
in
developerToolsPackages_11_3_1 // macosPackages_11_0_1 // {
# TODO: shorten this list, we should cut down to a minimum set of bootstrap or necessary packages here.
inherit (adv_cmds-boot) ps locale;
architecture = applePackage "architecture" "osx-10.11.6" "1pbpjcd7is69hn8y29i98ci0byik826if8gnp824ha92h90w0fq3" {};
bsdmake = applePackage "bsdmake" "dev-tools-3.2.6" "11a9kkhz5bfgi1i8kpdkis78lhc6b5vxmhd598fcdgra1jw4iac2" {};
CarbonHeaders = applePackage "CarbonHeaders" "osx-10.6.2" "1zam29847cxr6y9rnl76zqmkbac53nx0szmqm9w5p469a6wzjqar" {};
CommonCrypto = applePackage "CommonCrypto" "osx-10.12.6" "0sgsqjcxbdm2g2zfpc50mzmk4b4ldyw7xvvkwiayhpczg1fga4ff" {};
configd = applePackage "configd" "osx-10.8.5" "1gxakahk8gallf16xmhxhprdxkh3prrmzxnmxfvj0slr0939mmr2" {
Security = applePackage "Security/boot.nix" "osx-10.9.5" "1nv0dczf67dhk17hscx52izgdcyacgyy12ag0jh6nl5hmfzsn8yy" {};
};
copyfile = applePackage "copyfile" "osx-10.12.6" "0a70bvzndkava1a946cdq42lnjhg7i7b5alpii3lap6r5fkvas0n" {};
Csu = applePackage "Csu" "osx-10.11.6" "0yh5mslyx28xzpv8qww14infkylvc1ssi57imhi471fs91sisagj" {};
dtrace = applePackage "dtrace" "osx-10.12.6" "0hpd6348av463yqf70n3xkygwmf1i5zza8kps4zys52sviqz3a0l" {};
dyld = applePackage "dyld" "osx-10.12.6" "0q4jmk78b5ajn33blh4agyq6v2a63lpb3fln78az0dy12bnp1qqk" {};
eap8021x = applePackage "eap8021x" "osx-10.11.6" "0iw0qdib59hihyx2275rwq507bq2a06gaj8db4a8z1rkaj1frskh" {};
IOKit = applePackage "IOKit" "osx-10.11.6" "0kcbrlyxcyirvg5p95hjd9k8a01k161zg0bsfgfhkb90kh2s8x00" { inherit IOKitSrcs; };
launchd = applePackage "launchd" "osx-10.9.5" "0w30hvwqq8j5n90s3qyp0fccxflvrmmjnicjri4i1vd2g196jdgj" {};
libauto = applePackage "libauto" "osx-10.9.5" "17z27yq5d7zfkwr49r7f0vn9pxvj95884sd2k6lq6rfaz9gxqhy3" {};
Libc = applePackage "Libc" "osx-10.12.6" "183wcy1nlj2wkpfsx3k3lyv917mk8r2p72qw8lb89mbjsw3yw0xx" {
Libc_10-9 = fetchzip {
url = "http://www.opensource.apple.com/tarballs/Libc/Libc-997.90.3.tar.gz";
sha256 = "1xchgxkxg5288r2b9yfrqji2gsgdap92k4wx2dbjwslixws12pq7";
};
Libc_old = applePackage "Libc/825_40_1.nix" "osx-10.8.5" "0xsx1im52gwlmcrv4lnhhhn9dyk5ci6g27k6yvibn9vj8fzjxwcf" {};
};
libclosure = applePackage "libclosure" "osx-10.11.6" "1zqy1zvra46cmqv6vsf1mcsz3a76r9bky145phfwh4ab6y15vjpq" {};
libdispatch = applePackage "libdispatch" "osx-10.10.5" "0jsfbzp87lwk9snlby0hd4zvj7j894p5q3cw0wdx9ny1mcp3kdcj" {};
libiconv = applePackage "libiconv" "osx-10.12.6" "1gg5h6z8sk851bhv87vyxzs54jmqz6lh57ny8j4s51j7srja0nly" {};
Libinfo = applePackage "Libinfo" "osx-10.11.6" "0qjgkd4y8sjvwjzv5wwyzkb61pg8wwg95bkp721dgzv119dqhr8x" {};
Libm = applePackage "Libm" "osx-10.7.4" "02sd82ig2jvvyyfschmb4gpz6psnizri8sh6i982v341x6y4ysl7" {};
Libnotify = applePackage "Libnotify" "osx-10.12.6" "0p5qhvalf6j1w6n8xwywhn6dvbpzv74q5wqrgs8rwfpf74wg6s9z" {};
libplatform = applePackage "libplatform" "osx-10.12.6" "0rh1f5ybvwz8s0nwfar8s0fh7jbgwqcy903cv2x8m15iq1x599yn" {};
libpthread = applePackage "libpthread" "osx-10.12.6" "1j6541rcgjpas1fc77ip5krjgw4bvz6jq7bq7h9q7axb0jv2ns6c" {};
libresolv = applePackage "libresolv" "osx-10.12.6" "077j6ljfh7amqpk2146rr7dsz5vasvr3als830mgv5jzl7l6vz88" {};
Libsystem = applePackage "Libsystem" "osx-10.12.6" "1082ircc1ggaq3wha218vmfa75jqdaqidsy1bmrc4ckfkbr3bwx2" {};
libutil = applePackage "libutil" "osx-10.12.6" "0lqdxaj82h8yjbjm856jjz9k2d96k0viimi881akfng08xk1246y" {};
libunwind = applePackage "libunwind" "osx-10.12.6" "0miffaa41cv0lzf8az5k1j1ng8jvqvxcr4qrlkf3xyj479arbk1b" {};
mDNSResponder = applePackage "mDNSResponder" "osx-10.12.6" "02ms1p8zlgmprzn65jzr7yaqxykh3zxjcrw0c06aayim6h0dsqfy" {};
objc4 = applePackage "objc4" "osx-10.12.6" "1cj1vhbcs9pkmag2ms8wslagicnq9bxi2qjkszmp3ys7z7ccrbwz" {};
ppp = applePackage "ppp" "osx-10.12.6" "1kcc2nc4x1kf8sz0a23i6nfpvxg381kipi0qdisrp8x9z2gbkxb8" {};
removefile = applePackage "removefile" "osx-10.12.6" "0jzjxbmxgjzhssqd50z7kq9dlwrv5fsdshh57c0f8mdwcs19bsyx" {};
xnu = applePackage "xnu" "osx-10.12.6" "1sjb0i7qzz840v2h4z3s4jyjisad4r5yyi6sg8pakv3wd81i5fg5" {
python3 = pkgs.buildPackages.buildPackages.python3; # TODO(@Ericson2314) this shouldn't be needed.
};
hfs = applePackage "hfs" "osx-10.12.6" "1mj3xvqpq1mgd80b6kl1s04knqnap7hccr0gz8rjphalq14rbl5g" {};
Librpcsvc = applePackage "Librpcsvc" "osx-10.11.6" "1zwfwcl9irxl1dlnf2b4v30vdybp0p0r6n6g1pd14zbdci1jcg2k" {};
adv_cmds = applePackage "adv_cmds" "osx-10.11.6" "12gbv35i09aij9g90p6b3x2f3ramw43qcb2gjrg8lzkzmwvcyw9q" {};
basic_cmds = applePackage "basic_cmds" "osx-10.11.6" "0hvab4b1v5q2x134hdkal0rmz5gsdqyki1vb0dbw4py1bqf0yaw9" {};
developer_cmds = applePackage "developer_cmds" "osx-10.11.6" "1r9c2b6dcl22diqf90x58psvz797d3lxh4r2wppr7lldgbgn24di" {};
diskdev_cmds = applePackage "diskdev_cmds" "osx-10.11.6" "1ssdyiaq5m1zfy96yy38yyknp682ki6bvabdqd5z18fa0rv3m2ar" {
macosPackages_11_0_1 = macosPackages_11_0_1;
};
network_cmds = applePackage "network_cmds" "osx-10.11.6" "0lhi9wz84qr1r2ab3fb4nvmdg9gxn817n5ldg7zw9gnf3wwn42kw" {};
file_cmds = applePackage "file_cmds" "osx-10.11.6" "1zfxbmasps529pnfdjvc13p7ws2cfx8pidkplypkswyff0nff4wp" {};
shell_cmds = applePackage "shell_cmds" "osx-10.11.6" "0084k271v66h4jqp7q7rmjvv7w4mvhx3aq860qs8jbd30canm86n" {};
system_cmds = applePackage "system_cmds" "osx-10.11.6" "1h46j2c5v02pkv5d9fyv6cpgyg0lczvwicrx6r9s210cl03l77jl" {};
text_cmds = applePackage "text_cmds" "osx-10.11.6" "1f93m7dd0ghqb2hwh905mjhzblyfr7dwffw98xhgmv1mfdnigxg0" {};
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; };
# TODO(matthewbauer):
# To be removed, once I figure out how to build a newer Security version.
Security = applePackage "Security/boot.nix" "osx-10.9.5" "1nv0dczf67dhk17hscx52izgdcyacgyy12ag0jh6nl5hmfzsn8yy" {};
}

View file

@ -0,0 +1,8 @@
# Generated using: ./generate-sdk-packages.sh developer-tools 11.3.1
{ applePackage' }:
{
bootstrap_cmds = applePackage' "bootstrap_cmds" "116" "developer-tools-11.3.1" "148xpqkf5xzpslqxch5l8h6vsz7sys8sdzk4ghbg9mkcivp8qa03" {};
developer_cmds = applePackage' "developer_cmds" "66" "developer-tools-11.3.1" "0q08m4cxxwph7gxqravmx13l418p1i050bd46zwksn9j9zpw9mlr" {};
}

View file

@ -0,0 +1,37 @@
{ lib, appleDerivation, xcbuildHook, llvmPackages, makeWrapper }:
appleDerivation {
nativeBuildInputs = [ xcbuildHook makeWrapper ];
patches = [
# The following copied from
# https://github.com/Homebrew/homebrew-core/commit/712ed3e948868e17f96b7e59972b5f45d4faf688
# is needed to build libvirt.
./rpcgen-support-hyper-and-quad-types.patch
];
postPatch = ''
makeWrapper ${llvmPackages.clang}/bin/clang $out/bin/clang-cpp --add-flags "--driver-mode=cpp"
substituteInPlace rpcgen/rpc_main.c \
--replace "/usr/bin/cpp" "$out/bin/clang-cpp"
'';
# temporary install phase until xcodebuild has "install" support
installPhase = ''
for f in Products/Release/*; do
if [ -f $f ]; then
install -D $f $out/bin/$(basename $f)
fi
done
for n in 1; do
mkdir -p $out/share/man/man$n
install */*.$n $out/share/man/man$n
done
'';
meta = {
platforms = lib.platforms.darwin;
maintainers = with lib.maintainers; [ matthewbauer ];
};
}

View file

@ -0,0 +1,66 @@
diff --git a/rpcgen/rpc_parse.c b/rpcgen/rpc_parse.c
index 52edc9f..db0c1f1 100644
--- a/rpcgen/rpc_parse.c
+++ b/rpcgen/rpc_parse.c
@@ -580,6 +580,10 @@ get_type(prefixp, typep, dkind)
*typep = "long";
(void) peekscan(TOK_INT, &tok);
break;
+ case TOK_HYPER:
+ *typep = "int64_t";
+ (void) peekscan(TOK_INT, &tok);
+ break;
case TOK_VOID:
if (dkind != DEF_UNION && dkind != DEF_PROGRAM) {
error("voids allowed only inside union and program definitions with one argument");
@@ -592,6 +596,7 @@ get_type(prefixp, typep, dkind)
case TOK_INT:
case TOK_FLOAT:
case TOK_DOUBLE:
+ case TOK_QUAD:
case TOK_BOOL:
*typep = tok.str;
break;
@@ -622,6 +627,11 @@ unsigned_dec(typep)
*typep = "u_long";
(void) peekscan(TOK_INT, &tok);
break;
+ case TOK_HYPER:
+ get_token(&tok);
+ *typep = "u_int64_t";
+ (void) peekscan(TOK_INT, &tok);
+ break;
case TOK_INT:
get_token(&tok);
*typep = "u_int";
diff --git a/rpcgen/rpc_scan.c b/rpcgen/rpc_scan.c
index a8df441..4130107 100644
--- a/rpcgen/rpc_scan.c
+++ b/rpcgen/rpc_scan.c
@@ -419,8 +419,10 @@ static token symbols[] = {
{TOK_UNSIGNED, "unsigned"},
{TOK_SHORT, "short"},
{TOK_LONG, "long"},
+ {TOK_HYPER, "hyper"},
{TOK_FLOAT, "float"},
{TOK_DOUBLE, "double"},
+ {TOK_QUAD, "quadruple"},
{TOK_STRING, "string"},
{TOK_PROGRAM, "program"},
{TOK_VERSION, "version"},
diff --git a/rpcgen/rpc_scan.h b/rpcgen/rpc_scan.h
index bac2be4..e4c57c8 100644
--- a/rpcgen/rpc_scan.h
+++ b/rpcgen/rpc_scan.h
@@ -66,9 +66,11 @@ enum tok_kind {
TOK_INT,
TOK_SHORT,
TOK_LONG,
+ TOK_HYPER,
TOK_UNSIGNED,
TOK_FLOAT,
TOK_DOUBLE,
+ TOK_QUAD,
TOK_OPAQUE,
TOK_CHAR,
TOK_STRING,

View file

@ -0,0 +1,41 @@
{ lib, appleDerivation, xcbuildHook, Libc, stdenv, macosPackages_11_0_1, xnu
, fetchurl, libutil }:
let
xnu-src = if stdenv.isAarch64 then macosPackages_11_0_1.xnu.src else xnu.src;
arch = if stdenv.isAarch64 then "arm" else "i386";
in appleDerivation {
nativeBuildInputs = [ xcbuildHook ];
buildInputs = [ libutil ];
NIX_CFLAGS_COMPILE = "-I.";
NIX_LDFLAGS = "-lutil";
patchPhase = ''
# ugly hacks for missing headers
# most are bsd related - probably should make this a drv
unpackFile ${Libc.src}
unpackFile ${xnu-src}
mkdir System sys machine ${arch}
cp xnu-*/bsd/sys/disklabel.h sys
cp xnu-*/bsd/machine/disklabel.h machine
cp xnu-*/bsd/${arch}/disklabel.h ${arch}
cp -r xnu-*/bsd/sys System
cp -r Libc-*/uuid System
substituteInPlace diskdev_cmds.xcodeproj/project.pbxproj \
--replace 'DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";' ""
'';
installPhase = ''
install -D Products/Release/libdisk.a $out/lib/libdisk.a
rm Products/Release/libdisk.a
for f in Products/Release/*; do
if [ -f $f ]; then
install -D $f $out/bin/$(basename $f)
fi
done
'';
meta = {
platforms = lib.platforms.darwin;
maintainers = with lib.maintainers; [ matthewbauer ];
};
}

View file

@ -0,0 +1,55 @@
{ appleDerivation, xcbuildHook, CoreSymbolication
, xnu, bison, flex, darling, stdenv, fixDarwinDylibNames }:
appleDerivation {
nativeBuildInputs = [ xcbuildHook flex bison fixDarwinDylibNames ];
buildInputs = [ CoreSymbolication darling xnu ];
# -fcommon: workaround build failure on -fno-common toolchains:
# duplicate symbol '_kCSRegionMachHeaderName' in: libproc.o dt_module_apple.o
NIX_CFLAGS_COMPILE = "-DCTF_OLD_VERSIONS -DPRIVATE -DYYDEBUG=1 -I${xnu}/Library/Frameworks/System.framework/Headers -Wno-error=implicit-function-declaration -fcommon";
NIX_LDFLAGS = "-L./Products/Release";
xcbuildFlags = [ "-target" "dtrace_frameworks" "-target" "dtrace" ];
doCheck = false;
checkPhase = "xcodebuild -target dtrace_tests";
postPatch = ''
substituteInPlace dtrace.xcodeproj/project.pbxproj \
--replace "/usr/sbin" ""
substituteInPlace libdtrace/dt_open.c \
--replace /usr/bin/clang ${stdenv.cc.cc}/bin/clang \
--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
'';
# hack to handle xcbuild's broken lex handling
preBuild = ''
pushd libdtrace
yacc -d dt_grammar.y
flex -l -d dt_lex.l
popd
substituteInPlace dtrace.xcodeproj/project.pbxproj \
--replace '6EBC9800099BFBBF0001019C /* dt_grammar.y */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.yacc; name = dt_grammar.y; path = libdtrace/dt_grammar.y; sourceTree = "<group>"; };' '6EBC9800099BFBBF0001019C /* y.tab.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = y.tab.c; path = libdtrace/y.tab.c; sourceTree = "<group>"; };' \
--replace '6EBC9808099BFBBF0001019C /* dt_lex.l */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.lex; name = dt_lex.l; path = libdtrace/dt_lex.l; sourceTree = "<group>"; };' '6EBC9808099BFBBF0001019C /* lex.yy.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = lex.yy.c; path = libdtrace/lex.yy.c; sourceTree = "<group>"; };'
'';
# xcbuild doesn't support install
installPhase = ''
mkdir -p $out
cp -r Products/Release/usr/include $out/include
cp scripts/dt_cpp.h $out/include/dt_cpp.h
mkdir $out/lib
cp Products/Release/*.dylib $out/lib
mkdir $out/bin
cp Products/Release/dtrace $out/bin
mkdir -p $out/lib/dtrace
install_name_tool -change $PWD/Products/Release/libdtrace.dylib $out/lib/libdtrace.dylib $out/bin/dtrace
'';
}

View file

@ -0,0 +1,16 @@
{ lib, appleDerivation', stdenvNoCC }:
appleDerivation' stdenvNoCC {
installPhase = ''
mkdir -p $out/lib $out/include
ln -s /usr/lib/dyld $out/lib/dyld
cp -r include $out/
'';
meta = with lib; {
description = "Impure primitive symlinks to the Mac OS native dyld, along with headers";
maintainers = with maintainers; [ copumpkin ];
platforms = platforms.darwin;
license = licenses.apsl20;
};
}

View file

@ -0,0 +1,10 @@
{ appleDerivation', stdenv }:
appleDerivation' stdenv {
dontBuild = true;
installPhase = ''
mkdir -p $out/Library/Frameworks/EAP8021X.framework/Headers
cp EAP8021X.fproj/EAPClientProperties.h $out/Library/Frameworks/EAP8021X.framework/Headers
'';
}

View file

@ -0,0 +1,38 @@
{ lib, appleDerivation, xcbuildHook, zlib, bzip2, xz, ncurses, libutil, Libinfo }:
appleDerivation {
nativeBuildInputs = [ xcbuildHook ];
buildInputs = [ zlib bzip2 xz ncurses libutil Libinfo ];
# some commands not working:
# mtree: _simple.h not found
# ipcs: sys/ipcs.h not found
# so remove their targets from the project
patchPhase = ''
substituteInPlace file_cmds.xcodeproj/project.pbxproj \
--replace "FC8A8CAA14B655FD001B97AD /* PBXTargetDependency */," "" \
--replace "FC8A8C9C14B655FD001B97AD /* PBXTargetDependency */," "" \
--replace "productName = file_cmds;" "" \
--replace '/usr/lib/libcurses.dylib' 'libncurses.dylib'
sed -i -re "s/name = ([a-zA-Z]+);/name = \1; productName = \1;/" file_cmds.xcodeproj/project.pbxproj
'';
# temporary install phase until xcodebuild has "install" support
installPhase = ''
for f in Products/Release/*; do
if [ -f $f ]; then
install -D $f $out/bin/$(basename $f)
fi
done
for n in 1; do
mkdir -p $out/share/man/man$n
install */*.$n $out/share/man/man$n
done
'';
meta = {
platforms = lib.platforms.darwin;
maintainers = with lib.maintainers; [ matthewbauer ];
};
}

View file

@ -0,0 +1,29 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl
# usage:
# generate-sdk-packages.sh macos 11.0.1
cd $(dirname "$0")
sdkName="$1-$2"
outfile="$sdkName.nix"
>$outfile echo "# Generated using: ./$(basename "$0") $1 $2
{ applePackage' }:
{"
parse_line() {
readarray -t -d$'\t' package <<<$2
local pname=${package[0]} version=${package[1]}
if [ -d $pname ]; then
sha256=$(nix-prefetch-url "https://opensource.apple.com/tarballs/$pname/$pname-$version.tar.gz")
>>$outfile echo "$pname = applePackage' \"$pname\" \"$version\" \"$sdkName\" \"$sha256\" {};"
fi
}
readarray -s1 -c1 -C parse_line < <(curl -sS "https://opensource.apple.com/text/${sdkName//./}.txt")
>>$outfile echo '}'

View file

@ -0,0 +1,47 @@
{ appleDerivation', stdenv, stdenvNoCC, lib, headersOnly ? true }:
appleDerivation' (if headersOnly then stdenvNoCC else stdenv) {
installPhase = lib.optionalString headersOnly ''
mkdir -p $out/include/hfs
cp core/*.h $out/include/hfs
'';
appleHeaders = ''
hfs/BTreeScanner.h
hfs/BTreesInternal.h
hfs/BTreesPrivate.h
hfs/CatalogPrivate.h
hfs/FileMgrInternal.h
hfs/HFSUnicodeWrappers.h
hfs/UCStringCompareData.h
hfs/hfs.h
hfs/hfs_alloc_trace.h
hfs/hfs_attrlist.h
hfs/hfs_btreeio.h
hfs/hfs_catalog.h
hfs/hfs_cnode.h
hfs/hfs_cprotect.h
hfs/hfs_dbg.h
hfs/hfs_endian.h
hfs/hfs_extents.h
hfs/hfs_format.h
hfs/hfs_fsctl.h
hfs/hfs_hotfiles.h
hfs/hfs_iokit.h
hfs/hfs_journal.h
hfs/hfs_kdebug.h
hfs/hfs_key_roll.h
hfs/hfs_macos_defs.h
hfs/hfs_mount.h
hfs/hfs_quota.h
hfs/hfs_unistr.h
hfs/kext-config.h
hfs/rangelist.h
'';
meta = {
# Seems nobody wants its binary, so we didn't implement building.
broken = !headersOnly;
platforms = lib.platforms.darwin;
};
}

View file

@ -0,0 +1,26 @@
{ appleDerivation', stdenvNoCC }:
appleDerivation' stdenvNoCC {
# No clue why the same file has two different names. Ask Apple!
installPhase = ''
mkdir -p $out/include/ $out/include/servers
cp liblaunch/*.h $out/include
cp liblaunch/bootstrap.h $out/include/servers
cp liblaunch/bootstrap.h $out/include/servers/bootstrap_defs.h
'';
appleHeaders = ''
bootstrap.h
bootstrap_priv.h
launch.h
launch_internal.h
launch_priv.h
reboot2.h
servers/bootstrap.h
servers/bootstrap_defs.h
vproc.h
vproc_internal.h
vproc_priv.h
'';
}

View file

@ -0,0 +1,129 @@
/*
* Generated by dtrace(1M).
*/
#ifndef _AUTO_DTRACE_H
#define _AUTO_DTRACE_H
#include <unistd.h>
#ifdef __cplusplus
extern "C" {
#endif
#define GARBAGE_COLLECTION_STABILITY "___dtrace_stability$garbage_collection$v1$1_1_0_1_1_0_1_1_0_1_1_0_1_1_0"
#define GARBAGE_COLLECTION_TYPEDEFS "___dtrace_typedefs$garbage_collection$v2$6175746f5f636f6c6c656374696f6e5f70686173655f74$6175746f5f636f6c6c656374696f6e5f747970655f74$6d616c6c6f635f7a6f6e655f74"
#if !defined(DTRACE_PROBES_DISABLED) || !DTRACE_PROBES_DISABLED
#define GARBAGE_COLLECTION_AUTO_BLOCK_LOST_THREAD_LOCALITY(arg0, arg1) \
do { \
__asm__ volatile(".reference " GARBAGE_COLLECTION_TYPEDEFS); \
__dtrace_probe$garbage_collection$auto_block_lost_thread_locality$v1$766f6964202a$75696e7436345f74(arg0, arg1); \
__asm__ volatile(".reference " GARBAGE_COLLECTION_STABILITY); \
} while (0)
#define GARBAGE_COLLECTION_AUTO_BLOCK_LOST_THREAD_LOCALITY_ENABLED() \
({ int _r = __dtrace_isenabled$garbage_collection$auto_block_lost_thread_locality$v1(); \
__asm__ volatile(""); \
_r; })
#define GARBAGE_COLLECTION_AUTO_REFCOUNT_ONE_ALLOCATION(arg0) \
do { \
__asm__ volatile(".reference " GARBAGE_COLLECTION_TYPEDEFS); \
__dtrace_probe$garbage_collection$auto_refcount_one_allocation$v1$75696e7436345f74(arg0); \
__asm__ volatile(".reference " GARBAGE_COLLECTION_STABILITY); \
} while (0)
#define GARBAGE_COLLECTION_AUTO_REFCOUNT_ONE_ALLOCATION_ENABLED() \
({ int _r = __dtrace_isenabled$garbage_collection$auto_refcount_one_allocation$v1(); \
__asm__ volatile(""); \
_r; })
#define GARBAGE_COLLECTION_COLLECTION_BEGIN(arg0, arg1) \
do { \
__asm__ volatile(".reference " GARBAGE_COLLECTION_TYPEDEFS); \
__dtrace_probe$garbage_collection$collection_begin$v1$6d616c6c6f635f7a6f6e655f74202a$6175746f5f636f6c6c656374696f6e5f747970655f74(arg0, arg1); \
__asm__ volatile(".reference " GARBAGE_COLLECTION_STABILITY); \
} while (0)
#define GARBAGE_COLLECTION_COLLECTION_BEGIN_ENABLED() \
({ int _r = __dtrace_isenabled$garbage_collection$collection_begin$v1(); \
__asm__ volatile(""); \
_r; })
#define GARBAGE_COLLECTION_COLLECTION_END(arg0, arg1, arg2, arg3, arg4) \
do { \
__asm__ volatile(".reference " GARBAGE_COLLECTION_TYPEDEFS); \
__dtrace_probe$garbage_collection$collection_end$v1$6d616c6c6f635f7a6f6e655f74202a$75696e7436345f74$75696e7436345f74$75696e7436345f74$75696e7436345f74(arg0, arg1, arg2, arg3, arg4); \
__asm__ volatile(".reference " GARBAGE_COLLECTION_STABILITY); \
} while (0)
#define GARBAGE_COLLECTION_COLLECTION_END_ENABLED() \
({ int _r = __dtrace_isenabled$garbage_collection$collection_end$v1(); \
__asm__ volatile(""); \
_r; })
#define GARBAGE_COLLECTION_COLLECTION_PHASE_BEGIN(arg0, arg1) \
do { \
__asm__ volatile(".reference " GARBAGE_COLLECTION_TYPEDEFS); \
__dtrace_probe$garbage_collection$collection_phase_begin$v1$6d616c6c6f635f7a6f6e655f74202a$6175746f5f636f6c6c656374696f6e5f70686173655f74(arg0, arg1); \
__asm__ volatile(".reference " GARBAGE_COLLECTION_STABILITY); \
} while (0)
#define GARBAGE_COLLECTION_COLLECTION_PHASE_BEGIN_ENABLED() \
({ int _r = __dtrace_isenabled$garbage_collection$collection_phase_begin$v1(); \
__asm__ volatile(""); \
_r; })
#define GARBAGE_COLLECTION_COLLECTION_PHASE_END(arg0, arg1, arg2, arg3) \
do { \
__asm__ volatile(".reference " GARBAGE_COLLECTION_TYPEDEFS); \
__dtrace_probe$garbage_collection$collection_phase_end$v1$6d616c6c6f635f7a6f6e655f74202a$6175746f5f636f6c6c656374696f6e5f70686173655f74$75696e7436345f74$75696e7436345f74(arg0, arg1, arg2, arg3); \
__asm__ volatile(".reference " GARBAGE_COLLECTION_STABILITY); \
} while (0)
#define GARBAGE_COLLECTION_COLLECTION_PHASE_END_ENABLED() \
({ int _r = __dtrace_isenabled$garbage_collection$collection_phase_end$v1(); \
__asm__ volatile(""); \
_r; })
extern void __dtrace_probe$garbage_collection$auto_block_lost_thread_locality$v1$766f6964202a$75696e7436345f74(const void *, uint64_t);
extern int __dtrace_isenabled$garbage_collection$auto_block_lost_thread_locality$v1(void);
extern void __dtrace_probe$garbage_collection$auto_refcount_one_allocation$v1$75696e7436345f74(uint64_t);
extern int __dtrace_isenabled$garbage_collection$auto_refcount_one_allocation$v1(void);
extern void __dtrace_probe$garbage_collection$collection_begin$v1$6d616c6c6f635f7a6f6e655f74202a$6175746f5f636f6c6c656374696f6e5f747970655f74(const malloc_zone_t *, auto_collection_type_t);
extern int __dtrace_isenabled$garbage_collection$collection_begin$v1(void);
extern void __dtrace_probe$garbage_collection$collection_end$v1$6d616c6c6f635f7a6f6e655f74202a$75696e7436345f74$75696e7436345f74$75696e7436345f74$75696e7436345f74(const malloc_zone_t *, uint64_t, uint64_t, uint64_t, uint64_t);
extern int __dtrace_isenabled$garbage_collection$collection_end$v1(void);
extern void __dtrace_probe$garbage_collection$collection_phase_begin$v1$6d616c6c6f635f7a6f6e655f74202a$6175746f5f636f6c6c656374696f6e5f70686173655f74(const malloc_zone_t *, auto_collection_phase_t);
extern int __dtrace_isenabled$garbage_collection$collection_phase_begin$v1(void);
extern void __dtrace_probe$garbage_collection$collection_phase_end$v1$6d616c6c6f635f7a6f6e655f74202a$6175746f5f636f6c6c656374696f6e5f70686173655f74$75696e7436345f74$75696e7436345f74(const malloc_zone_t *, auto_collection_phase_t, uint64_t, uint64_t);
extern int __dtrace_isenabled$garbage_collection$collection_phase_end$v1(void);
#else
#define GARBAGE_COLLECTION_AUTO_BLOCK_LOST_THREAD_LOCALITY(arg0, arg1) \
do { \
} while (0)
#define GARBAGE_COLLECTION_AUTO_BLOCK_LOST_THREAD_LOCALITY_ENABLED() (0)
#define GARBAGE_COLLECTION_AUTO_REFCOUNT_ONE_ALLOCATION(arg0) \
do { \
} while (0)
#define GARBAGE_COLLECTION_AUTO_REFCOUNT_ONE_ALLOCATION_ENABLED() (0)
#define GARBAGE_COLLECTION_COLLECTION_BEGIN(arg0, arg1) \
do { \
} while (0)
#define GARBAGE_COLLECTION_COLLECTION_BEGIN_ENABLED() (0)
#define GARBAGE_COLLECTION_COLLECTION_END(arg0, arg1, arg2, arg3, arg4) \
do { \
} while (0)
#define GARBAGE_COLLECTION_COLLECTION_END_ENABLED() (0)
#define GARBAGE_COLLECTION_COLLECTION_PHASE_BEGIN(arg0, arg1) \
do { \
} while (0)
#define GARBAGE_COLLECTION_COLLECTION_PHASE_BEGIN_ENABLED() (0)
#define GARBAGE_COLLECTION_COLLECTION_PHASE_END(arg0, arg1, arg2, arg3) \
do { \
} while (0)
#define GARBAGE_COLLECTION_COLLECTION_PHASE_END_ENABLED() (0)
#endif /* !defined(DTRACE_PROBES_DISABLED) || !DTRACE_PROBES_DISABLED */
#ifdef __cplusplus
}
#endif
#endif /* _AUTO_DTRACE_H */

View file

@ -0,0 +1,86 @@
{ lib, stdenv, appleDerivation, libdispatch, Libsystem }:
appleDerivation {
# these are included in the pure libc
buildInputs = lib.optionals stdenv.cc.nativeLibc [ libdispatch Libsystem ];
buildPhase = ''
cp ${./auto_dtrace.h} ./auto_dtrace.h
substituteInPlace ThreadLocalCollector.h --replace SubZone.h Subzone.h
substituteInPlace auto_zone.cpp \
--replace "#include <msgtracer_client.h>" ''$'#include <asl.h>\nstatic void msgtracer_log_with_keys(...) { };'
substituteInPlace Definitions.h \
--replace "#include <System/pthread_machdep.h>" "" \
--replace 'void * const, void * const' 'void * const, void *'
# getspecific_direct is more efficient, but this should be equivalent...
substituteInPlace Zone.h \
--replace "_pthread_getspecific_direct" "pthread_getspecific" \
--replace "_pthread_has_direct_tsd()" "0" \
--replace "__PTK_FRAMEWORK_GC_KEY0" "110" \
--replace "__PTK_FRAMEWORK_GC_KEY1" "111" \
--replace "__PTK_FRAMEWORK_GC_KEY2" "112" \
--replace "__PTK_FRAMEWORK_GC_KEY3" "113" \
--replace "__PTK_FRAMEWORK_GC_KEY4" "114" \
--replace "__PTK_FRAMEWORK_GC_KEY5" "115" \
--replace "__PTK_FRAMEWORK_GC_KEY6" "116" \
--replace "__PTK_FRAMEWORK_GC_KEY7" "117" \
--replace "__PTK_FRAMEWORK_GC_KEY8" "118" \
--replace "__PTK_FRAMEWORK_GC_KEY9" "119"
substituteInPlace auto_zone.cpp \
--replace "__PTK_FRAMEWORK_GC_KEY9" "119" \
--replace "__PTK_FRAMEWORK_GC_KEY0" "110" \
substituteInPlace Zone.cpp \
--replace "_pthread_getspecific_direct" "pthread_getspecific" \
--replace "__PTK_FRAMEWORK_GC_KEY9" "119" \
--replace "__PTK_FRAMEWORK_GC_KEY0" "110" \
--replace "__PTK_LIBDISPATCH_KEY0" "20" \
--replace "struct auto_zone_cursor {" ''$'extern "C" int pthread_key_init_np(int, void (*)(void *));\nstruct auto_zone_cursor {'
substituteInPlace auto_impl_utilities.c \
--replace "# include <CrashReporterClient.h>" "void CRSetCrashLogMessage(void *msg) { };"
c++ -I. -O3 -c -Wno-c++11-extensions auto_zone.cpp
cc -I. -O3 -Iauto_tester -c auto_impl_utilities.c
c++ -I. -O3 -c auto_weak.cpp
c++ -I. -O3 -c Admin.cpp
c++ -I. -O3 -c Bitmap.cpp
c++ -I. -O3 -c Definitions.cpp
c++ -I. -O3 -c Environment.cpp
c++ -I. -O3 -c Large.cpp
c++ -I. -O3 -c Region.cpp
c++ -I. -O3 -c Subzone.cpp
c++ -I. -O3 -c WriteBarrier.cpp
c++ -I. -O3 -c Zone.cpp
c++ -I. -O3 -c Thread.cpp
c++ -I. -O3 -c InUseEnumerator.cpp
c++ -I. -O3 -c auto_gdb_interface.cpp
c++ -I. -O3 -c PointerHash.cpp
c++ -I. -O3 -c ThreadLocalCollector.cpp
c++ -I. -O3 -c ZoneDump.cpp
c++ -I. -O3 -c ZoneCollectors.cpp
c++ -I. -O3 -c SubzonePartition.cpp
c++ -I. -O3 -c ZoneCollectionChecking.cpp
c++ -I. -O3 -c ZoneCompaction.cpp
c++ -I. -O3 -c BlockRef.cpp
c++ -Wl,-no_dtrace_dof --stdlib=libc++ -dynamiclib -install_name $out/lib/libauto.dylib -o libauto.dylib *.o
'';
installPhase = ''
mkdir -p $out/lib $out/include
cp auto_zone.h auto_weak.h auto_tester/auto_tester.h auto_gdb_interface.h $out/include
cp libauto.dylib $out/lib
'';
meta = {
# libauto is only used by objc4/pure.nix , but objc4 is now using the impure approach, so we don't bother to fix this.
broken = true;
platforms = lib.platforms.darwin;
};
}

View file

@ -0,0 +1,13 @@
{ appleDerivation', stdenvNoCC }:
appleDerivation' stdenvNoCC {
installPhase = ''
mkdir -p $out/include
cp *.h $out/include/
'';
appleHeaders = ''
Block.h
Block_private.h
'';
}

View file

@ -0,0 +1,54 @@
{ appleDerivation', stdenvNoCC }:
appleDerivation' stdenvNoCC {
dontConfigure = true;
dontBuild = true;
installPhase = ''
mkdir -p $out/include/dispatch $out/include/os
# Move these headers so CF can find <os/voucher_private.h>
mv private/voucher*.h $out/include/os
cp -r private/*.h $out/include/dispatch
cp -r dispatch/*.h $out/include/dispatch
cp -r os/object*.h $out/include/os
# gcc compatability. Source: https://stackoverflow.com/a/28014302/3714556
substituteInPlace $out/include/dispatch/object.h \
--replace 'typedef void (^dispatch_block_t)(void);' \
'#ifdef __clang__
typedef void (^dispatch_block_t)(void);
#else
typedef void* dispatch_block_t;
#endif'
'';
appleHeaders = ''
dispatch/base.h
dispatch/benchmark.h
dispatch/block.h
dispatch/data.h
dispatch/data_private.h
dispatch/dispatch.h
dispatch/group.h
dispatch/introspection.h
dispatch/introspection_private.h
dispatch/io.h
dispatch/io_private.h
dispatch/layout_private.h
dispatch/mach_private.h
dispatch/object.h
dispatch/once.h
dispatch/private.h
dispatch/queue.h
dispatch/queue_private.h
dispatch/semaphore.h
dispatch/source.h
dispatch/source_private.h
dispatch/time.h
os/object.h
os/object_private.h
os/voucher_activity_private.h
os/voucher_private.h
'';
}

View file

@ -0,0 +1,37 @@
{ stdenv, appleDerivation, lib
, enableStatic ? stdenv.hostPlatform.isStatic
, enableShared ? !stdenv.hostPlatform.isStatic
}:
appleDerivation {
postUnpack = "sourceRoot=$sourceRoot/libiconv";
preConfigure = lib.optionalString stdenv.hostPlatform.isiOS ''
sed -i 's/darwin\*/ios\*/g' configure libcharset/configure
'';
configureFlags = [
(lib.enableFeature enableStatic "static")
(lib.enableFeature enableShared "shared")
];
postInstall = lib.optionalString enableShared ''
mv $out/lib/libiconv.dylib $out/lib/libiconv-nocharset.dylib
${stdenv.cc.bintools.targetPrefix}install_name_tool -id $out/lib/libiconv-nocharset.dylib $out/lib/libiconv-nocharset.dylib
# re-export one useless symbol; ld will reject a dylib that only reexports other dylibs
echo 'void dont_use_this(){}' | ${stdenv.cc.bintools.targetPrefix}clang -dynamiclib -x c - -current_version 2.4.0 \
-compatibility_version 7.0.0 -current_version 7.0.0 -o $out/lib/libiconv.dylib \
-Wl,-reexport_library -Wl,$out/lib/libiconv-nocharset.dylib \
-Wl,-reexport_library -Wl,$out/lib/libcharset.dylib
'';
setupHooks = [
../../../../build-support/setup-hooks/role.bash
../../../../development/libraries/libiconv/setup-hook.sh
];
meta = {
platforms = lib.platforms.darwin;
};
}

View file

@ -0,0 +1,32 @@
{ appleDerivation', stdenvNoCC }:
appleDerivation' stdenvNoCC {
installPhase = ''
mkdir $out
cp -r include $out/include
'';
appleHeaders = ''
_simple.h
libkern/OSAtomic.h
libkern/OSAtomicDeprecated.h
libkern/OSAtomicQueue.h
libkern/OSCacheControl.h
libkern/OSSpinLockDeprecated.h
os/alloc_once_impl.h
os/base.h
os/base_private.h
os/internal/atomic.h
os/internal/crashlog.h
os/internal/internal_shared.h
os/lock.h
os/lock_private.h
os/once_private.h
os/semaphore_private.h
platform/compat.h
platform/introspection_private.h
platform/string.h
setjmp.h
ucontext.h
'';
}

View file

@ -0,0 +1,55 @@
{ lib, appleDerivation', stdenvNoCC, libdispatch, xnu }:
appleDerivation' stdenvNoCC {
propagatedBuildInputs = [ libdispatch xnu ];
installPhase = ''
mkdir -p $out/include/pthread/
mkdir -p $out/include/sys/_types
cp pthread/*.h $out/include/pthread/
# This overwrites qos.h, and is probably not necessary, but I'll leave it here for now
# cp private/*.h $out/include/pthread/
cp -r sys $out/include
cp -r sys/_pthread/*.h $out/include/sys/_types/
'';
appleHeaders = ''
pthread/introspection.h
pthread/pthread.h
pthread/pthread_impl.h
pthread/pthread_spis.h
pthread/qos.h
pthread/sched.h
pthread/spawn.h
sys/_pthread/_pthread_attr_t.h
sys/_pthread/_pthread_cond_t.h
sys/_pthread/_pthread_condattr_t.h
sys/_pthread/_pthread_key_t.h
sys/_pthread/_pthread_mutex_t.h
sys/_pthread/_pthread_mutexattr_t.h
sys/_pthread/_pthread_once_t.h
sys/_pthread/_pthread_rwlock_t.h
sys/_pthread/_pthread_rwlockattr_t.h
sys/_pthread/_pthread_t.h
sys/_pthread/_pthread_types.h
sys/_types/_pthread_attr_t.h
sys/_types/_pthread_cond_t.h
sys/_types/_pthread_condattr_t.h
sys/_types/_pthread_key_t.h
sys/_types/_pthread_mutex_t.h
sys/_types/_pthread_mutexattr_t.h
sys/_types/_pthread_once_t.h
sys/_types/_pthread_rwlock_t.h
sys/_types/_pthread_rwlockattr_t.h
sys/_types/_pthread_t.h
sys/_types/_pthread_types.h
sys/qos.h
sys/qos_private.h
'';
meta = {
platforms = lib.platforms.darwin;
};
}

View file

@ -0,0 +1,52 @@
{ lib, appleDerivation', stdenv, stdenvNoCC, Libinfo, configdHeaders, mDNSResponder
, headersOnly ? false
}:
appleDerivation' (if headersOnly then stdenvNoCC else stdenv) {
buildInputs = lib.optionals (!headersOnly) [ Libinfo configdHeaders mDNSResponder ];
buildPhase = lib.optionalString (!headersOnly) ''
$CC -I. -c dns_util.c
$CC -I. -c dns.c
$CC -I. -c dns_async.c
$CC -I. -c base64.c
$CC -I. -c dst_api.c
$CC -I. -c dst_hmac_link.c
$CC -I. -c dst_support.c
$CC -I. -c ns_date.c
$CC -I. -c ns_name.c
$CC -I. -c ns_netint.c
$CC -I. -c ns_parse.c
$CC -I. -c ns_print.c
$CC -I. -c ns_samedomain.c
$CC -I. -c ns_sign.c
$CC -I. -c ns_ttl.c
$CC -I. -c ns_verify.c
$CC -I. -c res_comp.c
$CC -I. -c res_data.c
$CC -I. -c res_debug.c
$CC -I. -c res_findzonecut.c
$CC -I. -c res_init.c
$CC -I. -c res_mkquery.c
$CC -I. -c res_mkupdate.c
$CC -I. -c res_query.c
$CC -I. -c res_send.c
$CC -I. -c res_sendsigned.c
$CC -I. -c res_update.c
$CC -dynamiclib -install_name $out/lib/libresolv.9.dylib -current_version 1.0.0 -compatibility_version 1.0.0 -o libresolv.9.dylib *.o
'';
installPhase = ''
mkdir -p $out/include $out/include/arpa $out/lib
cp dns.h $out/include/
cp dns_util.h $out/include
cp nameser.h $out/include
ln -s ../nameser.h $out/include/arpa
cp resolv.h $out/include
'' + lib.optionalString (!headersOnly) ''
cp libresolv.9.dylib $out/lib
ln -s libresolv.9.dylib $out/lib/libresolv.dylib
'';
}

View file

@ -0,0 +1,17 @@
{ lib, appleDerivation }:
appleDerivation {
dontBuild = true;
# install headers only
installPhase = ''
mkdir -p $out/lib
cp -R include $out/include
'';
meta = with lib; {
maintainers = with maintainers; [ copumpkin lnl7 ];
platforms = platforms.darwin;
license = licenses.apsl20;
};
}

View file

@ -0,0 +1,43 @@
{ lib, stdenv, stdenvNoCC, appleDerivation', xcbuildHook
# headersOnly is true when building for libSystem
, headersOnly ? false }:
appleDerivation' (if headersOnly then stdenvNoCC else stdenv) {
nativeBuildInputs = lib.optional (!headersOnly) xcbuildHook;
prePatch = ''
substituteInPlace tzlink.c \
--replace '#include <xpc/xpc.h>' ""
'';
xcbuildFlags = [ "-target" "util" ];
installPhase = ''
mkdir -p $out/include
'' + lib.optionalString headersOnly ''
cp *.h $out/include
'' + lib.optionalString (!headersOnly)''
mkdir -p $out/lib $out/include
cp Products/Release/*.dylib $out/lib
cp Products/Release/*.h $out/include
# TODO: figure out how to get this to be right the first time around
install_name_tool -id $out/lib/libutil.dylib $out/lib/libutil.dylib
'';
# FIXME: headers are different against headersOnly. And all the headers are NOT in macos, do we really want them?
# appleHeaders = ''
# libutil.h
# mntopts.h
# tzlink.h
# wipefs.h
# '';
meta = with lib; {
maintainers = with maintainers; [ copumpkin ];
platforms = platforms.darwin;
license = licenses.apsl20;
};
}

View file

@ -0,0 +1,10 @@
{ appleDerivation', stdenvNoCC }:
appleDerivation' stdenvNoCC {
phases = [ "unpackPhase" "installPhase" ];
installPhase = ''
mkdir -p $out/include
cp mDNSShared/dns_sd.h $out/include
'';
}

View file

@ -0,0 +1,46 @@
# Generated using: ./generate-sdk-packages.sh macos 11.0.1
{ applePackage' }:
{
adv_cmds = applePackage' "adv_cmds" "176" "macos-11.0.1" "0x8c25rh6fnzndbc26vcb65vcxilvqyfvm2klfyci1wr4bh3ixgk" {};
architecture = applePackage' "architecture" "279" "macos-11.0.1" "1cgp33ywa30max6cyp69kvii299hx2vgwvmy3ms8n4gaq2mkpaky" {};
basic_cmds = applePackage' "basic_cmds" "55" "macos-11.0.1" "0hvab4b1v5q2x134hdkal0rmz5gsdqyki1vb0dbw4py1bqf0yaw9" {};
bootstrap_cmds = applePackage' "bootstrap_cmds" "121" "macos-11.0.1" "09bwclws6adxb1ky9q35f4ikddk4mbalmgds0cmqaf7j23qxl3fv" {};
CommonCrypto = applePackage' "CommonCrypto" "60178.40.2" "macos-11.0.1" "0r3b1mlfmbdzpwn6pbsbfaga3k63gpwcwbhkbi4r09aq82skl02v" {};
configd = applePackage' "configd" "1109.40.9" "macos-11.0.1" "173i55wfzli9pg2x2rw437hs68h6l4ngss5jfgf18g26zjkjzv5v" {};
copyfile = applePackage' "copyfile" "173.40.2" "macos-11.0.1" "0qyp15qj3fdb7yx033n57l7s61d70mv17f43yiwcbhx09mmlrp07" {};
Csu = applePackage' "Csu" "88" "macos-11.0.1" "029lgcyj0i16036h2lcx6fd6r1yf1bkj5dnvz905rh6ncl8skgdr" {};
diskdev_cmds = applePackage' "diskdev_cmds" "667.40.1" "macos-11.0.1" "1bqwkwkwd556rba5000ap77xrhaf4xnmy83mszd7a0yvl2xlma7j" {};
dtrace = applePackage' "dtrace" "370.40.1" "macos-11.0.1" "1941yczmn94ng5zlnhf0i5mjw2f4g7znisgvhkhn5f86gxmd98wl" {};
dyld = applePackage' "dyld" "832.7.1" "macos-11.0.1" "1s77ca6jg20z91qlph59da8j61m97y23vrw48xs4rywdzh4915n0" {};
eap8021x = applePackage' "eap8021x" "304.40.1" "macos-11.0.1" "1ph3kcpf527s0jqsi60j2sgg3m8h128spf292d8kyc08siz9mf9c" {};
file_cmds = applePackage' "file_cmds" "321.40.3" "macos-11.0.1" "04789vn1wghclfr3ma3ncg716xdsxfj66hrcxi5h3h1ryag2ycfz" {};
hfs = applePackage' "hfs" "556.41.1" "macos-11.0.1" "1rhkmn2yj5p4wmi4aajy5hj2h0gxk63s8j4qz4ziy4g4bjpdgwmy" {};
ICU = applePackage' "ICU" "66108" "macos-11.0.1" "1d76cyyqpwkzjlxfajm4nsglxmfrcafbnjwnjxc3j5w3nw67pqhx" {};
Libc = applePackage' "Libc" "1439.40.11" "macos-11.0.1" "0d5xlnks4lc9391wg31c9126vflb40lc5ffkgxmf2kpyglac1280" {};
libclosure = applePackage' "libclosure" "78" "macos-11.0.1" "089i2bl4agpnfplrg23xbzma1674g0w05988nxdps6ghxl4kz66f" {};
libdispatch = applePackage' "libdispatch" "1271.40.12" "macos-11.0.1" "0z7r42zfb8y48f0nrw0qw7fanfvimycimgnrg3jig101kjvjar98" {};
libiconv = applePackage' "libiconv" "59" "macos-11.0.1" "0hqbsqggjrr0sv6h70lcr3gabgk9inyc8aq1b30wibgjm6crjwpp" {};
Libinfo = applePackage' "Libinfo" "542.40.3" "macos-11.0.1" "0y5x6wxd3mwn6my1jdp8qrak3y7x7sgjdmwyw9cvvbn3kg9v6z1p" {};
Libnotify = applePackage' "Libnotify" "279.40.4" "macos-11.0.1" "0aswflxki877izp6sacv35sydn6a3639cflv3zhs3i7vkfbsvbf5" {};
libplatform = applePackage' "libplatform" "254.40.4" "macos-11.0.1" "1mhi8n66864y98dr3n0pkqad3aqim800kn9bxzp6h5jf2jni3aql" {};
libpthread = applePackage' "libpthread" "454.40.3" "macos-11.0.1" "18rb4dqjdf3krzi4hdj5i310gy49ipf01klbkp9g51i02a55gphq" {};
libresolv = applePackage' "libresolv" "68" "macos-11.0.1" "1ysvg6d28xyaky9sn7giglnsflhjsbj17h3h3i6knlzxnzznpkql" {};
Librpcsvc = applePackage' "Librpcsvc" "26" "macos-11.0.1" "1zwfwcl9irxl1dlnf2b4v30vdybp0p0r6n6g1pd14zbdci1jcg2k" {};
Libsystem = applePackage' "Libsystem" "1292.50.1" "macos-11.0.1" "0w16zaigq18jfsnw15pfyz2mkfqdkn0cc16q617kmgw2khld8j7j" {};
libunwind = applePackage' "libunwind" "200.10" "macos-11.0.1" "1pmymcqpfk7lfxh6zqch429vfpvmd2m1dlg898170pkx5zhxisl2" {};
libutil = applePackage' "libutil" "58.40.2" "macos-11.0.1" "1hhgashfj9g4vjv02070c5pn818a5n0bh5l81l2pflmvb2rrqs3f" {};
mDNSResponder = applePackage' "mDNSResponder" "1310.40.42" "macos-11.0.1" "0d0b9wwah9rg7rwrr29dxd6iy0y4rlmss3wcz2wcqmnd2qb9x8my" {};
network_cmds = applePackage' "network_cmds" "606.40.2" "macos-11.0.1" "1dlslk67npvmxx5m50385kmn3ysxih2iv220hhzkin11f8abdjv7" {};
objc4 = applePackage' "objc4" "818.2" "macos-11.0.1" "177gmh9m9ajy6mvcd2sf7gqydgljy44n3iih0yqsn1b13j784azx" {};
PowerManagement = applePackage' "PowerManagement" "1132.50.3" "macos-11.0.1" "1n5yn6sc8w67g8iism6ilkyl33j46gcnlqcaq6k16zkngx6lprba" {};
ppp = applePackage' "ppp" "877.40.2" "macos-11.0.1" "1z506z8ndvb1lfr4pypfy2bnig6qimhmq3yhjvqwfnliv91965iq" {};
removefile = applePackage' "removefile" "49.40.3" "macos-11.0.1" "1fhp47awi15f02385r25qgw1ag5z0kr1v3kvgqm3r8i8yysfqvwp" {};
Security = applePackage' "Security" "59754.41.1" "macos-11.0.1" "00kqgg7k80ba70ar2c02f0q9yrdgqcb56nb9z5g0bxwkvi40ryph" {};
shell_cmds = applePackage' "shell_cmds" "216.40.4" "macos-11.0.1" "1mvp1fp34kkm4mi85fdn3i0l0gig4c0w09zg2mvkpxcf68cq2f69" {};
system_cmds = applePackage' "system_cmds" "880.40.5" "macos-11.0.1" "1kys4vwfz4559sspdsfhmxc238nd8qgylqypza3zdzaqhfh7lx2x" {};
text_cmds = applePackage' "text_cmds" "106" "macos-11.0.1" "0cpnfpllwpx20hbxzg5i5488gcjyi9adnbac1sd5hpv3bq6z1hs5" {};
top = applePackage' "top" "129" "macos-11.0.1" "1nyz5mvq7js3zhsi3dwxl5fslg6m7nhlgc6p2hr889xgyl5prw8f" {};
xnu = applePackage' "xnu" "7195.50.7.100.1" "macos-11.0.1" "14wqkqp3lcxgpm1sjnsysybrc4ppzkghwv3mb5nr5v8ml37prkib" {};
}

View file

@ -0,0 +1,50 @@
{ lib, appleDerivation, xcbuildHook
, libressl, Librpcsvc, xnu, libpcap, developer_cmds }:
appleDerivation {
nativeBuildInputs = [ xcbuildHook ];
buildInputs = [ libressl xnu Librpcsvc libpcap developer_cmds ];
NIX_CFLAGS_COMPILE = " -I./unbound -I${xnu}/Library/Frameworks/System.framework/Headers/";
# "spray" requires some files that aren't compiling correctly in xcbuild.
# "rtadvd" seems to fail with some missing constants.
# "traceroute6" and "ping6" require ipsec which doesn't build correctly
patchPhase = ''
substituteInPlace network_cmds.xcodeproj/project.pbxproj \
--replace "7294F0EA0EE8BAC80052EC88 /* PBXTargetDependency */," "" \
--replace "7216D34D0EE89FEC00AE70E4 /* PBXTargetDependency */," "" \
--replace "72CD1D9C0EE8C47C005F825D /* PBXTargetDependency */," "" \
--replace "7216D2C20EE89ADF00AE70E4 /* PBXTargetDependency */," ""
'';
# temporary install phase until xcodebuild has "install" support
installPhase = ''
for f in Products/Release/*; do
if [ -f $f ]; then
install -D $f $out/bin/$(basename $f)
fi
done
for n in 1 5; do
mkdir -p $out/share/man/man$n
install */*.$n $out/share/man/man$n
done
# TODO: patch files to load from $out/ instead of /usr/
# mkdir -p $out/etc/
# install rtadvd.tproj/rtadvd.conf ip6addrctl.tproj/ip6addrctl.conf $out/etc/
# mkdir -p $out/local/OpenSourceVersions/
# install network_cmds.plist $out/local/OpenSourceVersions/
# mkdir -p $out/System/Library/LaunchDaemons
# install kdumpd.tproj/com.apple.kdumpd.plist $out/System/Library/LaunchDaemons
'';
meta = {
platforms = lib.platforms.darwin;
maintainers = with lib.maintainers; [ matthewbauer ];
};
}

View file

@ -0,0 +1,37 @@
{ appleDerivation, darwin-stubs }:
appleDerivation {
phases = [ "unpackPhase" "installPhase" ];
# Not strictly necessary, since libSystem depends on it, but it's nice to be explicit so we
# can easily find out what's impure.
__propagatedImpureHostDeps = [
"/usr/lib/libauto.dylib"
"/usr/lib/libc++abi.dylib"
"/usr/lib/libc++.1.dylib"
"/usr/lib/libSystem.B.dylib"
];
installPhase = ''
mkdir -p $out/include/objc $out/lib
cp ${darwin-stubs}/usr/lib/libobjc.A.tbd $out/lib/libobjc.A.tbd
ln -s libobjc.A.tbd $out/lib/libobjc.tbd
cp runtime/OldClasses.subproj/List.h $out/include/objc/List.h
cp runtime/NSObjCRuntime.h $out/include/objc/NSObjCRuntime.h
cp runtime/NSObject.h $out/include/objc/NSObject.h
cp runtime/Object.h $out/include/objc/Object.h
cp runtime/Protocol.h $out/include/objc/Protocol.h
cp runtime/hashtable.h $out/include/objc/hashtable.h
cp runtime/hashtable2.h $out/include/objc/hashtable2.h
cp runtime/message.h $out/include/objc/message.h
cp runtime/objc-api.h $out/include/objc/objc-api.h
cp runtime/objc-auto.h $out/include/objc/objc-auto.h
cp runtime/objc-class.h $out/include/objc/objc-class.h
cp runtime/objc-exception.h $out/include/objc/objc-exception.h
cp runtime/objc-load.h $out/include/objc/objc-load.h
cp runtime/objc-runtime.h $out/include/objc/objc-runtime.h
cp runtime/objc-sync.h $out/include/objc/objc-sync.h
cp runtime/objc.h $out/include/objc/objc.h
cp runtime/runtime.h $out/include/objc/runtime.h
'';
}

View file

@ -0,0 +1,65 @@
/*
* Generated by dtrace(1M).
*/
#ifndef _OBJC_PROBES_H
#define _OBJC_PROBES_H
#include <unistd.h>
#ifdef __cplusplus
extern "C" {
#endif
#define OBJC_RUNTIME_STABILITY "___dtrace_stability$objc_runtime$v1$1_1_0_1_1_0_1_1_0_1_1_0_1_1_0"
#define OBJC_RUNTIME_TYPEDEFS "___dtrace_typedefs$objc_runtime$v2"
#if !defined(DTRACE_PROBES_DISABLED) || !DTRACE_PROBES_DISABLED
#define OBJC_RUNTIME_OBJC_EXCEPTION_RETHROW() \
do { \
__asm__ volatile(".reference " OBJC_RUNTIME_TYPEDEFS); \
__dtrace_probe$objc_runtime$objc_exception_rethrow$v1(); \
__asm__ volatile(".reference " OBJC_RUNTIME_STABILITY); \
} while (0)
#define OBJC_RUNTIME_OBJC_EXCEPTION_RETHROW_ENABLED() \
({ int _r = __dtrace_isenabled$objc_runtime$objc_exception_rethrow$v1(); \
__asm__ volatile(""); \
_r; })
#define OBJC_RUNTIME_OBJC_EXCEPTION_THROW(arg0) \
do { \
__asm__ volatile(".reference " OBJC_RUNTIME_TYPEDEFS); \
__dtrace_probe$objc_runtime$objc_exception_throw$v1$766f6964202a(arg0); \
__asm__ volatile(".reference " OBJC_RUNTIME_STABILITY); \
} while (0)
#define OBJC_RUNTIME_OBJC_EXCEPTION_THROW_ENABLED() \
({ int _r = __dtrace_isenabled$objc_runtime$objc_exception_throw$v1(); \
__asm__ volatile(""); \
_r; })
extern void __dtrace_probe$objc_runtime$objc_exception_rethrow$v1(void);
extern int __dtrace_isenabled$objc_runtime$objc_exception_rethrow$v1(void);
extern void __dtrace_probe$objc_runtime$objc_exception_throw$v1$766f6964202a(const void *);
extern int __dtrace_isenabled$objc_runtime$objc_exception_throw$v1(void);
#else
#define OBJC_RUNTIME_OBJC_EXCEPTION_RETHROW() \
do { \
} while (0)
#define OBJC_RUNTIME_OBJC_EXCEPTION_RETHROW_ENABLED() (0)
#define OBJC_RUNTIME_OBJC_EXCEPTION_THROW(arg0) \
do { \
} while (0)
#define OBJC_RUNTIME_OBJC_EXCEPTION_THROW_ENABLED() (0)
#endif /* !defined(DTRACE_PROBES_DISABLED) || !DTRACE_PROBES_DISABLED */
#ifdef __cplusplus
}
#endif
#endif /* _OBJC_PROBES_H */

View file

@ -0,0 +1,118 @@
{ stdenv, fetchapplesource, libauto, launchd, libc_old, libunwind }:
stdenv.mkDerivation rec {
version = "551.1";
pname = "objc4";
src = fetchapplesource {
inherit version;
name = "objc4";
sha256 = "1jrdb6yyb5jwwj27c1r0nr2y2ihqjln8ynj61mpkvp144c1cm5bg";
};
patches = [ ./spinlocks.patch ];
buildInputs = [ libauto launchd libc_old libunwind ];
buildPhase = ''
cp ${./objc-probes.h} runtime/objc-probes.h
mkdir -p build/include/objc
cp runtime/hashtable.h build/include/objc/hashtable.h
cp runtime/OldClasses.subproj/List.h build/include/objc/List.h
cp runtime/hashtable2.h build/include/objc/hashtable2.h
cp runtime/message.h build/include/objc/message.h
cp runtime/objc-api.h build/include/objc/objc-api.h
cp runtime/objc-auto.h build/include/objc/objc-auto.h
cp runtime/objc-class.h build/include/objc/objc-class.h
cp runtime/objc-exception.h build/include/objc/objc-exception.h
cp runtime/objc-load.h build/include/objc/objc-load.h
cp runtime/objc-sync.h build/include/objc/objc-sync.h
cp runtime/objc.h build/include/objc/objc.h
cp runtime/objc-runtime.h build/include/objc/objc-runtime.h
cp runtime/Object.h build/include/objc/Object.h
cp runtime/Protocol.h build/include/objc/Protocol.h
cp runtime/runtime.h build/include/objc/runtime.h
cp runtime/NSObject.h build/include/objc/NSObject.h
cp runtime/NSObjCRuntime.h build/include/objc/NSObjCRuntime.h
# These would normally be in local/include but we don't do local, so they're
# going in with the others
cp runtime/maptable.h build/include/objc/maptable.h
cp runtime/objc-abi.h build/include/objc/objc-abi.h
cp runtime/objc-auto-dump.h build/include/objc/objc-auto-dump.h
cp runtime/objc-gdb.h build/include/objc/objc-gdb.h
cp runtime/objc-internal.h build/include/objc/objc-internal.h
cc -o markgc markgc.c
FLAGS="-Wno-deprecated-register -Wno-unknown-pragmas -Wno-deprecated-objc-isa-usage -Wno-invalid-offsetof -Wno-inline-new-delete -Wno-cast-of-sel-type -Iruntime -Ibuild/include -Iruntime/Accessors.subproj -D_LIBCPP_VISIBLE= -DOS_OBJECT_USE_OBJC=0 -DNDEBUG=1"
cc -std=gnu++11 $FLAGS -c runtime/hashtable2.mm
cc -std=gnu++11 $FLAGS -c runtime/maptable.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-auto.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-cache.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-class-old.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-class.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-errors.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-exception.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-file.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-initialize.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-layout.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-load.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-loadmethod.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-lockdebug.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-runtime-new.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-runtime-old.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-runtime.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-sel-set.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-sel.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-sync.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-typeencoding.mm
cc -std=gnu++11 $FLAGS -c runtime/Object.mm
cc -std=gnu++11 $FLAGS -c runtime/Protocol.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-references.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-os.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-auto-dump.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-file-old.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-block-trampolines.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-externalref.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-weak.mm
cc -std=gnu++11 $FLAGS -c runtime/NSObject.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-opt.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-cache-old.mm
cc -std=gnu++11 $FLAGS -c runtime/objc-sel-old.mm
cc -std=gnu++11 $FLAGS -c runtime/Accessors.subproj/objc-accessors.mm
cc $FLAGS -c runtime/objc-sel-table.s
cc $FLAGS -c runtime/OldClasses.subproj/List.m
cc $FLAGS -c runtime/Messengers.subproj/objc-msg-arm.s
cc $FLAGS -c runtime/Messengers.subproj/objc-msg-i386.s
cc $FLAGS -c runtime/Messengers.subproj/objc-msg-x86_64.s
cc $FLAGS -c runtime/Messengers.subproj/objc-msg-simulator-i386.s
cc $FLAGS -c runtime/a1a2-blocktramps-i386.s
cc $FLAGS -c runtime/a2a3-blocktramps-i386.s
cc $FLAGS -c runtime/a1a2-blocktramps-x86_64.s
cc $FLAGS -c runtime/a2a3-blocktramps-x86_64.s
cc $FLAGS -c runtime/a1a2-blocktramps-arm.s
cc $FLAGS -c runtime/a2a3-blocktramps-arm.s
c++ -Wl,-no_dtrace_dof --stdlib=libc++ -dynamiclib -lauto -install_name $out/lib/libobjc.dylib -o libobjc.dylib *.o
./markgc -p libobjc.dylib
'';
installPhase = ''
mkdir -p $out/include $out/lib
mv build/include/objc $out/include
mv libobjc.dylib $out/lib
'';
}

View file

@ -0,0 +1,107 @@
--- objc4-551.1/runtime/objc-os.h 2013-06-10 21:16:15.000000000 -0400
+++ ../objc4-551.1/runtime/objc-os.h 2015-01-19 01:01:36.000000000 -0500
@@ -77,27 +77,72 @@
# include <mach-o/getsect.h>
# include <mach-o/dyld_priv.h>
# include <malloc/malloc.h>
-# include <os/lock_private.h>
# include <libkern/OSAtomic.h>
# include <libkern/OSCacheControl.h>
-# include <System/pthread_machdep.h>
# include "objc-probes.h" // generated dtrace probe definitions.
+#define __PTK_FRAMEWORK_OBJC_KEY5 45
+#define __PTK_FRAMEWORK_OBJC_KEY6 46
+#define __PTK_FRAMEWORK_OBJC_KEY7 47
+#define __PTK_FRAMEWORK_OBJC_KEY8 48
+#define __PTK_FRAMEWORK_OBJC_KEY9 49
+
+extern "C" int pthread_key_init_np(int, void (*)(void *));
+
// Some libc functions call objc_msgSend()
// so we can't use them without deadlocks.
void syslog(int, const char *, ...) UNAVAILABLE_ATTRIBUTE;
void vsyslog(int, const char *, va_list) UNAVAILABLE_ATTRIBUTE;
+#if defined(__i386__) || defined(__x86_64__)
+
+// Inlined spinlock.
+// Not for arm on iOS because it hurts uniprocessor performance.
+
+#define ARR_SPINLOCK_INIT 0
+// XXX -- Careful: OSSpinLock isn't volatile, but should be
+typedef volatile int ARRSpinLock;
+__attribute__((always_inline))
+static inline void ARRSpinLockLock(ARRSpinLock *l)
+{
+ unsigned y;
+again:
+ if (__builtin_expect(__sync_lock_test_and_set(l, 1), 0) == 0) {
+ return;
+ }
+ for (y = 1000; y; y--) {
+#if defined(__i386__) || defined(__x86_64__)
+ asm("pause");
+#endif
+ if (*l == 0) goto again;
+ }
+ thread_switch(THREAD_NULL, SWITCH_OPTION_DEPRESS, 1);
+ goto again;
+}
+__attribute__((always_inline))
+static inline void ARRSpinLockUnlock(ARRSpinLock *l)
+{
+ __sync_lock_release(l);
+}
+__attribute__((always_inline))
+static inline int ARRSpinLockTry(ARRSpinLock *l)
+{
+ return __sync_bool_compare_and_swap(l, 0, 1);
+}
+
+#define spinlock_t ARRSpinLock
+#define spinlock_trylock(l) ARRSpinLockTry(l)
+#define spinlock_lock(l) ARRSpinLockLock(l)
+#define spinlock_unlock(l) ARRSpinLockUnlock(l)
+#define SPINLOCK_INITIALIZER ARR_SPINLOCK_INIT
-#define spinlock_t os_lock_handoff_s
-#define spinlock_trylock(l) os_lock_trylock(l)
-#define spinlock_lock(l) os_lock_lock(l)
-#define spinlock_unlock(l) os_lock_unlock(l)
-#define SPINLOCK_INITIALIZER OS_LOCK_HANDOFF_INIT
+#endif
#if !TARGET_OS_IPHONE
-# include <CrashReporterClient.h>
+#define CRSetCrashLogMessage(msg)
+#define CRGetCrashLogMessage() 0
+#define CRSetCrashLogMessage2(msg)
#else
// CrashReporterClient not yet available on iOS
__BEGIN_DECLS
@@ -594,21 +639,13 @@
{
assert(is_valid_direct_key(k));
- if (_pthread_has_direct_tsd()) {
- return _pthread_getspecific_direct(k);
- } else {
- return pthread_getspecific(k);
- }
+ return pthread_getspecific(k);
}
static inline void tls_set_direct(tls_key_t k, void *value)
{
assert(is_valid_direct_key(k));
- if (_pthread_has_direct_tsd()) {
- _pthread_setspecific_direct(k, value);
- } else {
- pthread_setspecific(k, value);
- }
+ pthread_setspecific(k, value);
}
// not arm

View file

@ -0,0 +1,15 @@
{ appleDerivation', stdenv }:
appleDerivation' stdenv {
dontBuild = true;
installPhase = ''
mkdir -p $out/include/ppp
cp Controller/ppp_msg.h $out/include/ppp
cp Controller/pppcontroller_types.h $out/include/ppp
cp Controller/pppcontroller_types.h $out/include
cp Controller/pppcontroller.defs $out/include/ppp
cp Controller/pppcontroller_mach_defines.h $out/include
cp Controller/PPPControllerPriv.h $out/include/ppp
'';
}

View file

@ -0,0 +1,13 @@
{ appleDerivation', stdenvNoCC }:
appleDerivation' stdenvNoCC {
installPhase = ''
mkdir -p $out/include/
cp removefile.h checkint.h $out/include/
'';
appleHeaders = ''
checkint.h
removefile.h
'';
}

View file

@ -0,0 +1,50 @@
{ lib, appleDerivation, xcbuildHook, launchd }:
appleDerivation {
nativeBuildInputs = [ xcbuildHook launchd ];
patchPhase = ''
# NOTE: these hashes must be recalculated for each version change
# disables:
# - su ('security/pam_appl.h' file not found)
# - find (Undefined symbol '_get_date')
# - w (Undefined symbol '_res_9_init')
# - expr
substituteInPlace shell_cmds.xcodeproj/project.pbxproj \
--replace "FCBA168714A146D000AA698B /* PBXTargetDependency */," "" \
--replace "FCBA165914A146D000AA698B /* PBXTargetDependency */," "" \
--replace "FCBA169514A146D000AA698B /* PBXTargetDependency */," "" \
--replace "FCBA165514A146D000AA698B /* PBXTargetDependency */," ""
# disable w, test install
# get rid of permission stuff
substituteInPlace xcodescripts/install-files.sh \
--replace 'ln -f "$BINDIR/w" "$BINDIR/uptime"' "" \
--replace 'ln -f "$DSTROOT/bin/test" "$DSTROOT/bin/["' "" \
--replace "-o root -g wheel -m 0755" "" \
--replace "-o root -g wheel -m 0644" ""
'';
# temporary install phase until xcodebuild has "install" support
installPhase = ''
for f in Products/Release/*; do
if [ -f $f ]; then
install -D $f $out/usr/bin/$(basename $f)
fi
done
export DSTROOT=$out
export SRCROOT=$PWD
. xcodescripts/install-files.sh
mv $out/usr/* $out
mv $out/private/etc $out
rmdir $out/usr $out/private
'';
meta = {
platforms = lib.platforms.darwin;
maintainers = with lib.maintainers; [ matthewbauer ];
};
}

View file

@ -0,0 +1,109 @@
{ stdenv, appleDerivation, lib
, libutil, Librpcsvc, apple_sdk, pam, CF, openbsm }:
appleDerivation {
# xcbuild fails with:
# /nix/store/fc0rz62dh8vr648qi7hnqyik6zi5sqx8-xcbuild-wrapper/nix-support/setup-hook: line 1: 9083 Segmentation fault: 11 xcodebuild OTHER_CFLAGS="$NIX_CFLAGS_COMPILE" OTHER_CPLUSPLUSFLAGS="$NIX_CFLAGS_COMPILE" OTHER_LDFLAGS="$NIX_LDFLAGS" build
# see issue facebook/xcbuild#188
# buildInputs = [ xcbuild ];
buildInputs = [ libutil Librpcsvc apple_sdk.frameworks.OpenDirectory pam CF
apple_sdk.frameworks.IOKit openbsm ];
# NIX_CFLAGS_COMPILE = lib.optionalString hostPlatform.isi686 "-D__i386__"
# + lib.optionalString hostPlatform.isx86_64 "-D__x86_64__"
# + lib.optionalString hostPlatform.isAarch32 "-D__arm__";
NIX_CFLAGS_COMPILE = [ "-DDAEMON_UID=1"
"-DDAEMON_GID=1"
"-DDEFAULT_AT_QUEUE='a'"
"-DDEFAULT_BATCH_QUEUE='b'"
"-DPERM_PATH=\"/usr/lib/cron/\""
"-DOPEN_DIRECTORY"
"-DNO_DIRECT_RPC"
"-DAPPLE_GETCONF_UNDERSCORE"
"-DAPPLE_GETCONF_SPEC"
"-DUSE_PAM"
"-DUSE_BSM_AUDIT"
"-D_PW_NAME_LEN=MAXLOGNAME"
"-D_PW_YPTOKEN=\"__YP!\""
"-DAHZV1=64 "
"-DAU_SESSION_FLAG_HAS_TTY=0x4000"
"-DAU_SESSION_FLAG_HAS_AUTHENTICATED=0x4000"
] ++ lib.optional (!stdenv.isLinux) " -D__FreeBSD__ ";
patchPhase = ''
substituteInPlace login.tproj/login.c \
--replace bsm/audit_session.h bsm/audit.h
substituteInPlace login.tproj/login_audit.c \
--replace bsm/audit_session.h bsm/audit.h
'' + lib.optionalString stdenv.isAarch64 ''
substituteInPlace sysctl.tproj/sysctl.c \
--replace "GPROF_STATE" "0"
substituteInPlace login.tproj/login.c \
--replace "defined(__arm__)" "defined(__arm__) || defined(__arm64__)"
'';
buildPhase = ''
for dir in *.tproj; do
name=$(basename $dir)
name=''${name%.tproj}
CFLAGS=""
case $name in
arch) CFLAGS="-framework CoreFoundation";;
atrun) CFLAGS="-Iat.tproj";;
chkpasswd)
CFLAGS="-framework OpenDirectory -framework CoreFoundation -lpam";;
getconf)
for f in getconf.tproj/*.gperf; do
cfile=''${f%.gperf}.c
LC_ALL=C awk -f getconf.tproj/fake-gperf.awk $f > $cfile
done
;;
iostat) CFLAGS="-framework IOKit -framework CoreFoundation";;
login) CFLAGS="-lbsm -lpam";;
nvram) CFLAGS="-framework CoreFoundation -framework IOKit";;
sadc) CFLAGS="-framework IOKit -framework CoreFoundation";;
sar) CFLAGS="-Isadc.tproj";;
esac
echo "Building $name"
case $name in
# These are all broken currently.
arch) continue;;
chpass) continue;;
dirhelper) continue;;
dynamic_pager) continue;;
fs_usage) continue;;
latency) continue;;
pagesize) continue;;
passwd) continue;;
reboot) continue;;
sc_usage) continue;;
shutdown) continue;;
trace) continue;;
*) cc $dir/*.c -I''${dir} $CFLAGS -o $name ;;
esac
done
'';
installPhase = ''
for dir in *.tproj; do
name=$(basename $dir)
name=''${name%.tproj}
[ -x $name ] && install -D $name $out/bin/$name
for n in 1 2 3 4 5 6 7 8 9; do
for f in $dir/*.$n; do
install -D $f $out/share/man/man$n/$(basename $f)
done
done
done
'';
meta = {
platforms = lib.platforms.darwin;
maintainers = with lib.maintainers; [ shlevy matthewbauer ];
};
}

View file

@ -0,0 +1,29 @@
{ lib, appleDerivation, xcbuildHook, ncurses, bzip2, zlib, xz }:
appleDerivation {
nativeBuildInputs = [ xcbuildHook ];
buildInputs = [ ncurses bzip2 zlib xz ];
# patches to use ncursees
# disables md5
patchPhase = ''
substituteInPlace text_cmds.xcodeproj/project.pbxproj \
--replace 'FC6C98FB149A94EB00DDCC47 /* libcurses.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcurses.dylib; path = /usr/lib/libcurses.dylib; sourceTree = "<absolute>"; };' 'FC6C98FB149A94EB00DDCC47 /* libncurses.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libncurses.dylib; path = /usr/lib/libncurses.dylib; sourceTree = "<absolute>"; };' \
--replace 'FC7A7EB5149875E00086576A /* PBXTargetDependency */,' ""
'';
installPhase = ''
for f in Products/Release/*; do
if [ -f $f ]; then
install -D $f $out/bin/$(basename $f)
fi
done
'';
NIX_CFLAGS_COMPILE=[ "-Wno-error=format-security" ]; # hardeningDisable doesn't cut it
meta = {
platforms = lib.platforms.darwin;
maintainers = with lib.maintainers; [ matthewbauer ];
};
}

View file

@ -0,0 +1,16 @@
{xcbuildHook, appleDerivation, apple_sdk, ncurses, libutil, lib}:
appleDerivation {
nativeBuildInputs = [ xcbuildHook ];
buildInputs = [ apple_sdk.frameworks.IOKit ncurses libutil ];
NIX_LDFLAGS = "-lutil";
installPhase = ''
install -D Products/Release/libtop.a $out/lib/libtop.a
install -D Products/Release/libtop.h $out/include/libtop.h
install -D Products/Release/top $out/bin/top
'';
meta = {
platforms = lib.platforms.darwin;
maintainers = with lib.maintainers; [ matthewbauer ];
};
}

View file

@ -0,0 +1,145 @@
{ appleDerivation', lib, stdenv, stdenvNoCC, buildPackages
, bootstrap_cmds, bison, flex
, gnum4, unifdef, perl, python3
, headersOnly ? true
}:
appleDerivation' (if headersOnly then stdenvNoCC else stdenv) ({
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ bootstrap_cmds bison flex gnum4 unifdef perl python3 ];
patches = [ ./python3.patch ];
postPatch = ''
substituteInPlace Makefile \
--replace "/bin/" "" \
--replace "MAKEJOBS := " '# MAKEJOBS := '
substituteInPlace makedefs/MakeInc.cmd \
--replace "/usr/bin/" "" \
--replace "/bin/" "" \
--replace "-Werror " ""
substituteInPlace makedefs/MakeInc.def \
--replace "-c -S -m" "-c -m"
substituteInPlace makedefs/MakeInc.top \
--replace "MEMORY_SIZE := " 'MEMORY_SIZE := 1073741824 # '
substituteInPlace libkern/kxld/Makefile \
--replace "-Werror " ""
substituteInPlace SETUP/kextsymboltool/Makefile \
--replace "-lstdc++" "-lc++"
substituteInPlace libsyscall/xcodescripts/mach_install_mig.sh \
--replace "/usr/include" "/include" \
--replace "/usr/local/include" "/include" \
--replace 'MIG=`' "# " \
--replace 'MIGCC=`' "# " \
--replace " -o 0" "" \
--replace '$SRC/$mig' '-I$DSTROOT/include $SRC/$mig' \
--replace '$SRC/servers/netname.defs' '-I$DSTROOT/include $SRC/servers/netname.defs' \
--replace '$BUILT_PRODUCTS_DIR/mig_hdr' '$BUILT_PRODUCTS_DIR'
patchShebangs .
'';
PLATFORM = "MacOSX";
SDKVERSION = "10.11";
CC = "${stdenv.cc.targetPrefix or ""}cc";
CXX = "${stdenv.cc.targetPrefix or ""}c++";
MIG = "mig";
MIGCOM = "migcom";
STRIP = "${stdenv.cc.bintools.targetPrefix or ""}strip";
NM = "${stdenv.cc.bintools.targetPrefix or ""}nm";
UNIFDEF = "unifdef";
DSYMUTIL = "dsymutil";
HOST_OS_VERSION = "10.10";
HOST_CC = "${buildPackages.stdenv.cc.targetPrefix or ""}cc";
HOST_FLEX = "flex";
HOST_BISON = "bison";
HOST_GM4 = "m4";
MIGCC = "cc";
ARCHS = "x86_64";
NIX_CFLAGS_COMPILE = "-Wno-error";
preBuild = ''
# This is a bit of a hack...
mkdir -p sdk/usr/local/libexec
cat > sdk/usr/local/libexec/availability.pl <<EOF
#!$SHELL
if [ "\$1" == "--macosx" ]; then
echo 10.0 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 10.10 10.11
elif [ "\$1" == "--ios" ]; then
echo 2.0 2.1 2.2 3.0 3.1 3.2 4.0 4.1 4.2 4.3 5.0 5.1 6.0 6.1 7.0 8.0 9.0
fi
EOF
chmod +x sdk/usr/local/libexec/availability.pl
export SDKROOT_RESOLVED=$PWD/sdk
export HOST_SDKROOT_RESOLVED=$PWD/sdk
export BUILT_PRODUCTS_DIR=.
export DSTROOT=$out
'';
buildFlags = lib.optional headersOnly "exporthdrs";
installTargets = lib.optional headersOnly "installhdrs";
postInstall = lib.optionalString headersOnly ''
mv $out/usr/include $out
(cd BUILD/obj/EXPORT_HDRS && find -type f -exec install -D \{} $out/include/\{} \;)
# TODO: figure out why I need to do this
cp libsyscall/wrappers/*.h $out/include
install -D libsyscall/os/tsd.h $out/include/os/tsd.h
cp EXTERNAL_HEADERS/AssertMacros.h $out/include
cp EXTERNAL_HEADERS/Availability*.h $out/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/
cp -r EXTERNAL_HEADERS/corecrypto $out/include
# Build the mach headers we crave
export SRCROOT=$PWD/libsyscall
export DERIVED_SOURCES_DIR=$out/include
export SDKROOT=$out
export OBJROOT=$PWD
export BUILT_PRODUCTS_DIR=$out
libsyscall/xcodescripts/mach_install_mig.sh
# Get rid of the System prefix
mv $out/System/* $out/
rmdir $out/System
# TODO: do I need this?
mv $out/internal_hdr/include/mach/*.h $out/include/mach
# Get rid of some junk lying around
rm -rf $out/internal_hdr $out/usr $out/local
# Add some symlinks
ln -s $out/Library/Frameworks/System.framework/Versions/B \
$out/Library/Frameworks/System.framework/Versions/Current
ln -s $out/Library/Frameworks/System.framework/Versions/Current/PrivateHeaders \
$out/Library/Frameworks/System.framework/Headers
# IOKit (and possibly the others) is incomplete,
# so let's not make it visible from here...
mkdir $out/Library/PrivateFrameworks
mv $out/Library/Frameworks/IOKit.framework $out/Library/PrivateFrameworks
'';
appleHeaders = builtins.readFile ./headers.txt;
} // lib.optionalAttrs headersOnly {
HOST_CODESIGN = "echo";
HOST_CODESIGN_ALLOCATE = "echo";
LIPO = "echo";
LIBTOOL = "echo";
CTFCONVERT = "echo";
CTFMERGE = "echo";
CTFINSERT = "echo";
NMEDIT = "echo";
})

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,41 @@
diff --git a/bsd/kern/makekdebugevents.py b/bsd/kern/makekdebugevents.py
index 73b2db4..d354ba0 100755
--- a/bsd/kern/makekdebugevents.py
+++ b/bsd/kern/makekdebugevents.py
@@ -5,7 +5,7 @@
# named kd_events[] or these mappings.
# Required to generate a header file used by DEVELOPMENT and DEBUG kernels.
#
-
+
import sys
import re
@@ -21,18 +21,18 @@ code_table = []
# scan file to generate internal table
with open(trace_code_file, 'rt') as codes:
for line in codes:
- m = id_name_pattern.match(line)
- if m:
+ m = id_name_pattern.match(line)
+ if m:
code_table += [(int(m.group(1),base=16), m.group(2))]
# emit typedef:
-print "typedef struct {"
-print " uint32_t id;"
-print " const char *name;"
-print "} kd_event_t;"
+print("typedef struct {")
+print(" uint32_t id;")
+print(" const char *name;")
+print("} kd_event_t;")
# emit structure declaration and sorted initialization:
-print "kd_event_t kd_events[] = {"
+print("kd_event_t kd_events[] = {")
for mapping in sorted(code_table, key=lambda x: x[0]):
- print " {0x%x, \"%s\"}," % mapping
-print "};"
+ print(" {0x%x, \"%s\"}," % mapping)
+print("};")