git.iko.soy/typeable/nixpkgs
on master help sign in
handbrake: 1.3.3 -> 1.4.2 (#143654)

* handbrake: 1.3.3 -> 1.4.2 * handbrake: minor test cleanups

commitc207be6591e45e844f193f147c1f3447af054eba authorPeter Hoeg <peter@hoeg.com> dateSun 7 Nov 2021, 09:03 (5 years ago) parent5d043aa
2 files changed+162−84
nixos/tests/handbrake.nix+9−7 pkgs/applications/video/handbrake/default.nix+153−77
nixos/tests/handbrake.nix+9−7
@@ -1,11 +1,15 @@
11import ./make-test-python.nix ({ pkgs, ... }:
2+
23let
34 # Download Big Buck Bunny example, licensed under CC Attribution 3.0.
45 testMkv = pkgs.fetchurl {
56 url = "https://github.com/Matroska-Org/matroska-test-files/blob/cf0792be144ac470c4b8052cfe19bb691993e3a2/test_files/test1.mkv?raw=true";
67 sha256 = "1hfxbbgxwfkzv85pvpvx55a72qsd0hxjbm9hkl5r3590zw4s75h9";
8+ name = "test1.mkv";
79 };
8−in {
10+
11+in
12+{
913 name = "handbrake";
1014
1115 meta = {
@@ -21,11 +25,9 @@ in {
2125 # only takes a few seconds.
2226 start_all()
2327
24− machine.succeed(
25− "HandBrakeCLI -i ${testMkv} -o test.mp4 -e x264 -q 20 -B 160"
26− )
27− machine.succeed(
28− "HandBrakeCLI -i ${testMkv} -o test.mkv -e x264 -q 20 -B 160"
29− )
28+ machine.succeed("HandBrakeCLI -i ${testMkv} -o test.mp4 -e x264 -q 20 -B 160")
29+ machine.succeed("test -e test.mp4")
30+ machine.succeed("HandBrakeCLI -i ${testMkv} -o test.mkv -e x264 -q 20 -B 160")
31+ machine.succeed("test -e test.mkv")
3032 '';
3133})
pkgs/applications/video/handbrake/default.nix+153−77
@@ -7,85 +7,120 @@
77# be nice to add the native GUI (and/or the GTK GUI) as an option too, but that
88# requires invoking the Xcode build system, which is non-trivial for now.
99
10−{ stdenv, lib, fetchFromGitHub, fetchpatch,
10+{ stdenv
11+, lib
12+, fetchFromGitHub
13+, nixosTests
1114 # Main build tools
12− pkg-config, autoconf, automake, libtool, m4, xz, python3,
13− numactl,
15+, pkg-config
16+, autoconf
17+, automake
18+, libtool
19+, m4
20+, xz
21+, python3
22+, numactl
23+, writeText
1424 # Processing, video codecs, containers
15− ffmpeg-full, nv-codec-headers, libogg, x264, x265, libvpx, libtheora, dav1d,
25+, ffmpeg-full
26+, nv-codec-headers
27+, libogg
28+, x264
29+, x265
30+, libvpx
31+, libtheora
32+, dav1d
33+, zimg
1634 # Codecs, audio
17− libopus, lame, libvorbis, a52dec, speex, libsamplerate,
35+, libopus
36+, lame
37+, libvorbis
38+, a52dec
39+, speex
40+, libsamplerate
1841 # Text processing
19− libiconv, fribidi, fontconfig, freetype, libass, jansson, libxml2, harfbuzz,
42+, libiconv
43+, fribidi
44+, fontconfig
45+, freetype
46+, libass
47+, jansson
48+, libxml2
49+, harfbuzz
50+, libjpeg_turbo
2051 # Optical media
21− libdvdread, libdvdnav, libdvdcss, libbluray,
52+, libdvdread
53+, libdvdnav
54+, libdvdcss
55+, libbluray
2256 # Darwin-specific
23− AudioToolbox ? null,
24− Foundation ? null,
25− libobjc ? null,
26− VideoToolbox ? null,
57+, AudioToolbox ? null
58+, Foundation ? null
59+, libobjc ? null
60+, VideoToolbox ? null
2761 # GTK
2862 # NOTE: 2019-07-19: The gtk3 package has a transitive dependency on dbus,
2963 # which in turn depends on systemd. systemd is not supported on Darwin, so
3064 # for now we disable GTK GUI support on Darwin. (It may be possible to remove
3165 # this restriction later.)
32− useGtk ? !stdenv.isDarwin, wrapGAppsHook ? null,
33− intltool ? null,
34− glib ? null,
35− gtk3 ? null,
36− libappindicator-gtk3 ? null,
37− libnotify ? null,
38− gst_all_1 ? null,
39− dbus-glib ? null,
40− udev ? null,
41− libgudev ? null,
42− hicolor-icon-theme ? null,
66+, useGtk ? !stdenv.isDarwin
67+, wrapGAppsHook
68+, intltool
69+, glib
70+, gtk3
71+, libappindicator-gtk3
72+, libnotify
73+, gst_all_1
74+, dbus-glib
75+, udev
76+, libgudev
77+, hicolor-icon-theme
4378 # FDK
44− useFdk ? false, fdk_aac ? null
79+, useFdk ? false
80+, fdk_aac
4581}:
4682
47−stdenv.mkDerivation rec {
48− pname = "handbrake";
49− version = "1.3.3";
83+let
84+ version = "1.4.2";
5085
5186 src = fetchFromGitHub {
5287 owner = "HandBrake";
5388 repo = "HandBrake";
5489 rev = version;
55− sha256 = "0bsmk37543zv3p32a7wxnh2w483am23ha2amj339q3nnb4142krn";
56− extraPostFetch = ''
57− echo "DATE=$(date +"%F %T %z" -r $out/NEWS.markdown)" > $out/version.txt
58− '';
90+ sha256 = "sha256-Usz2+U1Wb8yJ5W2HqV0FqBaaE25fuVKk/NwKBHaKzwk=";
5991 };
6092
61− # Remove with a release after 1.3.3
62− patches = [
63− (fetchpatch {
64− name = "audio-fix-ffmpeg-4_4";
65− url = "https://github.com/HandBrake/HandBrake/commit/f28289fb06ab461ea082b4be56d6d1504c0c31c2.patch";
66− sha256 = "sha256:1zcwa4h97d8wjspb8kbd8b1jg0a9vvmv9zaphzry4m9q0bj3h3kz";
67− })
68− ];
69−
70− # we put as little as possible in src.extraPostFetch as it's much easier to
71− # add to it here without having to fiddle with src.sha256
72− # only DATE and HASH are absolutely necessary
93+ versionFile = writeText "version.txt" ''
94+ BRANCH=${versions.majorMinor version}.x
95+ DATE=1970-01-01 00:00:01 +0000
96+ HASH=${src.rev}
97+ REV=${src.rev}
98+ SHORTHASH=${src.rev}
99+ TAG=${version}
100+ URL=${src.meta.homepage}
101+ '';
102+
103+ inherit (lib) optional optionals optionalString versions;
104+
105+in
106+stdenv.mkDerivation rec {
107+ pname = "handbrake";
108+ inherit version src;
109+
73110 postPatch = ''
74− cat >> version.txt <<_EOF
75−HASH=${src.rev}
76−SHORTHASH=${src.rev}
77−TAG=${version}
78−URL=${src.meta.homepage}
79−_EOF
111+ install -Dm444 ${versionFile} ${versionFile.name}
80112
81113 patchShebangs scripts
82114
115+ substituteInPlace libhb/hb.c \
116+ --replace 'return hb_version;' 'return "${version}";'
117+
83118 # Force using nixpkgs dependencies
84119 sed -i '/MODULES += contrib/d' make/include/main.defs
85120 sed -e 's/^[[:space:]]*\(meson\|ninja\|nasm\)[[:space:]]*= ToolProbe.*$//g' \
86121 -e '/ ## Additional library and tool checks/,/ ## MinGW specific library and tool checks/d' \
87122 -i make/configure.py
88− '' + (lib.optionalString stdenv.isDarwin ''
123+ '' + optionalString stdenv.isDarwin ''
89124 # Use the Nix-provided libxml2 instead of the patched version available on
90125 # the Handbrake website.
91126 substituteInPlace libhb/module.defs \
@@ -95,51 +130,92 @@ _EOF
95130 # which it isn't in the Nix context. (The actual build goes fine without
96131 # xcodebuild.)
97132 sed -e '/xcodebuild = ToolProbe/s/abort=.\+)/abort=False)/' -i make/configure.py
98− '') + (lib.optionalString stdenv.isLinux ''
133+ '' + optionalString stdenv.isLinux ''
99134 # Use the Nix-provided libxml2 instead of the system-provided one.
100135 substituteInPlace libhb/module.defs \
101136 --replace /usr/include/libxml2 ${libxml2.dev}/include/libxml2
102− '');
137+ '';
103138
104139 nativeBuildInputs = [
105− pkg-config autoconf automake libtool m4 python3
106− ] ++ lib.optionals useGtk [ intltool wrapGAppsHook ];
140+ autoconf
141+ automake
142+ libtool
143+ m4
144+ pkg-config
145+ python3
146+ ]
147+ ++ optionals useGtk [ intltool wrapGAppsHook ];
107148
108149 buildInputs = [
109− ffmpeg-full libogg libtheora x264 x265 libvpx dav1d
110− libopus lame libvorbis a52dec speex libsamplerate
111− libiconv fribidi fontconfig freetype libass jansson libxml2 harfbuzz
112− libdvdread libdvdnav libdvdcss libbluray xz
113− ] ++ lib.optional (!stdenv.isDarwin) numactl
114− ++ lib.optionals useGtk [
115− glib gtk3 libappindicator-gtk3 libnotify
116− gst_all_1.gstreamer gst_all_1.gst-plugins-base dbus-glib udev
117− libgudev hicolor-icon-theme
118− ] ++ lib.optional useFdk fdk_aac
119− ++ lib.optionals stdenv.isDarwin [ AudioToolbox Foundation libobjc VideoToolbox ]
150+ a52dec
151+ dav1d
152+ ffmpeg-full
153+ fontconfig
154+ freetype
155+ fribidi
156+ harfbuzz
157+ jansson
158+ lame
159+ libass
160+ libbluray
161+ libdvdcss
162+ libdvdnav
163+ libdvdread
164+ libiconv
165+ libjpeg_turbo
166+ libogg
167+ libopus
168+ libsamplerate
169+ libtheora
170+ libvorbis
171+ libvpx
172+ libxml2
173+ speex
174+ x264
175+ x265
176+ xz
177+ zimg
178+ ]
179+ ++ optional (!stdenv.isDarwin) numactl
180+ ++ optionals useGtk [
181+ dbus-glib
182+ glib
183+ gst_all_1.gst-plugins-base
184+ gst_all_1.gstreamer
185+ gtk3
186+ hicolor-icon-theme
187+ libappindicator-gtk3
188+ libgudev
189+ libnotify
190+ udev
191+ ]
192+ ++ optional useFdk fdk_aac
193+ ++ optionals stdenv.isDarwin [ AudioToolbox Foundation libobjc VideoToolbox ]
120194 # NOTE: 2018-12-27: Handbrake supports nv-codec-headers for Linux only,
121195 # look at ./make/configure.py search "enable_nvenc"
122− ++ lib.optional stdenv.isLinux nv-codec-headers;
196+ ++ optional stdenv.isLinux nv-codec-headers;
123197
124198 configureFlags = [
125199 "--disable-df-fetch"
126200 "--disable-df-verify"
127− (if useGtk then "--disable-gtk-update-checks" else "--disable-gtk")
128− (if useFdk then "--enable-fdk-aac" else "")
129− (if stdenv.isDarwin then "--disable-xcode" else "")
130− ] ++ lib.optional (stdenv.isx86_32 || stdenv.isx86_64) "--harden";
201+ "--disable-gtk-update-checks"
202+ ]
203+ ++ optional (!useGtk) "--disable-gtk"
204+ ++ optional useFdk "--enable-fdk-aac"
205+ ++ optional stdenv.isDarwin "--disable-xcode"
206+ ++ optional (stdenv.isx86_32 || stdenv.isx86_64) "--harden";
131207
132208 # NOTE: 2018-12-27: Check NixOS HandBrake test if changing
133− NIX_LDFLAGS = [
134− "-lx265"
135− ];
209+ NIX_LDFLAGS = [ "-lx265" ];
136210
137− preBuild = ''
138− cd build
139− '';
211+ makeFlags = [ "--directory=build" ];
212+
213+ passthru.tests = {
214+ basic-conversion = nixosTests.handbrake;
215+ };
140216
141217 meta = with lib; {
142− homepage = "http://handbrake.fr/";
218+ homepage = "https://handbrake.fr/";
143219 description = "A tool for converting video files and ripping DVDs";
144220 longDescription = ''
145221 Tool for converting and remuxing video files
@@ -149,7 +225,7 @@ _EOF
149225 CLI - `HandbrakeCLI`
150226 GTK GUI - `ghb`
151227 '';
152− license = licenses.gpl2;
228+ license = licenses.gpl2Only;
153229 maintainers = with maintainers; [ Anton-Latukha wmertens ];
154230 platforms = with platforms; unix;
155231 };