From ece4de10c01ce6cd3b5a7f6e9092ca8445280c05 Mon Sep 17 00:00:00 2001 From: madomado Date: Sun, 9 Jul 2023 01:40:39 +0800 Subject: [PATCH] add: handbrake (#521) * add: terra-HandBrake * ffmpeg? * random fixes * try free ffmpeg Signed-off-by: madomado * Update terra-HandBrake.spec Signed-off-by: madomado * fix build dep and changelog * Update terra-HandBrake.spec * Update terra-HandBrake.spec Signed-off-by: madomado * Update terra-HandBrake.spec * add builddeps vulkan-loader Signed-off-by: madomado * fix files Signed-off-by: madomado * fix(files): ~ Signed-off-by: madomado * fix(files): ~ Signed-off-by: madomado --------- Signed-off-by: madomado --- .../handbrake/HandBrake-no-fdk_aac.patch | 14 ++ anda/tools/handbrake/HandBrake-no-libva.patch | 13 + anda/tools/handbrake/HandBrake-no-nasm.patch | 12 + anda/tools/handbrake/HandBrake-nostrip.patch | 10 + .../tools/handbrake/HandBrake-x265-link.patch | 13 + anda/tools/handbrake/anda.hcl | 5 + ...29C061B3DDE7EB4AE34B81021DB8B44E4A8645.gpg | Bin 0 -> 2226 bytes anda/tools/handbrake/terra-HandBrake.spec | 234 ++++++++++++++++++ 8 files changed, 301 insertions(+) create mode 100644 anda/tools/handbrake/HandBrake-no-fdk_aac.patch create mode 100644 anda/tools/handbrake/HandBrake-no-libva.patch create mode 100644 anda/tools/handbrake/HandBrake-no-nasm.patch create mode 100644 anda/tools/handbrake/HandBrake-nostrip.patch create mode 100644 anda/tools/handbrake/HandBrake-x265-link.patch create mode 100644 anda/tools/handbrake/anda.hcl create mode 100644 anda/tools/handbrake/gpg-keyring-1629C061B3DDE7EB4AE34B81021DB8B44E4A8645.gpg create mode 100644 anda/tools/handbrake/terra-HandBrake.spec diff --git a/anda/tools/handbrake/HandBrake-no-fdk_aac.patch b/anda/tools/handbrake/HandBrake-no-fdk_aac.patch new file mode 100644 index 0000000000..b984bba61c --- /dev/null +++ b/anda/tools/handbrake/HandBrake-no-fdk_aac.patch @@ -0,0 +1,14 @@ +diff -up HandBrake-1.6.0/gtk/configure.ac.fdk HandBrake-1.6.0/gtk/configure.ac +--- HandBrake-1.6.0/gtk/configure.ac.fdk 2022-12-28 09:43:46.000000000 +0100 ++++ HandBrake-1.6.0/gtk/configure.ac 2023-01-23 20:50:40.075455676 +0100 +@@ -215,10 +215,6 @@ else + HB_LIBS="$HB_LIBS -lx264" + fi + +-if test "x$use_fdk_aac" = "xyes" ; then +- HB_LIBS="$HB_LIBS -lfdk-aac" +-fi +- + if test "x$use_x265" = "xyes" ; then + HB_LIBS="$HB_LIBS -lx265" + fi diff --git a/anda/tools/handbrake/HandBrake-no-libva.patch b/anda/tools/handbrake/HandBrake-no-libva.patch new file mode 100644 index 0000000000..d9b32f3f7b --- /dev/null +++ b/anda/tools/handbrake/HandBrake-no-libva.patch @@ -0,0 +1,13 @@ +diff -up HandBrake-1.2.0/test/module.defs.va HandBrake-1.2.0/test/module.defs +--- HandBrake-1.2.0/test/module.defs.va 2018-12-16 18:16:51.000000000 +0100 ++++ HandBrake-1.2.0/test/module.defs 2019-01-21 00:40:28.279840862 +0100 +@@ -25,9 +25,6 @@ endif + + ifeq (1,$(FEATURE.qsv)) + TEST.GCC.D += USE_QSV HAVE_THREADS=1 +-ifeq ($(BUILD.system),linux) +- TEST.GCC.l += va va-drm +-endif + endif + + ifeq (1,$(FEATURE.vce)) diff --git a/anda/tools/handbrake/HandBrake-no-nasm.patch b/anda/tools/handbrake/HandBrake-no-nasm.patch new file mode 100644 index 0000000000..8e1cac7e5b --- /dev/null +++ b/anda/tools/handbrake/HandBrake-no-nasm.patch @@ -0,0 +1,12 @@ +diff -up HandBrake-1.6.0/make/configure.py.orig HandBrake-1.6.0/make/configure.py +--- HandBrake-1.6.0/make/configure.py.orig 2022-12-28 09:43:46.000000000 +0100 ++++ HandBrake-1.6.0/make/configure.py 2023-01-06 23:39:40.041593595 +0100 +@@ -1665,7 +1665,7 @@ try: + lipo = ToolProbe( 'LIPO.exe', 'lipo', 'lipo', abort=False ) + pkgconfig = ToolProbe( 'PKGCONFIG.exe', 'pkgconfig', 'pkg-config', abort=True, minversion=[0,27,0] ) + meson = ToolProbe( 'MESON.exe', 'meson', 'meson', abort=True, minversion=[0,47,0] ) +- nasm = ToolProbe( 'NASM.exe', 'asm', 'nasm', abort=True, minversion=[2,13,0] ) ++ nasm = ToolProbe( 'NASM.exe', 'asm', 'nasm', abort=False, minversion=[2,13,0] ) + ninja = ToolProbe( 'NINJA.exe', 'ninja', 'ninja-build', 'ninja', abort=True ) + + xcodebuild = ToolProbe( 'XCODEBUILD.exe', 'xcodebuild', 'xcodebuild', abort=(True if (not xcode_opts['disabled'] and (build_tuple.match('*-*-darwin*') and cross is None)) else False), versionopt='-version', minversion=[10,3,0] ) diff --git a/anda/tools/handbrake/HandBrake-nostrip.patch b/anda/tools/handbrake/HandBrake-nostrip.patch new file mode 100644 index 0000000000..b03dcc6159 --- /dev/null +++ b/anda/tools/handbrake/HandBrake-nostrip.patch @@ -0,0 +1,10 @@ +--- a/gtk/module.rules ++++ b/gtk/module.rules +@@ -21,6 +21,7 @@ $(GTK.CONFIGURE.stamp): $(GTK.src/)configure.ac $(GTK.src/)src/Makefile.am + CXX="$(GCC.gxx)" \ + CFLAGS="$(call fn.ARGS,GTK.GCC,.g .O *D *W ?extra)" \ + LDFLAGS="$(call fn.ARGS,GTK.GCC,?strip .g .O ?extra.exe)" \ ++ STRIP="$(STRIP.exe)" \ + PYTHON="$(PYTHON.exe)" \ + --prefix=$(PREFIX) \ + --with-hb=$(call fn.ABSOLUTE,$(BUILD/)) diff --git a/anda/tools/handbrake/HandBrake-x265-link.patch b/anda/tools/handbrake/HandBrake-x265-link.patch new file mode 100644 index 0000000000..6a1464571e --- /dev/null +++ b/anda/tools/handbrake/HandBrake-x265-link.patch @@ -0,0 +1,13 @@ +--- a/test/module.defs 2020-06-13 15:05:35.000000000 +0100 ++++ a/test/module.defs 2020-07-03 11:15:53.951205608 +0100 +@@ -30,6 +30,10 @@ + endif + endif + ++ifeq (1,$(FEATURE.x265)) ++ TEST.GCC.l += x265 ++endif ++ + ifeq (1,$(FEATURE.flatpak)) + TEST.GCC.l += glib-2.0 + endif diff --git a/anda/tools/handbrake/anda.hcl b/anda/tools/handbrake/anda.hcl new file mode 100644 index 0000000000..390725ce9f --- /dev/null +++ b/anda/tools/handbrake/anda.hcl @@ -0,0 +1,5 @@ +project pkg { + rpm { + spec = "terra-HandBrake.spec" + } +} diff --git a/anda/tools/handbrake/gpg-keyring-1629C061B3DDE7EB4AE34B81021DB8B44E4A8645.gpg b/anda/tools/handbrake/gpg-keyring-1629C061B3DDE7EB4AE34B81021DB8B44E4A8645.gpg new file mode 100644 index 0000000000000000000000000000000000000000..d845bd31873a115f9de42803ce1e7546f5cc913c GIT binary patch literal 2226 zcmV;j2u=5y0u2ON5T_3T5CG{tac)bCuEr#G+@!=^}bi(I4td$KZXyb=+xx*#qydhd%hV%p~?D;u->k)wWvc z`?jzHfe=0p9QdU4!N$mYg8wp9XwHkYNIDv{Vx#zx|Mi88`aBF*`FIrecY0{y#W@^cj zJa2*sSXX8ZOBXw>4!l^qJ-{FVRDi;93kU4B??ILSd6e|CsngtjF}9Z__B-s-eI5+` zY8=$4xm7(p)*rCbc6tb8j^BJgQLjSmF?>YENj+&n!3STc+w;-!M7+iW0Gg^J400sL zYc8#GUv6jwR$0OupqgB1*I(`hXP~CBhPD6tQ^`rcrgE!?-v^|cRb~JXXniMq!=o#Q zR_wzp6TlK3rd*yHM>j5aM6X^T-sS=&J1z@FKo-vZao_E&v2#jschl8aBKd^#XFKC(>{o{ zGNMwYB(U5$y-@%W0RRECC`e&$WI}RbYh@r*Wnpa~JY;2dWo&P7WpZ;sXkl(-Vsc?? zWiDoNK8XT71QP)Y04D_kSrDfW0viJb2?vHBfCUQ)2nPcN6$%Lm3k4Pe0|5X69svRu zfB*^!5CR>zv`$KfMIbW|{S!pD2T>R$>I)wzaXIVUm3V0Pm?WOAmtWBPIw3~1jJshv z(cm1)&$mMoO0`EG7cW7D|JI~b1H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HR<7vKc#g?f6P&aWbhl)O08flWOk~fQt3u?{KqN zzc(pX??1v^%W)bduzCfF#$H)*Ql|fRzcwBKn?uP>sX)3NM)h1r83cUr+3k%3inI(c A@c;k- literal 0 HcmV?d00001 diff --git a/anda/tools/handbrake/terra-HandBrake.spec b/anda/tools/handbrake/terra-HandBrake.spec new file mode 100644 index 0000000000..4ed1cee336 --- /dev/null +++ b/anda/tools/handbrake/terra-HandBrake.spec @@ -0,0 +1,234 @@ +# https://pkgs.rpmfusion.org/cgit/free/HandBrake.git/tree/HandBrake.spec +%global commit0 04413a27e6d616cddd98c2c6468aca2bf91b87b5 +%global commit_date %(date '+%Y%m%d') +%global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) +%global tag %{version} +%global pkg HandBrake + +# Build with "--without ffmpeg" or enable this to use bundled libAV +# instead of system FFMpeg libraries. +#global _without_ffmpeg 1 + +%ifarch i686 x86_64 +%global _with_asm 1 +%global _with_vpl 1 +%endif + +%global desktop_id fr.handbrake.ghb + +Name: terra-HandBrake +Version: 1.6.1 +Release: 1%?dist +Summary: An open-source multiplatform video transcoder +License: GPL-2.0-or-later +URL: https://handbrake.fr/ + +%if 0%{?tag:1} +#Source0: https://github.com/%pkg/%pkg/releases/download/%version/%pkg-%version-source.tar.bz2 +Source1: https://github.com/%pkg/%pkg/releases/download/%version/%pkg-%version-source.tar.bz2.sig +# import from https://handbrake.fr/openpgp.php or https://github.com/HandBrake/HandBrake/wiki/OpenPGP +# gpg2 --export --export-options export-minimal 1629C061B3DDE7EB4AE34B81021DB8B44E4A8645 > gpg-keyring-1629C061B3DDE7EB4AE34B81021DB8B44E4A8645.gpg +Source2: gpg-keyring-1629C061B3DDE7EB4AE34B81021DB8B44E4A8645.gpg +%else +#Source0: https://github.com/%pkg/%pkg/archive/%commit0.tar.gz#/%{name}-%{shortcommit0}.tar.gz +%endif + +%{?_without_ffmpeg:Source10: https://libav.org/releases/libav-12.tar.gz} + +# Pass strip tool override to gtk/configure +Patch0: %pkg-nostrip.patch +# Don't link with libva unnecessarily +Patch1: %pkg-no-libva.patch +# Don't link with fdk_aac unnecessarily +Patch2: %pkg-no-fdk_aac.patch +# Fix build on non-x86 (without nasm) +Patch3: %pkg-no-nasm.patch +# Patch from Gentoo +Patch4: %pkg-x265-link.patch + +BuildRequires: a52dec-devel >= 0.7.4 +BuildRequires: cmake +BuildRequires: dbus-glib-devel +BuildRequires: desktop-file-utils +%if 0%{?tag:1} +BuildRequires: gnupg2 +%endif +BuildRequires: libappstream-glib +%{!?_without_ffmpeg:BuildRequires: ffmpeg-free-devel >= 3.5} +# Should be >= 2.6: +BuildRequires: freetype-devel >= 2.4.11 +# Should be >= 0.19.7: +BuildRequires: fribidi-devel >= 0.19.4 +BuildRequires: gcc-c++ +BuildRequires: gstreamer1-plugins-base-devel +BuildRequires: intltool +BuildRequires: jansson-devel +BuildRequires: turbojpeg-devel +BuildRequires: lame-devel >= 3.98 +BuildRequires: libappindicator-gtk3-devel +# Should be >= 0.13.2: +BuildRequires: libass-devel >= 0.13.1 +BuildRequires: libbluray-devel >= 0.9.3 +BuildRequires: libdav1d-devel +BuildRequires: libdrm-devel +BuildRequires: libdvdnav-devel >= 5.0.1 +BuildRequires: libdvdread-devel >= 5.0.0 +BuildRequires: libgudev-devel +%if 0%{?_with_vpl:1} +BuildRequires: intel-mediasdk-devel +BuildRequires: oneVPL-devel +BuildRequires: libva-devel +%endif +BuildRequires: libmpeg2-devel >= 0.5.1 +BuildRequires: libnotify-devel +BuildRequires: librsvg2-devel +BuildRequires: libsamplerate-devel +BuildRequires: libtheora-devel +BuildRequires: libtool +BuildRequires: libvorbis-devel +# Should be >= 1.5: +BuildRequires: libvpx-devel >= 1.3 +BuildRequires: make +BuildRequires: meson +%if 0%{?_with_asm:1} +BuildRequires: nasm +%endif +BuildRequires: numactl-devel +BuildRequires: nv-codec-headers +BuildRequires: opus-devel +BuildRequires: python3 +BuildRequires: speex-devel +BuildRequires: svt-av1-devel +BuildRequires: x264-devel >= 0.148 +BuildRequires: x265-devel >= 1.9 +BuildRequires: xz-devel +BuildRequires: zimg-devel +BuildRequires: git +BuildRequires: vulkan-loader + +Requires: hicolor-icon-theme +# needed for reading encrypted DVDs +%{?fedora:Recommends: libdvdcss%_isa} +Obsoletes: HandBrake-cli < %version-%release +Provides: HandBrake-cli = %version-%release +Provides: handbrake = %version-%release + +%description +%pkg is a general-purpose, free, open-source, cross-platform, multithreaded +video transcoder software application. It can process most common multimedia +files and any DVD or Bluray sources that do not contain any kind of copy +protection. + +This package contains the command line version of the program. + +%package gui +Summary: An open-source multiplatform video transcoder (GUI) +Provides: handbrake-gui = %version-%release +Requires: hicolor-icon-theme +# needed for reading encrypted DVDs +%{?fedora:Recommends: libdvdcss%_isa} +# needed for live preview +%{?fedora:Recommends: gstreamer1-plugins-good%_isa} + +%description gui +%pkg is a general-purpose, free, open-source, cross-platform, multithreaded +video transcoder software application. It can process most common multimedia +files and any DVD or Bluray sources that do not contain any kind of copy +protection. + +This package contains the main program with a graphical interface. + +%prep +%if 0%{?tag:1} +%endif +git clone https://github.com/%pkg/%pkg +cd %pkg +git checkout %{!?tag:%commit0}%{?tag:%version} +%patch -P0 -p1 +%if 0%!?_with_vpl +%patch -P1 -p1 +%endif +%patch -P2 -p1 +%patch -P3 -p1 +%patch -P4 -p1 + +# Use system libraries in place of bundled ones +for module in a52dec fdk-aac %{!?_without_ffmpeg:ffmpeg} libdav1d libdvdnav libdvdread libbluray %{?_with_vpl:libmfx libvpl} nvenc libvpx svt-av1 x265; do + sed -i -e "/MODULES += contrib\/$module/d" make/include/main.defs +done + +# Fix desktop file +sed -i -e 's/%desktop_id.svg/%desktop_id/g' gtk/src/%desktop_id.desktop + +%build +cd %pkg +echo "HASH=%commit0" > version.txt +echo "SHORTHASH=%shortcommit0" >> version.txt +echo "DATE=$(date "+%Y-%m-%d %T" -d %date)" >> version.txt +%if 0%{?tag:1} +echo "TAG=%version" >> version.txt +echo "TAG_HASH=%commit0" >> version.txt +%endif + +# By default the project is built with optimizations for speed and no debug. +# Override configure settings by passing RPM_OPT_FLAGS and disabling preset +# debug options. +echo "GCC.args.O.speed = %optflags -I%_includedir/vpl -I%_includedir/ffmpeg -ldl -lx265 %{?_with_vpl:-lvpl}" > custom.defs +echo "GCC.args.g.none = " >> custom.defs + +# Not an autotools configure script. +./configure \ + --build build \ + --prefix=%_prefix \ + --debug=std \ + --strip=%_bindir/echo \ + --verbose \ + --disable-df-fetch \ + --disable-df-verify \ + --disable-gtk-update-checks \ + %{?_with_asm:--enable-asm} \ + --enable-x265 \ + --disable-numa \ + --enable-fdk-aac \ + %{?_with_vpl:--enable-qsv} + +%make_build -C build V=1 + +%install +cd %pkg +%make_install -C build + +cp *.markdown COPYING .. + +# Desktop file, icons and AppStream metadata from FlatPak build (more complete) +rm -f %buildroot%_datadir/applications/ghb.desktop \ + %buildroot%_datadir/icons/hicolor/scalable/apps/hb-icon.svg + +install -Dpm644 gtk/src/%desktop_id.desktop \ + %buildroot%_datadir/applications/%desktop_id.desktop +install -Dpm644 gtk/src/%desktop_id.svg \ + %buildroot%_datadir/icons/hicolor/scalable/apps/%desktop_id.svg + +%find_lang ghb + +%check +desktop-file-validate %buildroot%_datadir/applications/%desktop_id.desktop +appstream-util validate-relax --nonet %buildroot%_metainfodir/%desktop_id.metainfo.xml + +%files gui +%license COPYING +%doc AUTHORS.markdown NEWS.markdown README.markdown THANKS.markdown +%_bindir/ghb +%_metainfodir/%desktop_id.metainfo.xml +%_datadir/applications/%desktop_id.desktop +%_datadir/icons/hicolor/scalable/apps/%desktop_id.svg +%_datadir/locale/*/LC_MESSAGES/ghb.mo + + +%files +%license COPYING +%doc AUTHORS.markdown NEWS.markdown README.markdown THANKS.markdown +%_bindir/HandBrakeCLI + +%changelog +%autochangelog