Merge pull request #49880 from LnL7/darwin-cfprivate-fixes

darwin cf-private fixes
This commit is contained in:
Daiderd Jordan 2018-11-10 15:03:21 +01:00 committed by GitHub
commit 8d603be22d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 106 additions and 82 deletions

View File

@ -1,7 +1,7 @@
{ stdenv, lib, fetchurl, ncurses, xlibsWrapper, libXaw, libXpm, Xaw3d
, pkgconfig, gettext, libXft, dbus, libpng, libjpeg, libungif
, libtiff, librsvg, gconf, libxml2, imagemagick, gnutls, libselinux
, alsaLib, cairo, acl, gpm, AppKit, GSS, ImageIO
, alsaLib, cairo, acl, gpm, cf-private, AppKit, GSS, ImageIO
, withX ? !stdenv.isDarwin
, withGTK2 ? false, gtk2 ? null
, withGTK3 ? true, gtk3 ? null, gsettings-desktop-schemas ? null
@ -61,9 +61,12 @@ stdenv.mkDerivation rec {
++ lib.optional (withX && withGTK2) gtk2
++ lib.optionals (withX && withGTK3) [ gtk3 gsettings-desktop-schemas ]
++ lib.optional (stdenv.isDarwin && withX) cairo
++ lib.optionals (withX && withXwidgets) [ webkitgtk24x-gtk3 glib-networking ];
propagatedBuildInputs = lib.optionals stdenv.isDarwin [ AppKit GSS ImageIO ];
++ lib.optionals (withX && withXwidgets) [ webkitgtk24x-gtk3 glib-networking ]
++ lib.optionals stdenv.isDarwin [
AppKit GSS ImageIO
# Needed for CFNotificationCenterAddObserver symbols.
cf-private
];
hardeningDisable = [ "format" ];

View File

@ -1,5 +1,5 @@
{ stdenv, fetchurl, ncurses, pkgconfig, texinfo, libxml2, gnutls, gettext, autoconf, automake
, AppKit, Carbon, Cocoa, IOKit, OSAKit, Quartz, QuartzCore, WebKit
, cf-private, AppKit, Carbon, Cocoa, IOKit, OSAKit, Quartz, QuartzCore, WebKit
, ImageCaptureCore, GSS, ImageIO # These may be optional
}:
@ -33,6 +33,8 @@ stdenv.mkDerivation rec {
buildInputs = [ ncurses libxml2 gnutls texinfo gettext
AppKit Carbon Cocoa IOKit OSAKit Quartz QuartzCore WebKit
ImageCaptureCore GSS ImageIO # may be optional
# Needed for CFNotificationCenterAddObserver symbols.
cf-private
];
postUnpack = ''

View File

@ -18,6 +18,7 @@
libGL,
xclip,
# Darwin Frameworks
cf-private,
AppKit,
CoreFoundation,
CoreGraphics,
@ -40,15 +41,6 @@ let
libGL
libXi
];
darwinFrameworks = [
AppKit
CoreFoundation
CoreGraphics
CoreServices
CoreText
Foundation
OpenGL
];
in buildRustPackage rec {
name = "alacritty-unstable-${version}";
version = "0.2.1";
@ -71,7 +63,11 @@ in buildRustPackage rec {
];
buildInputs = rpathLibs
++ lib.optionals stdenv.isDarwin darwinFrameworks;
++ lib.optionals stdenv.isDarwin [
AppKit CoreFoundation CoreGraphics CoreServices CoreText Foundation OpenGL
# Needed for CFURLResourceIsReachable symbols.
cf-private
];
outputs = [ "out" "terminfo" ];

View File

@ -1,6 +1,6 @@
{ stdenv, fetchurl, pkgconfig, xlibsWrapper, inputproto, libXi
, freeglut, libGLU_combined, libjpeg, zlib, libXft, libpng
, darwin, libtiff, freetype
, libtiff, freetype, cf-private, Cocoa, AGL, GLUT
}:
let
@ -35,7 +35,7 @@ in stdenv.mkDerivation {
propagatedBuildInputs = [ inputproto ]
++ (if stdenv.isDarwin
then (with darwin.apple_sdk.frameworks; [Cocoa AGL GLUT freetype libtiff])
then [ Cocoa AGL GLUT freetype libtiff cf-private /* Needed for NSDefaultRunLoopMode */ ]
else [ xlibsWrapper libXi freeglut ]);
enableParallelBuilding = true;

View File

@ -1,5 +1,5 @@
{ stdenv, lib, fetchFromGitHub, cmake, libGL, libXrandr, libXinerama, libXcursor, libX11
, darwin, fixDarwinDylibNames
, cf-private, Cocoa, Kernel, fixDarwinDylibNames
}:
stdenv.mkDerivation rec {
@ -21,7 +21,11 @@ stdenv.mkDerivation rec {
buildInputs = [
libX11 libXrandr libXinerama libXcursor
] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ Cocoa Kernel fixDarwinDylibNames ]);
] ++ lib.optionals stdenv.isDarwin [
Cocoa Kernel fixDarwinDylibNames
# Needed for NSDefaultRunLoopMode symbols.
cf-private
];
cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" ];

View File

@ -1,54 +1,53 @@
{ stdenv, fetchgit, cmake, pkgconfig, gtk3, darwin }:
{ stdenv, fetchgit, cmake, pkgconfig, gtk3, cf-private, Cocoa }:
let
shortName = "libui";
version = "3.1a";
backend = if stdenv.isDarwin then "darwin" else "unix";
in
stdenv.mkDerivation rec {
name = "${shortName}-${version}";
src = fetchgit {
url = "https://github.com/andlabs/libui.git";
rev = "6ebdc96b93273c3cedf81159e7843025caa83058";
sha256 = "1lpbfa298c61aarlzgp7vghrmxg1274pzxh1j9isv8x758gk6mfn";
};
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ cmake ] ++
(if backend == "darwin" then [darwin.apple_sdk.frameworks.Cocoa]
else if backend == "unix" then [gtk3]
else null);
stdenv.mkDerivation rec {
name = "${shortName}-${version}";
src = fetchgit {
url = "https://github.com/andlabs/libui.git";
rev = "6ebdc96b93273c3cedf81159e7843025caa83058";
sha256 = "1lpbfa298c61aarlzgp7vghrmxg1274pzxh1j9isv8x758gk6mfn";
};
preConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
sed -i 's/set(CMAKE_OSX_DEPLOYMENT_TARGET "10.8")//' ./CMakeLists.txt
'';
nativeBuildInputs = [ cmake pkgconfig ];
buildInputs = stdenv.lib.optional stdenv.isLinux gtk3
++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa cf-private /* For NSDefaultRunLoopMode */ ];
installPhase = ''
mkdir -p $out/{include,lib}
mkdir -p $out/lib/pkgconfig
'' + stdenv.lib.optionalString stdenv.isLinux ''
mv ./out/${shortName}.so.0 $out/lib/
ln -s $out/lib/${shortName}.so.0 $out/lib/${shortName}.so
'' + stdenv.lib.optionalString stdenv.isDarwin ''
mv ./out/${shortName}.A.dylib $out/lib/
ln -s $out/lib/${shortName}.A.dylib $out/lib/${shortName}.dylib
'' + ''
cp $src/ui.h $out/include
cp $src/ui_${backend}.h $out/include
preConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
sed -i 's/set(CMAKE_OSX_DEPLOYMENT_TARGET "10.8")//' ./CMakeLists.txt
'';
cp ${./libui.pc} $out/lib/pkgconfig/${shortName}.pc
substituteInPlace $out/lib/pkgconfig/${shortName}.pc \
--subst-var-by out $out \
--subst-var-by version "${version}"
'';
postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
install_name_tool -id $out/lib/${shortName}.A.dylib $out/lib/${shortName}.A.dylib
'';
installPhase = ''
mkdir -p $out/{include,lib}
mkdir -p $out/lib/pkgconfig
'' + stdenv.lib.optionalString stdenv.isLinux ''
mv ./out/${shortName}.so.0 $out/lib/
ln -s $out/lib/${shortName}.so.0 $out/lib/${shortName}.so
'' + stdenv.lib.optionalString stdenv.isDarwin ''
mv ./out/${shortName}.A.dylib $out/lib/
ln -s $out/lib/${shortName}.A.dylib $out/lib/${shortName}.dylib
'' + ''
cp $src/ui.h $out/include
cp $src/ui_${backend}.h $out/include
meta = with stdenv.lib; {
homepage = https://github.com/andlabs/libui;
description = "Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.";
license = licenses.mit;
platforms = platforms.unix;
};
}
cp ${./libui.pc} $out/lib/pkgconfig/${shortName}.pc
substituteInPlace $out/lib/pkgconfig/${shortName}.pc \
--subst-var-by out $out \
--subst-var-by version "${version}"
'';
postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
install_name_tool -id $out/lib/${shortName}.A.dylib $out/lib/${shortName}.A.dylib
'';
meta = with stdenv.lib; {
homepage = https://github.com/andlabs/libui;
description = "Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.";
license = licenses.mit;
platforms = platforms.unix;
};
}

View File

@ -10,7 +10,7 @@
, enableFfmpeg ? false, ffmpeg
, enableGStreamer ? false, gst_all_1
, enableEigen ? true, eigen
, darwin
, cf-private, Cocoa, QTKit
}:
let
@ -54,7 +54,7 @@ stdenv.mkDerivation rec {
++ lib.optional enableFfmpeg ffmpeg
++ lib.optionals enableGStreamer (with gst_all_1; [ gstreamer gst-plugins-base ])
++ lib.optional enableEigen eigen
++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ Cocoa QTKit ])
++ lib.optionals stdenv.isDarwin [ Cocoa QTKit cf-private /* For NSDefaultRunLoopMode */ ]
;
propagatedBuildInputs = lib.optional enablePython pythonPackages.numpy;

