Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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 meson 65 ninja 66 pkg-config 67 gettext 68 bison 69 flex 70 python3 71 makeWrapper 72 glib 73 bash-completion 74 ] 75 ++ lib.optionals stdenv.hostPlatform.isLinux [ 76 libcap # for setcap binary 77 ] 78 ++ lib.optionals withIntrospection [ 79 gobject-introspection 80 ] 81 ++ lib.optionals withRust [ 82 rustc 83 ] 84 ++ lib.optionals enableDocumentation [ 85 hotdoc 86 ]; 87 88 buildInputs = [ 89 bash-completion 90 ] 91 ++ lib.optionals stdenv.hostPlatform.isLinux [ 92 libcap 93 ] 94 ++ lib.optionals hasElfutils [ 95 elfutils 96 ] 97 ++ lib.optionals withLibunwind [ 98 libunwind 99 ] 100 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 101 apple-sdk_gstreamer 102 ]; 103 104 propagatedBuildInputs = [ 105 glib 106 ]; 107 108 mesonFlags = [ 109 "-Dglib_debug=disabled" # cast checks should be disabled on stable releases 110 "-Ddbghelp=disabled" # not needed as we already provide libunwind and libdw, and dbghelp is a fallback to those 111 "-Dexamples=disabled" # requires many dependencies and probably not useful for our users 112 (lib.mesonEnable "ptp-helper" withRust) 113 (lib.mesonEnable "introspection" withIntrospection) 114 (lib.mesonEnable "doc" enableDocumentation) 115 (lib.mesonEnable "libunwind" withLibunwind) 116 (lib.mesonEnable "libdw" (withLibunwind && hasElfutils)) 117 ]; 118 119 postPatch = '' 120 patchShebangs \ 121 gst/parse/get_flex_version.py \ 122 gst/parse/gen_grammar.py.in \ 123 gst/parse/gen_lex.py.in \ 124 libs/gst/helpers/ptp_helper_post_install.sh \ 125 scripts/extract-release-date-from-doap-file.py \ 126 docs/gst-plugins-doc-cache-generator.py 127 ''; 128 129 postInstall = '' 130 for prog in "$bin/bin/"*; do 131 # We can't use --suffix here due to quoting so we craft the export command by hand 132 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")' 133 done 134 ''; 135 136 preFixup = '' 137 moveToOutput "share/bash-completion" "$bin" 138 ''; 139 140 setupHook = ./setup-hook.sh; 141 142 passthru = { 143 tests = { 144 pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; 145 }; 146 updateScript = directoryListingUpdater { }; 147 }; 148 149 meta = with lib; { 150 description = "Open source multimedia framework"; 151 homepage = "https://gstreamer.freedesktop.org"; 152 license = licenses.lgpl2Plus; 153 pkgConfigModules = [ 154 "gstreamer-controller-1.0" 155 ]; 156 platforms = platforms.unix; 157 maintainers = with maintainers; [ 158 ttuegel 159 matthewbauer 160 ]; 161 }; 162})