Skip to content

Commit

Permalink
handbrake: add package
Browse files Browse the repository at this point in the history
  • Loading branch information
Biswa96 committed Dec 28, 2024
1 parent 6df386d commit 0d10f07
Show file tree
Hide file tree
Showing 3 changed files with 215 additions and 0 deletions.
97 changes: 97 additions & 0 deletions mingw-w64-handbrake/0001-handbrake-workaround-build-system.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
diff --git a/make/configure.py b/make/configure.py
index a383cb3..6bc93ef 100644
--- a/make/configure.py
+++ b/make/configure.py
@@ -163,7 +163,7 @@ class Configure( object ):
for dir in path.split( os.pathsep ):
f = os.path.join( dir, name )
if os.access( f, os.X_OK ):
- return f
+ return os.path.normpath(f)
return None

## taken from python2.6 -- we need it
@@ -499,7 +499,7 @@ class BuildTupleProbe( ShellProbe, list ):
GNU_TUPLE_RE = '([^-]+)-?([^-]*)-([^0-9-]+)([^-]*)-?([^-]*)'

def __init__( self ):
- super( BuildTupleProbe, self ).__init__( 'build tuple', '%s/config.guess' % (cfg.dir), abort=True, head=True )
+ super( BuildTupleProbe, self ).__init__( 'build tuple', 'sh %s/config.guess' % (cfg.dir), abort=True, head=True )

def _parseSession( self ):
self.spec = self.session[0].decode('utf-8') if self.session else ''
@@ -1032,6 +1032,8 @@ class ToolProbe( Action ):
name = None
if name is not None:
self.names.append( name )
+ if ".exe" not in name:
+ self.names.append( name + ".exe" )
self.name = self.names[0]
self.pretext = self.name
self.pathname = self.names[0]
@@ -1107,6 +1109,8 @@ class VersionProbe( Action ):
def _action( self ):
with open(os.devnull, 'w') as devnull:
## pipe and redirect stderr to dev/null; effects communicate result
+ if ".exe" not in self.command[0]:
+ self.command.insert(0, "sh")
pipe = subprocess.Popen( self.command, stdout=subprocess.PIPE, stderr=devnull )

## read data into memory buffers
@@ -1678,14 +1682,14 @@ try:
else:
gmake = ToolProbe( 'GMAKE.exe', 'make', 'gmake', 'make', abort=True )

- autoconf = ToolProbe( 'AUTOCONF.exe', 'autoconf', 'autoconf', abort=True, minversion=([2,71,0] if build_tuple.match('*-*-darwin*') else [2,69,0]) )
- automake = ToolProbe( 'AUTOMAKE.exe', 'automake', 'automake', abort=True, minversion=[1,13,0] )
- libtool = ToolProbe( 'LIBTOOL.exe', 'libtool', 'libtool', abort=True )
+ autoconf = ToolProbe( 'AUTOCONF.exe', 'autoconf', 'autoconf', abort=False, minversion=([2,71,0] if build_tuple.match('*-*-darwin*') else [2,69,0]) )
+ automake = ToolProbe( 'AUTOMAKE.exe', 'automake', 'automake', abort=False, minversion=[1,13,0] )
+ libtool = ToolProbe( 'LIBTOOL.exe', 'libtool', 'libtool', abort=False )
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,51,0] )
- nasm = ToolProbe( 'NASM.exe', 'asm', 'nasm', abort=True, minversion=[2,13,0] )
- ninja = ToolProbe( 'NINJA.exe', 'ninja', 'ninja-build', 'ninja', abort=True )
+ pkgconfig = ToolProbe( 'PKGCONFIG.exe', 'pkgconfig', 'pkg-config', abort=False, minversion=[0,27,0] )
+ meson = ToolProbe( 'MESON.exe', 'meson', 'meson', abort=False, minversion=[0,51,0] )
+ nasm = ToolProbe( 'NASM.exe', 'asm', 'nasm', abort=False, minversion=[2,13,0] )
+ ninja = ToolProbe( 'NINJA.exe', 'ninja', 'ninja-build', 'ninja', abort=False )
cargo = ToolProbe( 'CARGO.exe', 'cargo', 'cargo', abort=False )
cargoc = ToolProbe( 'CARGO-C.exe', 'cargo-cbuild', 'cargo-cbuild', abort=False )

