nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 pkg-config,
6 autoreconfHook,
7 makeWrapper,
8 runCommandCC,
9 runCommand,
10 vapoursynth,
11 buildEnv,
12 zimg,
13 libass,
14 python3,
15 testers,
16}:
17
18stdenv.mkDerivation rec {
19 pname = "vapoursynth";
20 version = "72";
21
22 src = fetchFromGitHub {
23 owner = "vapoursynth";
24 repo = "vapoursynth";
25 rev = "R${version}";
26 hash = "sha256-LRRz4471Rl/HwJ14zAkU/f2Acuofja8c0pGkuWihhsM=";
27 };
28
29 nativeBuildInputs = [
30 pkg-config
31 autoreconfHook
32 makeWrapper
33 ];
34 buildInputs = [
35 zimg
36 libass
37 (python3.withPackages (
38 ps: with ps; [
39 sphinx
40 cython
41 ]
42 ))
43 ];
44
45 enableParallelBuilding = true;
46 doInstallCheck = !stdenv.hostPlatform.isDarwin;
47
48 passthru = rec {
49 # If vapoursynth is added to the build inputs of mpv and then
50 # used in the wrapping of it, we want to know once inside the
51 # wrapper, what python3 version was used to build vapoursynth so
52 # the right python3.sitePackages will be used there.
53 inherit python3;
54
55 withPlugins = import ./plugin-interface.nix {
56 inherit
57 lib
58 python3
59 buildEnv
60 runCommandCC
61 stdenv
62 runCommand
63 vapoursynth
64 makeWrapper
65 withPlugins
66 ;
67 };
68
69 tests.version = testers.testVersion {
70 package = vapoursynth;
71 # Check Core version to prevent false positive with API version
72 version = "Core R${version}";
73 };
74 };
75
76 postPatch = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
77 # Export weak symbol nixPluginDir to permit override of default plugin path
78 sed -E -i \
79 -e 's/(VS_PATH_PLUGINDIR)/(nixPluginDir ? nixPluginDir : \1)/g' \
80 -e '1i\extern char const __attribute__((weak)) nixPluginDir[];' \
81 src/core/vscore.cpp
82 '';
83
84 postInstall = ''
85 wrapProgram $out/bin/vspipe \
86 --prefix PYTHONPATH : $out/${python3.sitePackages}
87
88 # VapourSynth does not include any plugins by default
89 # and emits a warning when the system plugin directory does not exist.
90 mkdir $out/lib/vapoursynth
91 '';
92
93 installCheckPhase = ''
94 runHook preInstallCheck
95
96 libv="$out/lib/libvapoursynth${stdenv.hostPlatform.extensions.sharedLibrary}"
97 if ! $NM -g -P "$libv" | grep -q '^nixPluginDir w'; then
98 echo "Weak symbol nixPluginDir is missing from $libv." >&2
99 exit 1
100 fi
101
102 runHook postInstallCheck
103 '';
104
105 meta = with lib; {
106 description = "Video processing framework with the future in mind";
107 homepage = "http://www.vapoursynth.com/";
108 license = licenses.lgpl21;
109 platforms = platforms.all;
110 maintainers = with maintainers; [
111 rnhmjoj
112 sbruder
113 snaki
114 ];
115 mainProgram = "vspipe";
116 };
117}