From 2c800ed685c7cd23f2415a776fef6e91a440537a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= Date: Wed, 1 May 2019 18:44:08 +0200 Subject: [PATCH] gst_all_1: Fix evaluation on Darwin, fix gstreamer builds. Commit be382109ad01d0aa8660f2b19a20e345c86d246b broke evaluation on Darwin because it added these unconditional buildInputs that don't evaluate on Darwin: libnice librdf lilv lv2 serd sord sratom This commit fixes it, and also fixes recently-added new dependencies for other packages accordingly. It further fixes the build of many gstreamer packages on Darwin. --- .../libraries/gstreamer/bad/default.nix | 84 +++++++++++++++---- .../libraries/gstreamer/base/default.nix | 42 +++++++++- .../libraries/gstreamer/good/default.nix | 9 +- 3 files changed, 113 insertions(+), 22 deletions(-) diff --git a/pkgs/development/libraries/gstreamer/bad/default.nix b/pkgs/development/libraries/gstreamer/bad/default.nix index 5039d962cc5..de8556ccc96 100644 --- a/pkgs/development/libraries/gstreamer/bad/default.nix +++ b/pkgs/development/libraries/gstreamer/bad/default.nix @@ -34,6 +34,7 @@ , bluez , chromaprint , curl +, darwin , directfb , fdk_aac , flite @@ -115,38 +116,24 @@ in stdenv.mkDerivation rec { libass libkate libmms - libnice webrtc-audio-processing # webrtc libbs2b - ladspaH - librdf # ladspa plug-in - lilv - lv2 - serd - sord - sratom # lv2 plug-in libmodplug mpeg2dec openjpeg libopus librsvg - bluez - chromaprint curl.dev - directfb fdk_aac - flite gsm libaom libdc1394 libde265 - libdrm libdvdnav libdvdread - libgudev - libofa libsndfile libusb1 + mjpegtools neon openal opencv4 @@ -154,9 +141,7 @@ in stdenv.mkDerivation rec { openh264 rtmpdump pango - sbc soundtouch - spandsp srtp fluidsynth libvdpau @@ -175,6 +160,7 @@ in stdenv.mkDerivation rec { ] ++ optionals faacSupport [ faac ] ++ optionals stdenv.isLinux [ + bluez wayland ] ++ optionals (!stdenv.isDarwin) [ # wildmidi requires apple's OpenAL @@ -182,7 +168,40 @@ in stdenv.mkDerivation rec { wildmidi # TODO: mjpegtools uint64_t is not compatible with guint64 on Darwin mjpegtools - ]; + + chromaprint + directfb + flite + libdrm + libgudev + libnice + libofa + librdf + sbc + spandsp + + # ladspa plug-in + ladspaH + librdf # TODO: make build on Darwin + + # lv2 plug-in + lilv + lv2 + serd + sord + sratom + ] ++ optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ + # For unknown reasons the order is important, e.g. if + # VideoToolbox is last, we get: + # fatal error: 'VideoToolbox/VideoToolbox.h' file not found + VideoToolbox + AudioToolbox + AVFoundation + CoreMedia + CoreVideo + Foundation + MediaToolbox + ]); mesonFlags = [ "-Dexamples=disabled" # requires many dependencies and probably not useful for our users @@ -220,8 +239,37 @@ in stdenv.mkDerivation rec { # see https://github.com/NixOS/nixpkgs/issues/54395 "-Dnvdec=disabled" "-Dnvenc=disabled" + ] + ++ optionals stdenv.isDarwin [ + "-Dbluez=disabled" + "-Dchromaprint=disabled" + "-Ddirectfb=disabled" + "-Dflite=disabled" + "-Dkms=disabled" # renders to libdrm output + "-Dofa=disabled" + "-Dlv2=disabled" + "-Dsbc=disabled" + "-Dspandsp=disabled" + "-Ddvb=disabled" + "-Dfbdev=disabled" + "-Duvch264=disabled" # requires gudev + "-Dladspa=disabled" # requires lrdf + "-Dwebrtc=disabled" # requires libnice, which as of writing doesn't work on Darwin in nixpkgs + "-Dwildmidi=disabled" # see dependencies above + ] ++ optionals (!gst-plugins-base.glEnabled) [ + "-Dgl=disabled"] + ++ optionals (!gst-plugins-base.waylandEnabled) [ + "-Dwayland=disabled" + ] ++ optionals (!gst-plugins-base.glEnabled) [ + # `applemedia/videotexturecache.h` requires `gst/gl/gl.h`, + # but its meson build system does not declare the dependency. + "-Dapplemedia=disabled" ]; + # This package has some `_("string literal")` string formats + # that trip up clang with format security enabled. + hardeningDisable = [ "format" ]; + doCheck = false; # fails 20 out of 58 tests, expensive meta = with stdenv.lib; { diff --git a/pkgs/development/libraries/gstreamer/base/default.nix b/pkgs/development/libraries/gstreamer/base/default.nix index d7d4439d30c..d38199cf787 100644 --- a/pkgs/development/libraries/gstreamer/base/default.nix +++ b/pkgs/development/libraries/gstreamer/base/default.nix @@ -15,6 +15,7 @@ , libopus , isocodes , libjpeg +, libpng , libvisual , tremor # provides 'virbisidec' , libGL @@ -27,8 +28,12 @@ , wayland , enableAlsa ? stdenv.isLinux , alsaLib +# Enabling Cocoa seems to currently not work, giving compile +# errors. Suspected is that a newer version than clang +# is needed than 5.0 but it is not clear. , enableCocoa ? false , darwin +, enableGl ? (enableX11 || enableWayland || enableCocoa) , enableCdparanoia ? (!stdenv.isDarwin) , cdparanoia }: @@ -68,11 +73,16 @@ stdenv.mkDerivation rec { libintl libopus isocodes + libpng libjpeg tremor libGL - ] ++ lib.optional (!stdenv.isDarwin) libvisual - ++ lib.optional enableAlsa alsaLib + ] ++ lib.optional (!stdenv.isDarwin) [ + libvisual + ] ++ lib.optionals stdenv.isDarwin [ + pango + darwin.apple_sdk.frameworks.OpenGL + ] ++ lib.optional enableAlsa alsaLib ++ lib.optionals enableX11 [ libXv pango ] ++ lib.optional enableWayland wayland ++ lib.optional enableCocoa darwin.apple_sdk.frameworks.Cocoa @@ -85,6 +95,7 @@ stdenv.mkDerivation rec { mesonFlags = [ "-Dexamples=disabled" # requires many dependencies and probably not useful for our users "-Dgl-graphene=disabled" # not packaged in nixpkgs as of writing + "-Dgl_platform=[${lib.optionalString (enableX11 || enableWayland || enableCocoa) "auto"}]" # See https://github.com/GStreamer/gst-plugins-base/blob/d64a4b7a69c3462851ff4dcfa97cc6f94cd64aef/meson_options.txt#L15 for a list of choices "-Dgl_winsys=[${lib.concatStringsSep "," (lib.optional enableX11 "x11" ++ lib.optional enableWayland "wayland" ++ lib.optional enableCocoa "cocoa")}]" # We must currently disable gtk_doc API docs generation, @@ -98,15 +109,40 @@ stdenv.mkDerivation rec { ] ++ lib.optional (!enableX11) "-Dx11=disabled" # TODO How to disable Wayland? + ++ lib.optional (!enableGl) "-Dgl=disabled" ++ lib.optional (!enableAlsa) "-Dalsa=disabled" - ++ lib.optional (!enableCdparanoia) "-Dcdparanoia=disabled"; + ++ lib.optional (!enableCdparanoia) "-Dcdparanoia=disabled" + ++ lib.optionals stdenv.isDarwin [ + "-Dlibvisual=disabled" + ]; postPatch = '' patchShebangs common/scangobj-merge.py ''; + # This package has some `_("string literal")` string formats + # that trip up clang with format security enabled. + hardeningDisable = [ "format" ]; + doCheck = false; # fails, wants DRI access for OpenGL + passthru = { + # Downstream `gst-*` packages depending on `gst-plugins-base` + # have meson build options like 'gl' etc. that depend + # on these features being built in `-base`. + # If they are not built here, then the downstream builds + # will fail, as they, too, use `-Dauto_features=enabled` + # which would enable these options unconditionally. + # That means we must communicate to these downstream packages + # if the `-base` enabled these options or not, so that + # the can enable/disable those features accordingly. + # The naming `*Enabled` vs `enable*` is intentional to + # distinguish inputs from outputs (what is to be built + # vs what was built) and to make them easier to search for. + glEnabled = enableGl; + waylandEnabled = enableWayland; + }; + meta = with lib; { description = "Base GStreamer plug-ins and helper libraries"; homepage = "https://gstreamer.freedesktop.org"; diff --git a/pkgs/development/libraries/gstreamer/good/default.nix b/pkgs/development/libraries/gstreamer/good/default.nix index ff853584d46..1c7107e50fa 100644 --- a/pkgs/development/libraries/gstreamer/good/default.nix +++ b/pkgs/development/libraries/gstreamer/good/default.nix @@ -116,7 +116,14 @@ stdenv.mkDerivation rec { ] ++ optionals (!stdenv.isLinux || !enableJack) [ "-Djack=disabled" # unclear whether Jack works on Darwin ] ++ optionals (!stdenv.isLinux) [ - "-Dv4l2-gudev=disabled" + "-Ddv1394=disabled" # Linux only + "-Doss4=disabled" # Linux only + "-Doss=disabled" # Linux only + "-Dpulse=disabled" # TODO check if we can keep this enabled + "-Dv4l2-gudev=disabled" # Linux-only + "-Dv4l2=disabled" # Linux-only + "-Dximagesrc=disabled" # Linux-only + "-Dpulse=disabled" # TODO check if we can keep this enabled ];