@@ -1786,7 +1790,7 @@ try:
## Additional library and tool checks
#####################################
# Requires oneVPL which requires CMake 3.16.3 or later
- Tools.cmake = ToolProbe('CMAKE.exe', 'cmake', 'cmake', abort=True, minversion=[3,16,3])
+ Tools.cmake = ToolProbe('CMAKE.exe', 'cmake', 'cmake', abort=False, minversion=[3,16,3])
Tools.cmake.__init__( Tools.cmake.var, Tools.cmake.option, Tools.cmake.name, **Tools.cmake.kwargs )
Tools.cmake.run()
for action in Action.actions:
diff --git a/test/module.defs b/test/module.defs
index 9f803c4..ee6b87d 100644
--- a/test/module.defs
+++ b/test/module.defs
@@ -76,7 +76,7 @@ ifneq (,$(filter $(HOST.release),2.10))
TEST.GCC.l += iconv
endif
TEST.GCC.D += _POSIX_C_SOURCE=200112L __EXTENSIONS__
-else ifeq (1-mingw,$(HOST.cross)-$(HOST.system))
+else ifeq (0-mingw,$(HOST.cross)-$(HOST.system))
ifeq ($(HAS.dlfcn),1)
TEST.GCC.l += dl
endif
@@ -85,10 +85,9 @@ ifeq (1,$(HAS.pthread))
else
TEST.GCC.l += pthreadGC2
endif
- TEST.GCC.l += bcrypt iconv ws2_32 regex uuid ole32 gdi32 userenv ntdll
+ TEST.GCC.l += x265 bcrypt iconv ws2_32 regex uuid ole32 gdi32 userenv ntdll
ifeq (1,$(FEATURE.mf))
TEST.GCC.l += mfplat strmiids
endif
TEST.GCC.D += PTW32_STATIC_LIB
- TEST.GCC.args.extra.exe++ += -static
-endif # (1-mingw,$(HOST.cross)-$(HOST.system))
+endif # (0-mingw,$(HOST.cross)-$(HOST.system))
28 changes: 28 additions & 0 deletions mingw-w64-handbrake/0003-Remove-ambient-viewing-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From: Sebastian Ramacher <[email protected]>
Date: Fri, 1 Dec 2023 23:02:49 +0100
Subject: Remove ambient viewing support

Support in x265 is added via contrib patches.
---
libhb/encx265.c | 8 --------
1 file changed, 8 deletions(-)

diff --git a/libhb/encx265.c b/libhb/encx265.c
index 5be461b..c5518db 100644
--- a/libhb/encx265.c
+++ b/libhb/encx265.c
@@ -269,14 +269,6 @@ int encx265Init(hb_work_object_t *w, hb_job_t *job)
}
}

