add: handbrake (#521)

* add: terra-HandBrake

* ffmpeg?

* random fixes

* try free ffmpeg

Signed-off-by: madomado <wboy111@outlook.com>

* Update terra-HandBrake.spec

Signed-off-by: madomado <wboy111@outlook.com>

* fix build dep and changelog

* Update terra-HandBrake.spec

* Update terra-HandBrake.spec

Signed-off-by: madomado <wboy111@outlook.com>

* Update terra-HandBrake.spec

* add builddeps vulkan-loader

Signed-off-by: madomado <wboy111@outlook.com>

* fix files

Signed-off-by: madomado <wboy111@outlook.com>

* fix(files): ~

Signed-off-by: madomado <wboy111@outlook.com>

* fix(files): ~

Signed-off-by: madomado <wboy111@outlook.com>

---------

Signed-off-by: madomado <wboy111@outlook.com>
This commit is contained in:
madomado
2023-07-09 01:40:39 +08:00
committed by GitHub
parent 044dd57b33
commit ece4de10c0
8 changed files with 301 additions and 0 deletions
@@ -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
@@ -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))
@@ -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] )
@@ -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/))
@@ -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
+5
View File
@@ -0,0 +1,5 @@
project pkg {
rpm {
spec = "terra-HandBrake.spec"
}
}
+234
View File
@@ -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