tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
avidemux: refactor again to fix build failures
Nikolay Amiantov
9 years ago
76281d5d
0420a532
+108
-90
3 changed files
expand all
collapse all
unified
split
pkgs
applications
video
avidemux
default.nix
wrapper.nix
top-level
all-packages.nix
+93
-80
pkgs/applications/video/avidemux/default.nix
···
1
{ stdenv, lib, fetchurl, cmake, pkgconfig, lndir
2
-
, zlib, gettext, libvdpau, libva, libXv, sqlite, x265
3
-
, yasm, fribidi, gtk3, qt4
0
4
, withX264 ? true, x264
0
5
, withLAME ? true, lame
6
, withFAAC ? false, faac
7
, withVorbis ? true, libvorbis
···
11
, withVPX ? true, libvpx
12
}:
13
14
-
stdenv.mkDerivation rec {
15
-
name = "avidemux-${version}";
16
version = "2.6.12";
17
18
src = fetchurl {
···
20
sha256 = "0nz52yih8sff53inndkh2dba759xjzsh4b8xjww419lcpk0qp6kn";
21
};
22
23
-
nativeBuildInputs = [ cmake pkgconfig yasm lndir ];
24
-
buildInputs = [ zlib gettext libvdpau libva libXv sqlite x265 fribidi gtk3 qt4 ]
25
-
++ lib.optional withX264 x264
26
-
++ lib.optional withLAME lame
27
-
++ lib.optional withFAAC faac
28
-
++ lib.optional withVorbis libvorbis
29
-
++ lib.optional withPulse libpulseaudio
30
-
++ lib.optional withFAAD faad2
31
-
++ lib.optional withOpus libopus
32
-
++ lib.optional withVPX libvpx
33
-
;
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
34
35
-
enableParallelBuilding = false;
0
36
37
-
outputs = [ "out" "cli" "gtk" "qt4" ];
0
0
0
38
39
-
patches = [ ./dynamic_install_dir.patch ];
0
40
41
-
buildCommand = ''
42
-
unpackPhase
43
-
cd "$sourceRoot"
44
-
patchPhase
45
46
-
export cmakeFlags="$cmakeFlags -DAVIDEMUX_SOURCE_DIR=$(pwd)"
47
48
-
function buildOutput() {
49
-
( plugin_ui="$1"
50
-
output_dir="$2"
51
-
shift 2
52
-
export cmakeFlags="$cmakeFlags -DPLUGIN_UI=$plugin_ui -DCMAKE_INSTALL_PREFIX=$output_dir"
53
-
for i in "$@" avidemux_plugins; do
54
-
( cd "$i"
55
-
cmakeConfigurePhase
56
-
buildPhase
57
-
installPhase
58
-
)
59
-
done
60
-
rm -rf avidemux_plugins/build
61
-
)
62
-
}
63
64
-
function buildUi() {
65
-
plugin_ui="$1"
66
-
output_dir="$2"
67
-
shift 2
68
69
-
# Hack to split builds properly
70
-
mkdir -p $output_dir
71
-
lndir $out $output_dir
72
-
buildOutput $plugin_ui $output_dir "$@"
73
-
}
74
75
-
function fixupUi() {
76
-
output_dir="$1"
77
-
shift
78
79
-
find $output_dir -lname $out\* -delete
80
-
find $output_dir -type f | while read -r f; do
81
-
rpath="$(patchelf --print-rpath $f 2>/dev/null)" || continue
82
-
new_rpath=""
83
-
IFS=':' read -ra old_rpath <<< "$rpath"
84
-
for p in "''${old_rpath[@]}"; do
85
-
new_rpath="$new_rpath:$p"
86
-
if [[ $p = $output_dir* ]]; then
87
-
new_rpath="$new_rpath:$out/''${p#$output_dir}"
88
-
fi
89
-
done
90
-
patchelf --set-rpath "$new_rpath" $f
91
-
patchelf --shrink-rpath $f
92
done
93
-
}
94
95
-
buildOutput COMMON $out avidemux_core
96
-
buildOutput SETTINGS $out
97
-
buildUi CLI $cli avidemux/cli
98
-
buildUi GTK $gtk avidemux/gtk
99
-
buildUi QT4 $qt4 avidemux/qt4
100
101
-
fixupPhase
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
102
103
-
fixupUi $cli
104
-
fixupUi $gtk
105
-
fixupUi $qt4
106
-
'';
107
108
-
meta = {
109
-
homepage = http://fixounet.free.fr/avidemux/;
110
-
description = "Free video editor designed for simple video editing tasks";
111
-
maintainers = with stdenv.lib.maintainers; [ viric abbradar ];
112
-
platforms = with stdenv.lib.platforms; linux;
113
-
license = stdenv.lib.licenses.gpl2;
114
};
115
}
···
1
{ stdenv, lib, fetchurl, cmake, pkgconfig, lndir
2
+
, zlib, gettext, libvdpau, libva, libXv, sqlite
3
+
, yasm, freetype, fontconfig, fribidi, gtk3, qt4
4
+
, withX265 ? true, x265
5
, withX264 ? true, x264
6
+
, withXvid ? true, xvidcore
7
, withLAME ? true, lame
8
, withFAAC ? false, faac
9
, withVorbis ? true, libvorbis
···
13
, withVPX ? true, libvpx
14
}:
15
16
+
let
0
17
version = "2.6.12";
18
19
src = fetchurl {
···
21
sha256 = "0nz52yih8sff53inndkh2dba759xjzsh4b8xjww419lcpk0qp6kn";
22
};
23
24
+
common = {
25
+
inherit version src;
26
+
27
+
patches = [ ./dynamic_install_dir.patch ];
28
+
29
+
enableParallelBuilding = false;
30
+
31
+
nativeBuildInputs = [ cmake pkgconfig yasm ];
32
+
buildInputs = [ zlib gettext libvdpau libva libXv sqlite fribidi fontconfig freetype ]
33
+
++ lib.optional withX264 x264
34
+
++ lib.optional withX265 x265
35
+
++ lib.optional withXvid xvidcore
36
+
++ lib.optional withLAME lame
37
+
++ lib.optional withFAAC faac
38
+
++ lib.optional withVorbis libvorbis
39
+
++ lib.optional withPulse libpulseaudio
40
+
++ lib.optional withFAAD faad2
41
+
++ lib.optional withOpus libopus
42
+
++ lib.optional withVPX libvpx
43
+
;
44
+
45
+
meta = {
46
+
homepage = http://fixounet.free.fr/avidemux/;
47
+
description = "Free video editor designed for simple video editing tasks";
48
+
maintainers = with stdenv.lib.maintainers; [ viric abbradar ];
49
+
platforms = with stdenv.lib.platforms; linux;
50
+
license = stdenv.lib.licenses.gpl2;
51
+
};
52
+
};
53
54
+
core = stdenv.mkDerivation (common // {
55
+
name = "avidemux-${version}";
56
57
+
preConfigure = ''
58
+
cd avidemux_core
59
+
'';
60
+
});
61
62
+
buildPlugin = args: stdenv.mkDerivation (common // {
63
+
name = "avidemux-${args.pluginName}-${version}";
64
65
+
buildInputs = (args.buildInputs or []) ++ common.buildInputs ++ [ lndir ];
0
0
0
66
67
+
cmakeFlags = [ "-DPLUGIN_UI=${args.pluginUi}" ];
68
69
+
passthru.isUi = args.isUi or false;
0
0
0
0
0
0
0
0
0
0
0
0
0
0
70
71
+
buildCommand = ''
72
+
unpackPhase
73
+
cd "$sourceRoot"
74
+
patchPhase
75
76
+
mkdir $out
77
+
lndir ${core} $out
0
0
0
78
79
+
export cmakeFlags="$cmakeFlags -DAVIDEMUX_SOURCE_DIR=$(pwd)"
0
0
80
81
+
for i in ${toString (args.buildDirs or [])} avidemux_plugins; do
82
+
( cd "$i"
83
+
cmakeConfigurePhase
84
+
buildPhase
85
+
installPhase
86
+
)
0
0
0
0
0
0
0
87
done
0
88
89
+
fixupPhase
90
+
'';
91
+
});
0
0
92
93
+
in {
94
+
avidemux_core = core;
95
+
96
+
avidemux_cli = buildPlugin {
97
+
pluginName = "cli";
98
+
pluginUi = "CLI";
99
+
isUi = true;
100
+
buildDirs = [ "avidemux/cli" ];
101
+
};
102
+
103
+
avidemux_qt4 = buildPlugin {
104
+
pluginName = "qt4";
105
+
buildInputs = [ qt4 ];
106
+
pluginUi = "QT4";
107
+
isUi = true;
108
+
buildDirs = [ "avidemux/qt4" ];
109
+
};
110
+
111
+
avidemux_gtk = buildPlugin {
112
+
pluginName = "gtk";
113
+
buildInputs = [ gtk3 ];
114
+
pluginUi = "GTK";
115
+
isUi = true;
116
+
buildDirs = [ "avidemux/gtk" ];
117
+
};
118
119
+
avidemux_common = buildPlugin {
120
+
pluginName = "common";
121
+
pluginUi = "COMMON";
122
+
};
123
124
+
avidemux_settings = buildPlugin {
125
+
pluginName = "settings";
126
+
pluginUi = "SETTINGS";
0
0
0
127
};
128
}
+11
-6
pkgs/applications/video/avidemux/wrapper.nix
···
1
-
{ buildEnv, avidemux, makeWrapper
2
# GTK version is broken upstream, see https://bugzilla.redhat.com/show_bug.cgi?id=1244340
3
, withUi ? "qt4"
4
}:
5
6
-
let
7
-
ui = builtins.getAttr withUi avidemux;
0
0
0
0
8
9
-
in buildEnv {
10
-
name = "avidemux-${withUi}-" + avidemux.version;
11
12
-
paths = [ avidemux ui ];
13
14
buildInputs = [ makeWrapper ];
15
···
26
wrapProgram $i --set ADM_ROOT_DIR $out
27
done
28
'';
0
0
29
}
···
1
+
{ buildEnv, avidemux_unwrapped, makeWrapper
2
# GTK version is broken upstream, see https://bugzilla.redhat.com/show_bug.cgi?id=1244340
3
, withUi ? "qt4"
4
}:
5
6
+
let ui = builtins.getAttr "avidemux_${withUi}" avidemux_unwrapped; in
7
+
8
+
assert ui.isUi;
9
+
10
+
buildEnv {
11
+
name = "avidemux-${withUi}-" + ui.version;
12
13
+
paths = [ ui avidemux_unwrapped.avidemux_common avidemux_unwrapped.avidemux_settings ];
0
14
15
+
ignoreCollisions = true;
16
17
buildInputs = [ makeWrapper ];
18
···
29
wrapProgram $i --set ADM_ROOT_DIR $out
30
done
31
'';
32
+
33
+
meta = ui.meta;
34
}
+4
-4
pkgs/top-level/all-packages.nix
···
11628
11629
autopanosiftc = callPackage ../applications/graphics/autopanosiftc { };
11630
11631
-
avidemux_unwrapped = callPackage ../applications/video/avidemux { };
11632
-
11633
-
avidemux = callPackage ../applications/video/avidemux/wrapper.nix {
11634
-
avidemux = avidemux_unwrapped;
11635
};
0
0
11636
11637
avogadro = callPackage ../applications/science/chemistry/avogadro {
11638
eigen = eigen2;
···
11628
11629
autopanosiftc = callPackage ../applications/graphics/autopanosiftc { };
11630
11631
+
avidemux_unwrapped = callPackage ../applications/video/avidemux {
11632
+
libva = libva-full; # also wants libva-x11
0
0
11633
};
11634
+
11635
+
avidemux = callPackage ../applications/video/avidemux/wrapper.nix { };
11636
11637
avogadro = callPackage ../applications/science/chemistry/avogadro {
11638
eigen = eigen2;