- if (job->ambient.ambient_illuminance.num && job->ambient.ambient_illuminance.den)
- {
- param->ambientIlluminance = hb_rescale_rational(job->ambient.ambient_illuminance, 10000);
- param->ambientLightX = hb_rescale_rational(job->ambient.ambient_light_x, 50000);
- param->ambientLightY = hb_rescale_rational(job->ambient.ambient_light_y, 50000);
- param->bEmitAmbientViewingEnvironment = 1;
- }
-
if (job->chroma_location != AVCHROMA_LOC_UNSPECIFIED)
{
char chromaLocation[256];
90 changes: 90 additions & 0 deletions mingw-w64-handbrake/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Maintainer: Biswapriyo Nath <[email protected]>

_realname=handbrake
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.9.0
pkgrel=1
pkgdesc="The open source video transcoder (mingw-w64)"
arch=('any')
mingw_arch=('ucrt64' 'clang64')
url='https://handbrake.fr/'
license=('GPL-2.0-or-later')
depends=(
"${MINGW_PACKAGE_PREFIX}-ffmpeg"
"${MINGW_PACKAGE_PREFIX}-jansson"
"${MINGW_PACKAGE_PREFIX}-libass"
"${MINGW_PACKAGE_PREFIX}-libbluray"
"${MINGW_PACKAGE_PREFIX}-libdvdnav"
"${MINGW_PACKAGE_PREFIX}-libdvdread"
"${MINGW_PACKAGE_PREFIX}-libiconv"
"${MINGW_PACKAGE_PREFIX}-libjpeg-turbo"
"${MINGW_PACKAGE_PREFIX}-libsystre"
"${MINGW_PACKAGE_PREFIX}-libtheora"
"${MINGW_PACKAGE_PREFIX}-libvorbis"
"${MINGW_PACKAGE_PREFIX}-libx264"
"${MINGW_PACKAGE_PREFIX}-svt-av1"
"${MINGW_PACKAGE_PREFIX}-x265"
)
makedepends=(
"${MINGW_PACKAGE_PREFIX}-autotools"
"${MINGW_PACKAGE_PREFIX}-cc"
"${MINGW_PACKAGE_PREFIX}-pkgconf"
"${MINGW_PACKAGE_PREFIX}-python"
)
source=(
"https://github.com/HandBrake/HandBrake/releases/download/${pkgver}/HandBrake-${pkgver}-source.tar.bz2"{,.sig}
"https://github.com/HandBrake/HandBrake/commit/6f2cd466ef0e029d9e5a51ac8640c3ab64e212f6.patch"
"https://github.com/HandBrake/HandBrake/commit/09e99ce641c840686b1b5f860263e89ad7d6651d.patch"
"0001-handbrake-workaround-build-system.patch"
"0003-Remove-ambient-viewing-support.patch"
)
sha256sums=('c15b451502f5c938798595df897a41290e8881b3efb8edd69ff7db2d985733b0'
'SKIP'
'010910a0c287d7a93ba9d13c52e1c671a64b65915f6b232c37b695e44ef02eb5'
'f1da71bb593a5ad18893c60a3e07d059d34245351fb7957472b2e749fc6f939d'
'3a240bc164143706c025dd8809f969352e0dbd0226611ee9a97c05eb772a9d75'
'5245ef3310df3326a28f0da40e78d8bfd6cd83f790600e3557acc99b1de6ac32')
validpgpkeys=('1629C061B3DDE7EB4AE34B81021DB8B44E4A8645') # HandBrake Team <[email protected]>

_apply_patch_with_msg() {
for _patch in "$@"
do
msg2 "Applying ${_patch}"
patch -p1 -i "${srcdir}/${_patch}"
done
}

prepare() {
cd "HandBrake-${pkgver}"

# Remove reference to bundled dependencies
rm -rf contrib/
sed -i -E '/(\/contrib|contrib\/)/d' make/include/main.defs

# error: 'AV_FRAME_DATA_DOVI_RPU_BUFFER_T35' undeclared (needs ffmpeg > 7.1)
patch -R -p1 -i "${srcdir}/6f2cd466ef0e029d9e5a51ac8640c3ab64e212f6.patch"
patch -R -p1 -i "${srcdir}/09e99ce641c840686b1b5f860263e89ad7d6651d.patch"

# Put all the magic here
_apply_patch_with_msg 0001-handbrake-workaround-build-system.patch

# https://salsa.debian.org/multimedia-team/handbrake/-/blob/master/debian/patches/0003-Remove-ambient-viewing-support.patch?ref_type=heads
_apply_patch_with_msg 0003-Remove-ambient-viewing-support.patch
}

build() {
cd "HandBrake-${pkgver}"

./configure

make -C build

# meson setup -Dhb-dir=$PWD/build build/gtk gtk
}

package() {
cd "HandBrake-${pkgver}/build"
install -D HandBrakeCLI.exe "${pkgdir}${MINGW_PREFIX}/bin/HandBrakeCLI.exe"
install -Dm644 "${srcdir}/${_realname}-${pkgver}/LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}

0 comments on commit 0d10f07

Please sign in to comment.