1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00

darwin purity: haskell-hfsevents

This commit is contained in:
Jude Taylor 2015-06-20 15:29:42 -07:00
parent 507bb016cc
commit a4fbe26ec8
4 changed files with 276 additions and 1 deletions

View file

@ -192,7 +192,11 @@ self: super: {
# cabal2nix likes to generate dependencies on hinotify when hfsevents is really required
# on darwin: https://github.com/NixOS/cabal2nix/issues/146
hinotify = if pkgs.stdenv.isDarwin then super.hfsevents else super.hinotify;
hinotify = if pkgs.stdenv.isDarwin then self.hfsevents else super.hinotify;
hfsevents = if pkgs.stdenv.isDarwin
then addBuildTool super.hfsevents pkgs.darwin.apple_sdk.frameworks.CoreServices
else super.hfsevents;
# FSEvents API is very buggy and tests are unreliable. See
# http://openradar.appspot.com/10207999 and similar issues

View file

@ -0,0 +1,150 @@
{ stdenv, fetchurl, xar, gzip, cpio }:
let
# I'd rather not "export" this, since they're somewhat monolithic and encourage bad habits.
# Also, the include directory inside here should be captured (almost?) entirely by our more
# precise Apple package structure, so with any luck it's unnecessary.
sdk = stdenv.mkDerivation rec {
version = "10.9";
name = "MacOS_SDK-${version}";
src = fetchurl {
url = "http://swcdn.apple.com/content/downloads/27/02/031-06182/xxog8vxu8i6af781ivf4uhy6yt1lslex34/DevSDK_OSX109.pkg";
sha256 = "16b7aplha5573yl1d44nl2yxzp0w2hafihbyh7930wrcvba69iy4";
};
buildInputs = [ xar gzip cpio ];
phases = [ "unpackPhase" "installPhase" "fixupPhase" ];
unpackPhase = ''
xar -x -f $src
'';
installPhase = ''
start="$(pwd)"
mkdir -p $out
cd $out
cat $start/Payload | gzip -d | cpio -idm
mv usr/* .
rmdir usr
mv System/* .
rmdir System
cd Library/Frameworks/QuartzCore.framework/Versions/A/Headers
for file in CI*.h; do
rm $file
ln -s ../Frameworks/CoreImage.framework/Versions/A/Headers/$file
done
'';
meta = with stdenv.lib; {
description = "Apple SDK ${version}";
maintainers = with maintainers; [ copumpkin ];
platforms = platforms.darwin;
};
};
framework = name: deps: stdenv.mkDerivation {
name = "apple-framework-${name}";
phases = [ "installPhase" "fixupPhase" ];
installPhase = ''
linkFramework() {
local path="$1"
local dest="$out/Library/Frameworks/$path"
local name="$(basename "$path" .framework)"
local current="$(readlink "/System/Library/Frameworks/$path/Versions/Current")"
mkdir -p "$dest"
pushd "$dest" >/dev/null
ln -s "${sdk}/Library/Frameworks/$path/Versions/$current/Headers"
ln -s -L "/System/Library/Frameworks/$path/Versions/$current/$name"
ln -s -L "/System/Library/Frameworks/$path/Versions/$current/Resources"
if [ -f "/System/Library/Frameworks/$path/module.map" ]; then
ln -s "/System/Library/Frameworks/$path/module.map"
fi
pushd "${sdk}/Library/Frameworks/$path/Versions/$current" >/dev/null
local children=$(echo Frameworks/*.framework)
popd >/dev/null
for child in $children; do
childpath="$path/Versions/$current/$child"
linkFramework "$childpath"
done
if [ -d "$dest/Versions/$current" ]; then
mv $dest/Versions/$current/* .
fi
popd >/dev/null
}
linkFramework "${name}.framework"
'';
propagatedBuildInputs = deps;
# Not going to bother being more precise than this...
__propagatedImpureHostDeps = [ "/System/Library/Frameworks/${name}.framework/Versions" ];
meta = with stdenv.lib; {
description = "Apple SDK framework ${name}";
maintainers = with maintainers; [ copumpkin ];
platforms = platforms.darwin;
};
};
in rec {
libs = {
xpc = stdenv.mkDerivation {
name = "apple-lib-xpc";
phases = [ "installPhase" "fixupPhase" ];
installPhase = ''
mkdir -p $out/include
pushd $out/include >/dev/null
ln -s "${sdk}/include/xpc"
popd >/dev/null
'';
};
Xplugin = stdenv.mkDerivation {
name = "apple-lib-Xplugin";
phases = [ "installPhase" "fixupPhase" ];
# Not enough
__propagatedImpureHostDeps = [ "/usr/lib/libXplugin.1.dylib" ];
propagatedBuildInputs = with frameworks; [
OpenGL ApplicationServices Carbon IOKit CoreFoundation CoreGraphics CoreServices CoreText
];
installPhase = ''
mkdir -p $out/include $out/lib
ln -s "${sdk}/include/Xplugin.h" $out/include/Xplugin.h
ln -s "/usr/lib/libXplugin.1.dylib" $out/lib/libXplugin.dylib
'';
};
utmp = stdenv.mkDerivation {
name = "apple-lib-utmp";
phases = [ "installPhase" "fixupPhase" ];
installPhase = ''
mkdir -p $out/include
pushd $out/include >/dev/null
ln -s "${sdk}/include/utmp.h"
ln -s "${sdk}/include/utmpx.h"
popd >/dev/null
'';
};
};
frameworks = stdenv.lib.mapAttrs framework (import ./frameworks.nix { inherit frameworks libs; });
}

View file

@ -0,0 +1,119 @@
# Current as of 10.9
# Epic weird knot-tying happening here.
# TODO: clean up the process for generating this and include it
{ frameworks, libs }:
with frameworks; with libs; {
AGL = [ Carbon OpenGL ];
AVFoundation = [ ApplicationServices CoreGraphics ];
AVKit = [];
Accounts = [];
AddressBook = [ Carbon CoreFoundation ];
AppKit = [ QuartzCore ];
AppKitScripting = [];
AppleScriptKit = [];
AppleScriptObjC = [];
AppleShareClientCore = [ CoreServices ];
AudioToolbox = [ AudioUnit CoreAudio CoreFoundation CoreMIDI ];
AudioUnit = [ Carbon CoreAudio CoreFoundation ];
AudioVideoBridging = [ Foundation ];
Automator = [];
CFNetwork = [ CoreFoundation ];
CalendarStore = [];
Cocoa = [];
Collaboration = [];
CoreAudio = [ CoreFoundation IOKit ];
CoreAudioKit = [ AudioUnit ];
CoreData = [];
CoreFoundation = [];
CoreGraphics = [ CoreFoundation IOKit IOSurface ];
CoreLocation = [];
CoreMIDI = [ CoreFoundation ];
CoreMIDIServer = [];
CoreMedia = [ ApplicationServices AudioToolbox CoreAudio CoreFoundation CoreGraphics CoreVideo ];
CoreMediaIO = [ CoreFoundation CoreMedia ];
CoreText = [ CoreFoundation CoreGraphics ];
CoreVideo = [ ApplicationServices CoreFoundation CoreGraphics IOSurface OpenGL ];
CoreWLAN = [];
DVComponentGlue = [ CoreServices QuickTime ];
DVDPlayback = [];
DirectoryService = [ CoreFoundation ];
DiscRecording = [ CoreFoundation CoreServices IOKit ];
DiscRecordingUI = [];
DiskArbitration = [ CoreFoundation IOKit ];
DrawSprocket = [ Carbon ];
EventKit = [];
ExceptionHandling = [];
FWAUserLib = [];
ForceFeedback = [ CoreFoundation IOKit ];
Foundation = [ CoreFoundation Security ApplicationServices AppKit ];
GLKit = [ CoreFoundation ];
GLUT = [ GL OpenGL ];
GSS = [];
GameController = [];
GameKit = [ Foundation ];
ICADevices = [ Carbon CoreFoundation IOBluetooth ];
IMServicePlugIn = [];
IOBluetoothUI = [ IOBluetooth ];
IOKit = [ CoreFoundation ];
IOSurface = [ CoreFoundation IOKit xpc ];
ImageCaptureCore = [];
ImageIO = [ CoreFoundation CoreGraphics ];
InputMethodKit = [ Carbon ];
InstallerPlugins = [];
InstantMessage = [];
JavaFrameEmbedding = [];
JavaScriptCore = [ CoreFoundation ];
Kerberos = [];
Kernel = [ CoreFoundation IOKit ];
LDAP = [];
LatentSemanticMapping = [ Carbon CoreFoundation ];
MapKit = [];
MediaAccessibility = [ CoreFoundation CoreGraphics CoreText QuartzCore ];
MediaToolbox = [ AudioToolbox CoreFoundation CoreMedia ];
NetFS = [ CoreFoundation ];
OSAKit = [ Carbon ];
OpenAL = [];
OpenCL = [ CL IOSurface OpenGL ];
OpenGL = [];
PCSC = [];
PreferencePanes = [];
PubSub = [];
Python = [ ApplicationServices ];
QTKit = [ QuickTime ];
QuickLook = [ ApplicationServices CoreFoundation ];
QuickTime = [ ApplicationServices AudioUnit Carbon CoreAudio CoreServices OpenGL QuartzCore ];
Ruby = [];
RubyCocoa = [];
SceneKit = [];
ScreenSaver = [];
Scripting = [];
ScriptingBridge = [];
Security = [ CoreFoundation ];
SecurityFoundation = [];
SecurityInterface = [ Security ];
ServiceManagement = [ CoreFoundation Security ];
Social = [];
SpriteKit = [];
StoreKit = [];
SyncServices = [];
SystemConfiguration = [ CoreFoundation Security ];
TWAIN = [ Carbon ];
Tcl = [];
Tk = [ ApplicationServices Carbon X11 ];
VideoDecodeAcceleration = [ CoreFoundation CoreVideo ];
VideoToolbox = [ CoreFoundation CoreMedia CoreVideo ];
WebKit = [ ApplicationServices Carbon JavaScriptCore OpenGL X11 ];
# Umbrellas
Accelerate = [ CoreGraphics ];
ApplicationServices = [ CoreFoundation CoreServices CoreText ImageIO ];
Carbon = [ ApplicationServices CoreFoundation CoreServices IOKit Security ];
CoreServices = [ CFNetwork CoreFoundation DiskArbitration Security ];
IOBluetooth = [ IOKit ];
JavaVM = [];
OpenDirectory = [ CoreFoundation Foundation ];
Quartz = [ QuickLook ];
QuartzCore = [ ApplicationServices CoreFoundation CoreVideo ];
}

View file

@ -9235,6 +9235,8 @@ let
cmdline_sdk = cmdline.sdk;
cmdline_tools = cmdline.tools;
apple_sdk = callPackage ../os-specific/darwin/apple-sdk {};
libobjc = apple-source-releases.objc4;
};