View File

@ -1,4 +1,5 @@
{ stdenv, fetchFromGitHub, frameworks, perl } :
{ stdenv, fetchFromGitHub, perl, cf-private, AppKit, Cocoa, ScriptingBridge }:
stdenv.mkDerivation rec {
version = "0.9.1";
name = "trash-${version}";
@ -10,11 +11,11 @@ stdenv.mkDerivation rec {
sha256 = "0ylkf7jxfy1pj7i1s48w28kzqjdfd57m2pw0jycsgcj5bkzwll41";
};
buildInputs = with frameworks; [
Cocoa
AppKit
ScriptingBridge
buildInputs = [
perl
Cocoa AppKit ScriptingBridge
# Neded for OBJC_CLASS_$_NSMutableArray symbols.
cf-private
];
patches = [ ./trash.diff ];

View File

@ -1,4 +1,4 @@
{ stdenv, buildGoPackage, fetchFromGitHub, Cocoa }:
{ stdenv, buildGoPackage, fetchFromGitHub, cf-private, Cocoa }:
buildGoPackage rec {
name = "noti-${version}";
@ -11,7 +11,7 @@ buildGoPackage rec {
sha256 = "1chsqfqk0pnhx5k2nr4c16cpb8m6zv69l1jvv4v4903zgfzcm823";
};
buildInputs = stdenv.lib.optionals stdenv.isDarwin [ Cocoa ];
buildInputs = stdenv.lib.optionals stdenv.isDarwin [ Cocoa cf-private /* For OBJC_CLASS_$_NSDate */ ];
# TODO: Remove this when we update apple_sdk
NIX_CFLAGS_COMPILE = stdenv.lib.optionals stdenv.isDarwin [ "-fno-objc-arc" ];

View File

@ -1,6 +1,7 @@
{ stdenv, lib, buildGoPackage, fetchFromGitHub
, AVFoundation ? null, AudioToolbox ? null, ImageIO ? null, CoreMedia ? null
, Foundation ? null, CoreGraphics ? null, MediaToolbox ? null }:
{ stdenv, lib, buildGoPackage, fetchFromGitHub, cf-private
, AVFoundation, AudioToolbox, ImageIO, CoreMedia
, Foundation, CoreGraphics, MediaToolbox
}:
buildGoPackage rec {
name = "keybase-${version}";
@ -18,7 +19,11 @@ buildGoPackage rec {
sha256 = "1sw6v3vf544vp8grw8p287cx078mr9v0v1wffcj6f9p9shlwj7ic";
};
buildInputs = lib.optionals stdenv.isDarwin [ AVFoundation AudioToolbox ImageIO CoreMedia Foundation CoreGraphics MediaToolbox ];
buildInputs = lib.optionals stdenv.isDarwin [
AVFoundation AudioToolbox ImageIO CoreMedia Foundation CoreGraphics MediaToolbox
# Needed for OBJC_CLASS_$_NSData symbols.
cf-private
];
buildFlags = [ "-tags production" ];
meta = with stdenv.lib; {

View File

@ -86,7 +86,6 @@ mapAliases ({
docbook_xml_xslt = docbook_xsl; # added 2018-04-25
double_conversion = double-conversion; # 2017-11-22
dwarf_fortress = dwarf-fortress; # added 2016-01-23
emacs25Macport_25_1 = emacs25Macport; # added 2018-04-25
emacsMelpa = emacs25PackagesNg; # for backward compatibility
emacsPackagesGen = emacsPackagesFor; # added 2018-08-18
emacsPackagesNgGen = emacsPackagesNgFor; # added 2018-08-18

View File

@ -521,6 +521,7 @@ with pkgs;
alacritty = callPackage ../applications/misc/alacritty {
inherit (xorg) libXcursor libXxf86vm libXi;
inherit (darwin) cf-private;
inherit (darwin.apple_sdk.frameworks) AppKit CoreFoundation CoreGraphics CoreServices CoreText Foundation OpenGL;
};
@ -1550,6 +1551,7 @@ with pkgs;
noteshrink = callPackage ../tools/misc/noteshrink { };
noti = callPackage ../tools/misc/noti {
inherit (darwin) cf-private;
inherit (darwin.apple_sdk.frameworks) Cocoa;
};
@ -3597,6 +3599,7 @@ with pkgs;
kexpand = callPackage ../development/tools/kexpand { };
keybase = callPackage ../tools/security/keybase {
inherit (darwin) cf-private;
# Reasoning for the inherited apple_sdk.frameworks:
# 1. specific compiler errors about: AVFoundation, AudioToolbox, MediaToolbox
# 2. the rest are added from here: https://github.com/keybase/client/blob/68bb8c893c5214040d86ea36f2f86fbb7fac8d39/go/chat/attachments/preview_darwin.go#L7
@ -9586,7 +9589,10 @@ with pkgs;
flite = callPackage ../development/libraries/flite { };
fltk13 = callPackage ../development/libraries/fltk { };
fltk13 = callPackage ../development/libraries/fltk {
inherit (darwin) cf-private;
inherit (darwin.apple_sdk.frameworks) Cocoa AGL GLUT;
};
fltk = self.fltk13;
flyway = callPackage ../development/tools/flyway { };
@ -9740,7 +9746,10 @@ with pkgs;
glfw = glfw3;
glfw2 = callPackage ../development/libraries/glfw/2.x.nix { };
glfw3 = callPackage ../development/libraries/glfw/3.x.nix { };
glfw3 = callPackage ../development/libraries/glfw/3.x.nix {
inherit (darwin) cf-private;
inherit (darwin.apple_sdk.frameworks) Cocoa Kernel;
};
glibc = callPackage ../development/libraries/glibc {
installLocales = config.glibc.locales or false;
@ -11179,7 +11188,10 @@ with pkgs;
libuecc = callPackage ../development/libraries/libuecc { };
libui = callPackage ../development/libraries/libui { };
libui = callPackage ../development/libraries/libui {
inherit (darwin) cf-private;
inherit (darwin.apple_sdk.frameworks) Cocoa;
};
libunistring = callPackage ../development/libraries/libunistring { };
@ -11629,6 +11641,8 @@ with pkgs;
opencv = callPackage ../development/libraries/opencv {
ffmpeg = ffmpeg_2;
inherit (darwin) cf-private;
inherit (darwin.apple_sdk.frameworks) Cocoa QTKit;
};
opencv3 = callPackage ../development/libraries/opencv/3.x.nix {
@ -16390,6 +16404,7 @@ with pkgs;
imagemagick = null;
acl = null;
gpm = null;
inherit (darwin) cf-private;
inherit (darwin.apple_sdk.frameworks) AppKit GSS ImageIO;
};
@ -16399,8 +16414,8 @@ with pkgs;
withGTK3 = false;
}));
emacsMacport = emacs25Macport;
emacs25Macport = callPackage ../applications/editors/emacs/macport.nix {
emacsMacport = callPackage ../applications/editors/emacs/macport.nix {
inherit (darwin) cf-private;
inherit (darwin.apple_sdk.frameworks)
AppKit Carbon Cocoa IOKit OSAKit Quartz QuartzCore WebKit
ImageCaptureCore GSS ImageIO;

View File

@ -66,7 +66,7 @@ in
stubs = callPackages ../os-specific/darwin/stubs { };
trash = callPackage ../os-specific/darwin/trash { inherit (darwin.apple_sdk) frameworks; };
trash = darwin.callPackage ../os-specific/darwin/trash { };
usr-include = callPackage ../os-specific/darwin/usr-include { };