diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/gstreamer/bad')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/gstreamer/bad/default.nix | 369 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/libraries/gstreamer/bad/fix-paths.patch | 48 |
2 files changed, 417 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/bad/default.nix b/nixpkgs/pkgs/development/libraries/gstreamer/bad/default.nix new file mode 100644 index 000000000000..bec1cb762ce4 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/gstreamer/bad/default.nix @@ -0,0 +1,369 @@ +{ lib +, stdenv +, fetchurl +, substituteAll +, meson +, ninja +, gettext +, pkg-config +, python3 +, gst-plugins-base +, orc +, gstreamer +, gobject-introspection +, enableZbar ? false +, faacSupport ? false +, faac +, opencvSupport ? false +, opencv4 +, faad2 +, ldacbt +, libass +, libkate +, lrdf +, ladspaH +, lcms2 +, libnice +, webrtc-audio-processing +, lilv +, lv2 +, serd +, sord +, sratom +, libbs2b +, libmodplug +, libmpeg2 +, libmicrodns +, openjpeg +, libopus +, librsvg +, bluez +, chromaprint +, curl +, fdk_aac +, flite +, gsm +, json-glib +, libaom +, libdc1394 +, libde265 +, libdrm +, libdvdnav +, libdvdread +, libgudev +, qrencode +, libsndfile +, libusb1 +, neon +, openal +, openexr_3 +, openh264 +, libopenmpt +, pango +, rtmpdump +, sbc +, soundtouch +, spandsp +, srtp +, zbar +, wayland-protocols +, wildmidi +, fluidsynth +, libva +, libvdpau +, wayland +, libwebp +, xvidcore +, gnutls +, mjpegtools +, libGLU +, libGL +, addOpenGLRunpath +, gtk3 +, libintl +, game-music-emu +, openssl +, x265 +, libxml2 +, srt +, vo-aacenc +, libfreeaptx +, zxing-cpp +, usrsctp +, VideoToolbox +, AudioToolbox +, AVFoundation +, Cocoa +, CoreMedia +, CoreVideo +, Foundation +, MediaToolbox +, enableGplPlugins ? true +, bluezSupport ? stdenv.isLinux +# Causes every application using GstDeviceMonitor to send mDNS queries every 2 seconds +, microdnsSupport ? false +# Checks meson.is_cross_build(), so even canExecute isn't enough. +, enableDocumentation ? stdenv.hostPlatform == stdenv.buildPlatform, hotdoc +, guiSupport ? true, directfb +}: + +stdenv.mkDerivation rec { + pname = "gst-plugins-bad"; + version = "1.22.9"; + + outputs = [ "out" "dev" ]; + + src = fetchurl { + url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz"; + hash = "sha256-G8ZdD9X1OjY2Vk79P88xjD7c3sOcQQmlA8H8ggOECh0="; + }; + + patches = [ + # Add fallback paths for nvidia userspace libraries + (substituteAll { + src = ./fix-paths.patch; + inherit (addOpenGLRunpath) driverLink; + }) + ]; + + nativeBuildInputs = [ + meson + ninja + pkg-config + orc # for orcc + python3 + gettext + gstreamer # for gst-tester-1.0 + gobject-introspection + ] ++ lib.optionals enableDocumentation [ + hotdoc + ] ++ lib.optionals stdenv.isLinux [ + wayland # for wayland-scanner + ]; + + buildInputs = [ + gst-plugins-base + orc + json-glib + lcms2 + ldacbt + libass + libkate + webrtc-audio-processing # required by webrtcdsp + #webrtc-audio-processing_1 # required by isac + libbs2b + libmodplug + openjpeg + libopenmpt + libopus + librsvg + curl.dev + fdk_aac + gsm + libaom + libdc1394 + libde265 + libdvdnav + libdvdread + libnice + qrencode + libsndfile + libusb1 + neon + openal + openexr_3 + openh264 + rtmpdump + pango + soundtouch + srtp + fluidsynth + libvdpau + libwebp + xvidcore + gnutls + game-music-emu + openssl + libxml2 + libintl + srt + vo-aacenc + libfreeaptx + zxing-cpp + usrsctp + wildmidi + ] ++ lib.optionals opencvSupport [ + opencv4 + ] ++ lib.optionals enableZbar [ + zbar + ] ++ lib.optionals faacSupport [ + faac + ] ++ lib.optionals enableGplPlugins [ + libmpeg2 + mjpegtools + faad2 + x265 + ] ++ lib.optionals bluezSupport [ + bluez + ] ++ lib.optionals microdnsSupport [ + libmicrodns + ] ++ lib.optionals stdenv.isLinux [ + libva # vaapi requires libva -> libdrm -> libpciaccess, which is Linux-only in nixpkgs + wayland + wayland-protocols + ] ++ lib.optionals (!stdenv.isDarwin) [ + # TODO: mjpegtools uint64_t is not compatible with guint64 on Darwin + mjpegtools + + chromaprint + flite + libdrm + libgudev + sbc + spandsp + + # ladspa plug-in + ladspaH + lrdf # TODO: make build on Darwin + + # lv2 plug-in + lilv + lv2 + serd + sord + sratom + + libGL + libGLU + ] ++ lib.optionals guiSupport [ + gtk3 + ] ++ lib.optionals (stdenv.isLinux && guiSupport) [ + directfb + ] ++ lib.optionals stdenv.isDarwin [ + # 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 + Cocoa + CoreMedia + CoreVideo + Foundation + MediaToolbox + ]; + + mesonFlags = [ + "-Dexamples=disabled" # requires many dependencies and probably not useful for our users + "-Dglib-asserts=disabled" # asserts should be disabled on stable releases + + "-Damfcodec=disabled" # Windows-only + "-Davtp=disabled" + "-Ddirectshow=disabled" # Windows-only + "-Ddts=disabled" # required `libdca` library not packaged in nixpkgs as of writing, and marked as "BIG FAT WARNING: libdca is still in early development" + "-Dzbar=${if enableZbar then "enabled" else "disabled"}" + "-Dfaac=${if faacSupport then "enabled" else "disabled"}" + "-Diqa=disabled" # required `dssim` library not packaging in nixpkgs as of writing, also this is AGPL so update license when adding support + "-Dmagicleap=disabled" # required `ml_audio` library not packaged in nixpkgs as of writing + "-Dmsdk=disabled" # not packaged in nixpkgs as of writing / no Windows support + # As of writing, with `libmpcdec` in `buildInputs` we get + # "Could not find libmpcdec header files, but Musepack was enabled via options" + # This is likely because nixpkgs has the header in libmpc/mpcdec.h + # instead of mpc/mpcdec.h, like Arch does. The situation is not trivial. + # There are apparently 2 things called `libmpcdec` from the same author: + # * http://svn.musepack.net/libmpcdec/trunk/src/ + # * http://svn.musepack.net/libmpc/trunk/include/mpc/ + # Fixing it likely requires to first figure out with upstream which one + # is needed, and then patching upstream to find it (though it probably + # already works on Arch?). + "-Dmusepack=disabled" + "-Dopenni2=disabled" # not packaged in nixpkgs as of writing + "-Dopensles=disabled" # not packaged in nixpkgs as of writing + "-Dsvthevcenc=disabled" # required `SvtHevcEnc` library not packaged in nixpkgs as of writing + "-Dteletext=disabled" # required `zvbi` library not packaged in nixpkgs as of writing + "-Dtinyalsa=disabled" # not packaged in nixpkgs as of writing + "-Dvoamrwbenc=disabled" # required `vo-amrwbenc` library not packaged in nixpkgs as of writing + "-Dvulkan=disabled" # Linux-only, and we haven't figured out yet which of the vulkan nixpkgs it needs + "-Dwasapi=disabled" # not packaged in nixpkgs as of writing / no Windows support + "-Dwasapi2=disabled" # not packaged in nixpkgs as of writing / no Windows support + "-Dwpe=disabled" # required `wpe-webkit` library not packaged in nixpkgs as of writing + "-Disac=disabled" # depends on `webrtc-audio-coding-1` not compatible with 0.3 + "-Dgs=disabled" # depends on `google-cloud-cpp` + "-Donnx=disabled" # depends on `libonnxruntime` not packaged in nixpkgs as of writing + "-Dopenaptx=enabled" # since gstreamer-1.20.1 `libfreeaptx` is supported for circumventing the dubious license conflict with `libopenaptx` + "-Dopencv=${if opencvSupport then "enabled" else "disabled"}" # Reduces rebuild size when `config.cudaSupport = true` + "-Dmicrodns=${if microdnsSupport then "enabled" else "disabled"}" + "-Dbluez=${if bluezSupport then "enabled" else "disabled"}" + (lib.mesonEnable "doc" enableDocumentation) + ] + ++ lib.optionals (!stdenv.isLinux) [ + "-Ddoc=disabled" # needs gstcuda to be enabled which is Linux-only + "-Dnvcodec=disabled" # Linux-only + "-Dva=disabled" # see comment on `libva` in `buildInputs` + ] ++ lib.optionals (!stdenv.isLinux || !guiSupport) [ + "-Ddirectfb=disabled" + ] + ++ lib.optionals stdenv.isDarwin [ + "-Dchromaprint=disabled" + "-Dflite=disabled" + "-Dkms=disabled" # renders to libdrm output + "-Dlv2=disabled" + "-Dsbc=disabled" + "-Dspandsp=disabled" + "-Ddvb=disabled" + "-Dfbdev=disabled" + "-Duvch264=disabled" # requires gudev + "-Dv4l2codecs=disabled" # requires gudev + "-Dladspa=disabled" # requires lrdf + ] ++ lib.optionals (!stdenv.isLinux || !stdenv.isx86_64) [ + "-Dqsv=disabled" # Linux (and Windows) x86 only + ] ++ lib.optionals (!gst-plugins-base.glEnabled) [ + "-Dgl=disabled" + ] ++ lib.optionals (!gst-plugins-base.waylandEnabled) [ + "-Dgtk3=disabled" # Wayland-based GTK sink + "-Dwayland=disabled" + ] ++ lib.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" + ] ++ (if enableGplPlugins then [ + "-Dgpl=enabled" + ] else [ + "-Ddts=disabled" + "-Dfaad=disabled" + "-Diqa=disabled" + "-Dmpeg2enc=disabled" + "-Dmplex=disabled" + "-Dresindvd=disabled" + "-Dx265=disabled" + ]); + + # Argument list too long + strictDeps = true; + + postPatch = '' + patchShebangs \ + scripts/extract-release-date-from-doap-file.py + ''; + + # 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 lib; { + description = "GStreamer Bad Plugins"; + mainProgram = "gst-transcoder-1.0"; + homepage = "https://gstreamer.freedesktop.org"; + longDescription = '' + a set of plug-ins that aren't up to par compared to the + rest. They might be close to being good quality, but they're missing + something - be it a good code review, some documentation, a set of tests, + a real live maintainer, or some actual wide use. + ''; + license = if enableGplPlugins then licenses.gpl2Plus else licenses.lgpl2Plus; + platforms = platforms.linux ++ platforms.darwin; + maintainers = with maintainers; [ matthewbauer lilyinstarlight ]; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/gstreamer/bad/fix-paths.patch b/nixpkgs/pkgs/development/libraries/gstreamer/bad/fix-paths.patch new file mode 100644 index 000000000000..ea832cc9f60b --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/gstreamer/bad/fix-paths.patch @@ -0,0 +1,48 @@ +diff --git a/gst-libs/gst/cuda/gstcudaloader.c b/gst-libs/gst/cuda/gstcudaloader.c +index fffcbefd2b..6f738d3af3 100644 +--- a/gst-libs/gst/cuda/gstcudaloader.c ++++ b/gst-libs/gst/cuda/gstcudaloader.c +@@ -165,6 +165,11 @@ gst_cuda_load_library (void) + return TRUE; + + module = g_module_open (filename, G_MODULE_BIND_LAZY); ++ ++ if (module == NULL) { ++ module = g_module_open ("@driverLink@/lib/" CUDA_LIBNAME, G_MODULE_BIND_LAZY); ++ } ++ + if (module == NULL) { + GST_WARNING ("Could not open library %s, %s", filename, g_module_error ()); + return FALSE; +diff --git a/sys/nvcodec/gstcuvidloader.c b/sys/nvcodec/gstcuvidloader.c +index e957e062e0..004ec2dcd5 100644 +--- a/sys/nvcodec/gstcuvidloader.c ++++ b/sys/nvcodec/gstcuvidloader.c +@@ -85,6 +85,11 @@ gst_cuvid_load_library (guint api_major_ver, guint api_minor_ver) + return TRUE; + + module = g_module_open (filename, G_MODULE_BIND_LAZY); ++ ++ if (module == NULL) { ++ module = g_module_open ("@driverLink@/lib/" NVCUVID_LIBNAME, G_MODULE_BIND_LAZY); ++ } ++ + if (module == NULL) { + GST_WARNING ("Could not open library %s, %s", filename, g_module_error ()); + return FALSE; +diff --git a/sys/nvcodec/gstnvenc.c b/sys/nvcodec/gstnvenc.c +index 106857a954..3bab9989f0 100644 +--- a/sys/nvcodec/gstnvenc.c ++++ b/sys/nvcodec/gstnvenc.c +@@ -907,6 +907,11 @@ gst_nvenc_load_library (guint * api_major_ver, guint * api_minor_ver) + }; + + module = g_module_open (NVENC_LIBRARY_NAME, G_MODULE_BIND_LAZY); ++ ++ if (module == NULL) { ++ module = g_module_open ("@driverLink@/lib/" NVENC_LIBRARY_NAME, G_MODULE_BIND_LAZY); ++ } ++ + if (module == NULL) { + GST_WARNING ("Could not open library %s, %s", + NVENC_LIBRARY_NAME, g_module_error ()); |