1{ lib
2, stdenv
3, fetchurl
4, meson
5, ninja
6, file
7, docbook_xsl
8, gtk-doc ? null
9, buildDevDoc ? gtk-doc != null
10
11# for passthru.tests
12, gnuradio
13, gst_all_1
14, qt6
15, vips
16
17}: let
18 inherit (lib) optional optionals;
19in stdenv.mkDerivation rec {
20 pname = "orc";
21 version = "0.4.34";
22
23 src = fetchurl {
24 url = "https://gstreamer.freedesktop.org/src/orc/${pname}-${version}.tar.xz";
25 sha256 = "sha256-j0ers/CXFx5E64B63Nq9hg+6Lv/TfY08T71fNByt1B8=";
26 };
27
28 postPatch = lib.optionalString stdenv.isAarch32 ''
29 # https://gitlab.freedesktop.org/gstreamer/orc/-/issues/20
30 sed -i '/exec_opcodes_sys/d' testsuite/meson.build
31 '' + lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) ''
32 # This benchmark times out on Hydra.nixos.org
33 sed -i '/memcpy_speed/d' testsuite/meson.build
34 '';
35
36 outputs = [ "out" "dev" ]
37 ++ optional buildDevDoc "devdoc"
38 ;
39 outputBin = "dev"; # compilation tools
40
41 mesonFlags =
42 optionals (!buildDevDoc) [ "-Dgtk_doc=disabled" ]
43 ;
44
45 nativeBuildInputs = [ meson ninja ]
46 ++ optionals buildDevDoc [ gtk-doc file docbook_xsl ]
47 ;
48
49 # https://gitlab.freedesktop.org/gstreamer/orc/-/issues/41
50 doCheck = !(stdenv.isLinux && stdenv.isAarch64 && stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12");
51
52 passthru.tests = {
53 inherit (gst_all_1) gst-plugins-good gst-plugins-bad gst-plugins-ugly;
54 inherit gnuradio vips;
55 qt6-qtmultimedia = qt6.qtmultimedia;
56 };
57
58 meta = with lib; {
59 description = "The Oil Runtime Compiler";
60 homepage = "https://gstreamer.freedesktop.org/projects/orc.html";
61 changelog = "https://cgit.freedesktop.org/gstreamer/orc/plain/RELEASE?h=${version}";
62 # The source code implementing the Marsenne Twister algorithm is licensed
63 # under the 3-clause BSD license. The rest is 2-clause BSD license.
64 license = with licenses; [ bsd3 bsd2 ];
65 platforms = platforms.unix;
66 maintainers = [ ];
67 };
68}