From 970d80b0ff5390e97ce72f0ff576cd088e57d9b0 Mon Sep 17 00:00:00 2001 From: Anthony Cowley Date: Fri, 11 Mar 2016 15:10:10 -0500 Subject: [PATCH 1/3] cf-private: fix CFLAGS surgery The previous version could produce unparseable flags. --- pkgs/os-specific/darwin/cf-private/setup-hook.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/os-specific/darwin/cf-private/setup-hook.sh b/pkgs/os-specific/darwin/cf-private/setup-hook.sh index 7594c07977b..ae9ed5d1584 100644 --- a/pkgs/os-specific/darwin/cf-private/setup-hook.sh +++ b/pkgs/os-specific/darwin/cf-private/setup-hook.sh @@ -1,5 +1,5 @@ prependSearchPath() { - NIX_CFLAGS_COMPILE="-F@out@/Library/Frameworks ${NIX_CFLAGS_COMPILE/"-F@out@/Library/Frameworks"/}" + NIX_CFLAGS_COMPILE="-F@out@/Library/Frameworks ${NIX_CFLAGS_COMPILE}" } linkWithRealCF() { From ca1d46f98a71d3b21de0b9a30f759a7af2514f61 Mon Sep 17 00:00:00 2001 From: Anthony Cowley Date: Fri, 11 Mar 2016 15:11:02 -0500 Subject: [PATCH 2/3] ApplicationServices: add CoreGraphics child The AVFoundation framework uses a relative path that presumes that CoreGraphics is a child framework of ApplicationServices. It is not in the 10.9 SDK. This patch makes it one by tweaking the framework derivation generator with special support to address this problem. --- pkgs/os-specific/darwin/apple-sdk/default.nix | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/darwin/apple-sdk/default.nix b/pkgs/os-specific/darwin/apple-sdk/default.nix index c18d3f6cc6d..c1e09c20111 100644 --- a/pkgs/os-specific/darwin/apple-sdk/default.nix +++ b/pkgs/os-specific/darwin/apple-sdk/default.nix @@ -66,7 +66,18 @@ let mkdir -p "$dest" pushd "$dest" >/dev/null - cp -R "${sdk}/Library/Frameworks/$path/Versions/$current/Headers" . + # Keep track of if this is a child or a child rescue as with + # ApplicationServices in the 10.9 SDK + local isChild + + if [ -d "${sdk}/Library/Frameworks/$path/Versions/$current/Headers" ]; then + isChild=1 + cp -R "${sdk}/Library/Frameworks/$path/Versions/$current/Headers" . + else + isChild=0 + current="$(readlink "/System/Library/Frameworks/$name.framework/Versions/Current")" + cp -R "${sdk}/Library/Frameworks/$name.framework/Versions/$current/Headers" . + fi ln -s -L "/System/Library/Frameworks/$path/Versions/$current/$name" ln -s -L "/System/Library/Frameworks/$path/Versions/$current/Resources" @@ -74,8 +85,17 @@ let ln -s "/System/Library/Frameworks/$path/module.map" fi - pushd "${sdk}/Library/Frameworks/$path/Versions/$current" >/dev/null + if [ $isChild -eq 1 ]; then + pushd "${sdk}/Library/Frameworks/$path/Versions/$current" >/dev/null + else + pushd "${sdk}/Library/Frameworks/$name.framework/Versions/$current" >/dev/null + fi local children=$(echo Frameworks/*.framework) + if [ "$name" == "ApplicationServices" ]; then + # Fixing up ApplicationServices which is missing + # CoreGraphics in the 10.9 SDK + children="$children Frameworks/CoreGraphics.framework" + fi popd >/dev/null for child in $children; do From 184a3957e6a476e6f81abee552856861118ce85b Mon Sep 17 00:00:00 2001 From: Anthony Cowley Date: Fri, 11 Mar 2016 15:12:55 -0500 Subject: [PATCH 3/3] ffmpeg-full: avfoundation indev support on darwin Adds support for camera input devices on OS X. This required fixing links in output libraries and executables to pull in the system's CoreFoundation.framework rather than the open source CF one. --- .../libraries/ffmpeg-full/default.nix | 22 +++++++++++++++---- pkgs/top-level/all-packages.nix | 4 +++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/pkgs/development/libraries/ffmpeg-full/default.nix b/pkgs/development/libraries/ffmpeg-full/default.nix index 91974a31175..0f6ffe51d85 100644 --- a/pkgs/development/libraries/ffmpeg-full/default.nix +++ b/pkgs/development/libraries/ffmpeg-full/default.nix @@ -141,7 +141,7 @@ /* * Darwin frameworks */ -, Cocoa, CoreServices +, Cocoa, CoreServices, AVFoundation, MediaToolbox, VideoDecodeAcceleration, CF }: /* Maintainer notes: @@ -177,7 +177,7 @@ let inherit (stdenv) isCygwin isFreeBSD isLinux; - inherit (stdenv.lib) optional optionals enableFeature; + inherit (stdenv.lib) optional optionals optionalString enableFeature; in /* @@ -410,11 +410,25 @@ stdenv.mkDerivation rec { ++ optionals nonfreeLicensing [ faac fdk_aac openssl ] ++ optional ((isLinux || isFreeBSD) && libva != null) libva ++ optionals isLinux [ alsaLib libraw1394 libv4l ] - ++ optionals stdenv.isDarwin [ Cocoa CoreServices ]; + ++ optionals stdenv.isDarwin [ Cocoa CoreServices AVFoundation MediaToolbox + VideoDecodeAcceleration ]; # Build qt-faststart executable buildPhase = optional qtFaststartProgram ''make tools/qt-faststart''; - postInstall = optional qtFaststartProgram ''cp -a tools/qt-faststart $out/bin/''; + + # Hacky framework patching technique borrowed from the phantomjs2 package + postInstall = optionalString qtFaststartProgram '' + cp -a tools/qt-faststart $out/bin/ + '' + optionalString stdenv.isDarwin '' + FILES=($(ls $out/bin/*)) + FILES+=($(ls $out/lib/*.dylib)) + for f in ''${FILES[@]}; do + if [ ! -h "$f" ]; then + install_name_tool -change ${CF}/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation "$f" + fi + done + ''; + enableParallelBuilding = true; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9e44ac3e0bb..5cf8a5b7448 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6705,7 +6705,9 @@ in vid-stab = if stdenv.isDarwin then null else vid-stab; x265 = if stdenv.isDarwin then null else x265; xavs = if stdenv.isDarwin then null else xavs; - inherit (darwin.apple_sdk.frameworks) Cocoa CoreServices; + inherit (darwin) CF; + inherit (darwin.apple_sdk.frameworks) Cocoa CoreServices AVFoundation + MediaToolbox VideoDecodeAcceleration; }; ffmpegthumbnailer = callPackage ../development/libraries/ffmpegthumbnailer { };