Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 164 lines 4.1 kB view raw
1{ 2 stdenv, 3 fetchurl, 4 meson, 5 ninja, 6 pkg-config, 7 gettext, 8 bison, 9 flex, 10 python3, 11 glib, 12 makeWrapper, 13 libcap, 14 elfutils, # for libdw 15 bash-completion, 16 lib, 17 testers, 18 rustc, 19 withRust ? 20 lib.any (lib.meta.platformMatch stdenv.hostPlatform) rustc.targetPlatforms 21 && lib.all (p: !lib.meta.platformMatch stdenv.hostPlatform p) rustc.badTargetPlatforms, 22 gobject-introspection, 23 buildPackages, 24 withIntrospection ? 25 lib.meta.availableOn stdenv.hostPlatform gobject-introspection 26 && stdenv.hostPlatform.emulatorAvailable buildPackages, 27 libunwind, 28 withLibunwind ? 29 lib.meta.availableOn stdenv.hostPlatform libunwind 30 && lib.elem "libunwind" libunwind.meta.pkgConfigModules or [ ], 31 # Checks meson.is_cross_build(), so even canExecute isn't enough. 32 enableDocumentation ? stdenv.hostPlatform == stdenv.buildPlatform, 33 hotdoc, 34 directoryListingUpdater, 35 apple-sdk_gstreamer, 36}: 37 38let 39 hasElfutils = lib.meta.availableOn stdenv.hostPlatform elfutils; 40in 41stdenv.mkDerivation (finalAttrs: { 42 pname = "gstreamer"; 43 version = "1.26.0"; 44 45 outputs = [ 46 "bin" 47 "out" 48 "dev" 49 ]; 50 51 separateDebugInfo = true; 52 53 src = fetchurl { 54 url = "https://gstreamer.freedesktop.org/src/gstreamer/gstreamer-${finalAttrs.version}.tar.xz"; 55 hash = "sha256-Gy7kAoAQwlt3bv+nw5bH4+GGG2C5QX5Bb0kUq83/J58="; 56 }; 57 58 depsBuildBuild = [ 59 pkg-config 60 ]; 61 62 strictDeps = true; 63 nativeBuildInputs = 64 [ 65 meson 66 ninja 67 pkg-config 68 gettext 69 bison 70 flex 71 python3 72 makeWrapper 73 glib 74 bash-completion 75 ] 76 ++ lib.optionals stdenv.hostPlatform.isLinux [ 77 libcap # for setcap binary 78 ] 79 ++ lib.optionals withIntrospection [ 80 gobject-introspection 81 ] 82 ++ lib.optionals withRust [ 83 rustc 84 ] 85 ++ lib.optionals enableDocumentation [ 86 hotdoc 87 ]; 88 89 buildInputs = 90 [ 91 bash-completion 92 ] 93 ++ lib.optionals stdenv.hostPlatform.isLinux [ 94 libcap 95 ] 96 ++ lib.optionals hasElfutils [ 97 elfutils 98 ] 99 ++ lib.optionals withLibunwind [ 100 libunwind 101 ] 102 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 103 apple-sdk_gstreamer 104 ]; 105 106 propagatedBuildInputs = [ 107 glib 108 ]; 109 110 mesonFlags = [ 111 "-Dglib_debug=disabled" # cast checks should be disabled on stable releases 112 "-Ddbghelp=disabled" # not needed as we already provide libunwind and libdw, and dbghelp is a fallback to those 113 "-Dexamples=disabled" # requires many dependencies and probably not useful for our users 114 (lib.mesonEnable "ptp-helper" withRust) 115 (lib.mesonEnable "introspection" withIntrospection) 116 (lib.mesonEnable "doc" enableDocumentation) 117 (lib.mesonEnable "libunwind" withLibunwind) 118 (lib.mesonEnable "libdw" (withLibunwind && hasElfutils)) 119 ]; 120 121 postPatch = '' 122 patchShebangs \ 123 gst/parse/get_flex_version.py \ 124 gst/parse/gen_grammar.py.in \ 125 gst/parse/gen_lex.py.in \ 126 libs/gst/helpers/ptp_helper_post_install.sh \ 127 scripts/extract-release-date-from-doap-file.py \ 128 docs/gst-plugins-doc-cache-generator.py 129 ''; 130 131 postInstall = '' 132 for prog in "$bin/bin/"*; do 133 # We can't use --suffix here due to quoting so we craft the export command by hand 134 wrapProgram "$prog" --run 'export GST_PLUGIN_SYSTEM_PATH_1_0=$GST_PLUGIN_SYSTEM_PATH_1_0''${GST_PLUGIN_SYSTEM_PATH_1_0:+:}$(unset _tmp; for profile in $NIX_PROFILES; do _tmp="$profile/lib/gstreamer-1.0''${_tmp:+:}$_tmp"; done; printf '%s' "$_tmp")' 135 done 136 ''; 137 138 preFixup = '' 139 moveToOutput "share/bash-completion" "$bin" 140 ''; 141 142 setupHook = ./setup-hook.sh; 143 144 passthru = { 145 tests = { 146 pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; 147 }; 148 updateScript = directoryListingUpdater { }; 149 }; 150 151 meta = with lib; { 152 description = "Open source multimedia framework"; 153 homepage = "https://gstreamer.freedesktop.org"; 154 license = licenses.lgpl2Plus; 155 pkgConfigModules = [ 156 "gstreamer-controller-1.0" 157 ]; 158 platforms = platforms.unix; 159 maintainers = with maintainers; [ 160 ttuegel 161 matthewbauer 162 ]; 163 }; 164})