Import multimedia/handbrake, an open source video transcoder.

ok kn@

HandBrake is an open-source, GPL-licensed, multiplatform, multithreaded
video transcoder with rich selection of features. Both GUI and
command-line only versions are available.

Supported sources:
* Most common multimedia files that libavformat and libavcodec support
* Any DVD or Bluray-like source which is NOT copy-protected (removal
  of copy protection is not supported)

Outputs:
* File (container) format: MP4 (M4V) and MKV
* Video: H.264 (x264), H.265 (x265), MPEG-2/MPEG-4 (ffmpeg), or
         Theora (libtheora)
* Audio: AAC, CoreAudio AAC/HE-AAC (OS X only), MP3, FLAC, AC3, or
         Vorbis; AC-3, DTS, DTS-HD, AAC, and MP3 pass-through

HandBrake also includes support for chapters, subtitles, advanced video
filters, and more. It is also useful for making videos compatible with
portable video devices such as the Apple iPod/iPhone.
This commit is contained in:
bcallah 2019-08-05 13:35:20 +00:00
parent b873c7477e
commit bc3b8ef91e
11 changed files with 488 additions and 0 deletions

View File

@ -0,0 +1,85 @@
# $OpenBSD: Makefile,v 1.1.1.1 2019/08/05 13:35:20 bcallah Exp $
V = 1.2.2
COMMENT = open source video transcoder
DISTNAME = HandBrake-${V}-source
PKGNAME = handbrake-${V}
EXTRACT_SUFX = .tar.bz2
CATEGORIES = multimedia x11
HOMEPAGE = https://handbrake.fr/
MAINTAINER = Brian Callahan <bcallah@openbsd.org>
# GPLv2 only
PERMIT_PACKAGE = Yes
WANTLIB += ${COMPILER_LIBCXX} X11 Xcomposite Xcursor Xdamage Xext
WANTLIB += Xfixes Xi Xinerama Xrandr Xrender ass atk-1.0 atk-bridge-2.0
WANTLIB += avcodec avfilter avformat avresample avutil bluray
WANTLIB += bz2 c cairo cairo-gobject crypto dav1d dvdnav dvdread
WANTLIB += epoxy expat ffi fontconfig freetype fribidi gdk-3 gdk_pixbuf-2.0
WANTLIB += gio-2.0 glib-2.0 gmodule-2.0 gobject-2.0 graphite2
WANTLIB += gsm gstaudio-1.0 gstbase-1.0 gstpbutils-1.0 gstreamer-1.0
WANTLIB += gsttag-1.0 gstvideo-1.0 gthread-2.0 gtk-3 harfbuzz
WANTLIB += iconv intl jansson lzma m mp3lame ogg opus orc-0.4
WANTLIB += pango-1.0 pangocairo-1.0 pangoft2-1.0 pcre pixman-1
WANTLIB += png postproc samplerate speex ssl swresample swscale
WANTLIB += theoradec theoraenc vorbis vorbisenc vpx x264 x265
WANTLIB += xcb xcb-render xcb-shm xml2 xvidcore z
MASTER_SITES = https://download.handbrake.fr/releases/${V}/
COMPILER = base-clang ports-gcc
MODULES = lang/python
MODPY_RUNDEP = No
BUILD_DEPENDS = devel/autoconf/${AUTOCONF_VERSION} \
devel/automake/${AUTOMAKE_VERSION} \
devel/gettext,-tools \
textproc/intltool
LIB_DEPENDS = devel/jansson \
devel/orc \
graphics/ffmpeg \
multimedia/libbluray \
multimedia/gstreamer1/plugins-base \
multimedia/libdvdnav \
multimedia/libtheora \
multimedia/libvpx \
multimedia/x264 \
multimedia/x265 \
x11/gtk+3
RUN_DEPENDS = devel/desktop-file-utils \
x11/gtk+3,-guic
SEPARATE_BUILD = Yes
CONFIGURE_STYLE = simple
CONFIGURE_SCRIPT = ${MODPY_BIN} ${WRKSRC}/make/configure.py
CONFIGURE_ARGS = --disable-gtk-update-checks \
--enable-x265
# Yes, autoconf is called *during* the build but not at configure time...
USE_GMAKE = Yes
ALL_TARGET = build
MAKE_ENV = AUTOCONF_VERSION="${AUTOCONF_VERSION}" \
AUTOMAKE_VERSION="${AUTOMAKE_VERSION}"
MAKE_FILE = GNUmakefile
MAKE_FLAGS = CFLAGS="${CFLAGS} -I${LOCALBASE}/include/libxml2 -D_NO_UPDATE_CHECK" \
LDFLAGS="${LDFLAGS} -L${LOCALBASE}/lib -L${X11BASE}/lib -lx265 -liconv"
AUTOCONF_VERSION = 2.69
AUTOMAKE_VERSION = 1.16
WRKDIST = ${WRKDIR}/HandBrake-${V}
post-extract:
ln -s ${WRKSRC}/make/variant/freebsd.defs \
${WRKSRC}/make/variant/openbsd.defs
post-install:
ln -s ${TRUEPREFIX}/bin/ghb ${PREFIX}/bin/HandBrake
.include <bsd.port.mk>

View File

@ -0,0 +1,2 @@
SHA256 (HandBrake-1.2.2-source.tar.bz2) = 32gW9RfWCuimYmqnMYIa8tGWbBVfpTsrmgbEfzxWXkw=
SIZE (HandBrake-1.2.2-source.tar.bz2) = 18010777

View File

@ -0,0 +1,27 @@
$OpenBSD: patch-gtk_configure_ac,v 1.1.1.1 2019/08/05 13:35:20 bcallah Exp $
Get the proper library directory for -lhandbrake.
No -ldl on OpenBSD.
Index: gtk/configure.ac
--- gtk/configure.ac.orig
+++ gtk/configure.ac
@@ -179,7 +179,7 @@ PKG_CHECK_MODULES(GHB, [$GHB_PACKAGES])
GHB_CFLAGS="$HBINC $GHB_CFLAGS"
-HB_LIBS="-lhandbrake -lavformat -lavfilter -lavcodec -lavutil -lswresample -lpostproc -ldvdnav -ldvdread -lmp3lame -lvorbis -lvorbisenc -logg -lsamplerate -lx264 -lswscale -ltheoraenc -ltheoradec -lvpx -lz -lbz2 -lbluray -lass -lfontconfig -lfreetype -lxml2 -ljansson -lopus -lspeex -llzma"
+HB_LIBS="-L../../libhb -lhandbrake -lavformat -lavfilter -lavcodec -lavutil -lswresample -lpostproc -ldvdnav -ldvdread -lmp3lame -lvorbis -lvorbisenc -logg -lsamplerate -lx264 -lswscale -ltheoraenc -ltheoradec -lvpx -lz -lbz2 -lbluray -lass -lfontconfig -lfreetype -lxml2 -ljansson -lopus -lspeex -llzma"
case $host in
*-*-mingw*)
@@ -194,6 +194,9 @@ case $host in
HB_LIBS="$HB_LIBS -lbcrypt -lregex -luuid"
;;
*-*-freebsd*)
+ HB_LIBS="$HB_LIBS -lpthread"
+ ;;
+ *-*-openbsd*)
HB_LIBS="$HB_LIBS -lpthread"
;;
*)

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-gtk_src_callbacks_c,v 1.1.1.1 2019/08/05 13:35:20 bcallah Exp $
We need this include too.
Index: gtk/src/callbacks.c
--- gtk/src/callbacks.c.orig
+++ gtk/src/callbacks.c
@@ -44,7 +44,7 @@
#include <gudev/gudev.h>
#endif
-#if defined( __FreeBSD__ )
+#if defined( __FreeBSD__ ) || defined( __OpenBSD__ )
#include <sys/socket.h>
#endif
#include <netinet/in.h>

View File

@ -0,0 +1,43 @@
$OpenBSD: patch-libhb_decsrtsub_c,v 1.1.1.1 2019/08/05 13:35:20 bcallah Exp $
iconv* => libiconv* for use with our libiconv
Index: libhb/decsrtsub.c
--- libhb/decsrtsub.c.orig
+++ libhb/decsrtsub.c
@@ -271,7 +271,7 @@ static int utf8_fill( hb_work_private_t * pv )
q = pv->utf8_buf + pv->utf8_end;
in_size = pv->end - pv->pos;
- retval = iconv( pv->iconv_context, &p, &in_size, &q, &out_size);
+ retval = libiconv( pv->iconv_context, &p, &in_size, &q, &out_size);
if (q != pv->utf8_buf + pv->utf8_end)
{
conversion = 1;
@@ -661,7 +661,7 @@ static int decsrtInit( hb_work_object_t * w, hb_job_t
pv->start_time = AV_NOPTS_VALUE;
}
- pv->iconv_context = iconv_open( "utf-8", pv->subtitle->config.src_codeset );
+ pv->iconv_context = libiconv_open( "utf-8", pv->subtitle->config.src_codeset );
if( pv->iconv_context == (iconv_t) -1 )
{
hb_error("Could not open the iconv library with those file formats\n");
@@ -692,7 +692,7 @@ fail:
{
if (pv->iconv_context != (iconv_t) -1)
{
- iconv_close(pv->iconv_context);
+ libiconv_close(pv->iconv_context);
}
if (pv->file != NULL)
{
@@ -743,7 +743,7 @@ static void decsrtClose( hb_work_object_t * w )
if (pv != NULL)
{
fclose( pv->file );
- iconv_close(pv->iconv_context);
+ libiconv_close(pv->iconv_context);
free( w->private_data );
}
}

View File

@ -0,0 +1,43 @@
$OpenBSD: patch-libhb_fifo_c,v 1.1.1.1 2019/08/05 13:35:20 bcallah Exp $
Add OpenBSD where appropriate.
Index: libhb/fifo.c
--- libhb/fifo.c.orig
+++ libhb/fifo.c
@@ -13,7 +13,7 @@
#endif
#ifndef SYS_DARWIN
-#if defined( SYS_FREEBSD ) || defined ( __FreeBSD__ )
+#if defined( SYS_FREEBSD ) || defined ( __FreeBSD__ ) || defined ( __OpenBSD__ )
#include <stdlib.h>
#else
#include <malloc.h>
@@ -395,7 +395,7 @@ hb_buffer_t * hb_buffer_init_internal( int size )
if (size)
{
-#if defined( SYS_DARWIN ) || defined( SYS_FREEBSD ) || defined ( __FreeBSD__ ) || defined( SYS_MINGW )
+#if defined( SYS_DARWIN ) || defined( SYS_FREEBSD ) || defined ( __FreeBSD__ ) || defined( SYS_MINGW ) || defined ( __OpenBSD__ )
b->data = malloc( b->alloc );
#elif defined( SYS_CYGWIN )
/* FIXME */
@@ -821,7 +821,7 @@ hb_image_t * hb_image_init(int pix_fmt, int width, int
{
return NULL;
}
-#if defined( SYS_DARWIN ) || defined( SYS_FREEBSD ) || defined ( __FreeBSD__ ) || defined( SYS_MINGW )
+#if defined( SYS_DARWIN ) || defined( SYS_FREEBSD ) || defined ( __FreeBSD__ ) || defined( SYS_MINGW ) || defined ( __OpenBSD__ )
image->data = malloc(size);
#elif defined( SYS_CYGWIN )
/* FIXME */
@@ -862,7 +862,7 @@ hb_image_t * hb_buffer_to_image(hb_buffer_t *buf)
{
hb_image_t *image = calloc(1, sizeof(hb_image_t));
-#if defined( SYS_DARWIN ) || defined( SYS_FREEBSD ) || defined ( __FreeBSD__ ) || defined( SYS_MINGW )
+#if defined( SYS_DARWIN ) || defined( SYS_FREEBSD ) || defined ( __FreeBSD__ ) || defined( SYS_MINGW ) || defined ( __OpenBSD__ )
image->data = malloc( buf->size );
#elif defined( SYS_CYGWIN )
/* FIXME */

View File

@ -0,0 +1,74 @@
$OpenBSD: patch-make_configure_py,v 1.1.1.1 2019/08/05 13:35:20 bcallah Exp $
Add OpenBSD to the configure args we need.
Do not look for CMake; we don't need it.
Index: make/configure.py
--- make/configure.py.orig
+++ make/configure.py
@@ -591,6 +591,8 @@ class ArchAction( Action ):
elif host.match( '*-*-freebsd.*' ):
self.mode['i386'] = 'i386-portsbuild-freebsd%s' % (host.release)
self.mode['amd64'] = 'amd64-portsbuild-freebsd%s' % (host.release)
+ elif host.match( '*-*-openbsd*' ):
+ pass
else:
self.msg_pass = 'WARNING'
@@ -1294,17 +1296,17 @@ def createCLI():
h = IfHost( 'enable assembly code in non-contrib modules', 'NOMATCH*-*-darwin*', 'NOMATCH*-*-linux*', none=optparse.SUPPRESS_HELP ).value
grp.add_option( '--enable-asm', default=False, action='store_true', help=h )
- h = IfHost( 'disable GTK GUI', '*-*-linux*', '*-*-freebsd*', none=optparse.SUPPRESS_HELP ).value
+ h = IfHost( 'disable GTK GUI', '*-*-linux*', '*-*-freebsd*', '*-*-openbsd*', none=optparse.SUPPRESS_HELP ).value
grp.add_option( '--disable-gtk', default=False, action='store_true', help=h )
- h = IfHost( 'disable GTK GUI update checks', '*-*-linux*', '*-*-freebsd*', none=optparse.SUPPRESS_HELP ).value
+ h = IfHost( 'disable GTK GUI update checks', '*-*-linux*', '*-*-freebsd*', '*-*-openbsd*', none=optparse.SUPPRESS_HELP ).value
grp.add_option( '--disable-gtk-update-checks', default=False, action='store_true', help=h )
h = IfHost( 'enable GTK GUI (mingw)', '*-*-mingw*', none=optparse.SUPPRESS_HELP ).value
grp.add_option( '--enable-gtk-mingw', default=False, action='store_true', help=h )
- h = IfHost( 'disable GStreamer (live preview)', '*-*-linux*', '*-*-freebsd*', none=optparse.SUPPRESS_HELP ).value
+ h = IfHost( 'disable GStreamer (live preview)', '*-*-linux*', '*-*-freebsd*', '*-*-openbsd*', none=optparse.SUPPRESS_HELP ).value
grp.add_option( '--disable-gst', default=False, action='store_true', help=h )
@@ -1327,7 +1329,7 @@ def createCLI():
grp.add_option( '--disable-ffmpeg-aac', dest="enable_ffmpeg_aac", action='store_false' )
h = IfHost( 'enable Nvidia NVEnc video encoder', '*-*-*', none=optparse.SUPPRESS_HELP ).value
- grp.add_option( '--enable-nvenc', dest="enable_nvenc", default=not (host.match( '*-*-darwin*' ) or host.match( '*-*-freebsd*' )), action='store_true', help=h )
+ grp.add_option( '--enable-nvenc', dest="enable_nvenc", default=not (host.match( '*-*-darwin*' ) or host.match( '*-*-freebsd*' ) or host.match( '*-*-openbsd*') ), action='store_true', help=h )
cli.add_option_group( grp )
@@ -1385,7 +1387,7 @@ def createCLI():
grp.add_option( '--snapshot', default=False, action='store_true',
help='Force a snapshot build' )
- h = IfHost( 'Build extra contribs for flatpak packaging', '*-*-linux*', '*-*-freebsd*', none=optparse.SUPPRESS_HELP ).value
+ h = IfHost( 'Build extra contribs for flatpak packaging', '*-*-linux*', '*-*-freebsd*', '*-*-openbsd*', none=optparse.SUPPRESS_HELP ).value
grp.add_option( '--flatpak', default=False, action='store_true', help=h )
cli.add_option_group( grp )
@@ -1531,17 +1533,12 @@ try:
else:
gmake = ToolProbe( 'GMAKE.exe', 'gmake', 'make', abort=True )
- m4 = ToolProbe( 'M4.exe', 'gm4', 'm4', abort=True )
mkdir = ToolProbe( 'MKDIR.exe', 'mkdir', abort=True )
- patch = ToolProbe( 'PATCH.exe', 'gpatch', 'patch', abort=True )
rm = ToolProbe( 'RM.exe', 'rm', abort=True )
ranlib = ToolProbe( 'RANLIB.exe', 'ranlib', abort=True )
strip = ToolProbe( 'STRIP.exe', 'strip', abort=True )
- tar = ToolProbe( 'TAR.exe', 'gtar', 'tar', abort=True )
- nasm = ToolProbe( 'NASM.exe', 'nasm', abort=False, minversion=[2,13,0] )
autoconf = ToolProbe( 'AUTOCONF.exe', 'autoconf', abort=True )
automake = ToolProbe( 'AUTOMAKE.exe', 'automake', abort=True )
- cmake = ToolProbe( 'CMAKE.exe', 'cmake', abort=True )
libtool = ToolProbe( 'LIBTOOL.exe', 'libtool', abort=True )
pkgconfig = ToolProbe( 'PKGCONFIG.exe', 'pkg-config', abort=True )

View File

@ -0,0 +1,30 @@
$OpenBSD: patch-make_include_gcc_defs,v 1.1.1.1 2019/08/05 13:35:20 bcallah Exp $
Remove hardcoded optimization flags.
Proper -I and -L dirs.
Index: make/include/gcc.defs
--- make/include/gcc.defs.orig
+++ make/include/gcc.defs
@@ -60,16 +60,16 @@ GCC.args.g.none = -g0
GCC.args.g.min = -gdwarf-2 -g1
GCC.args.g.std = -gdwarf-2
GCC.args.g.max = -gdwarf-2 -g3
-GCC.args.O.none = -O0
-GCC.args.O.size = -Os
-GCC.args.O.speed = -O3
+GCC.args.O.none =
+GCC.args.O.size =
+GCC.args.O.speed =
GCC.args.D = -D$(1)
-GCC.args.I = -I$(1)
+GCC.args.I = -I$(1) -I$(LOCALBASE)/include -I$(X11BASE)/include -I$(LOCALBASE)/include/libavcodec
GCC.args.muldefs = -Wl,--allow-multiple-definition
GCC.args.start = -Wl,--start-group
GCC.args.F = -F$(1)
GCC.args.f = -framework $(1)
-GCC.args.L = -L$(1)
+GCC.args.L = -L$(1) -L$(LOCALBASE)/lib -L$(X11BASE)/lib
GCC.args.l = -l$(1)
GCC.args.end = -Wl,--end-group

View File

@ -0,0 +1,118 @@
$OpenBSD: patch-make_include_main_defs,v 1.1.1.1 2019/08/05 13:35:20 bcallah Exp $
Rip out all the optional dependencies.
We'll let the ports tree handle it.
Index: make/include/main.defs
--- make/include/main.defs.orig
+++ make/include/main.defs
@@ -7,97 +7,6 @@ include $(SRC/)make/include/tool.defs
###############################################################################
-ifneq (,$(filter $(BUILD.system),cygwin mingw))
-ifneq ($(HAS.bz2),1)
- MODULES += contrib/bzip2
-endif
-endif
-
-ifneq (,$(filter $(BUILD.system),darwin cygwin mingw))
- MODULES += contrib/freetype
- MODULES += contrib/fribidi
- MODULES += contrib/harfbuzz
- MODULES += contrib/libxml2
- MODULES += contrib/libass
- MODULES += contrib/libogg
- MODULES += contrib/libvorbis
- MODULES += contrib/libopus
- MODULES += contrib/libspeex
- MODULES += contrib/libtheora
- MODULES += contrib/libsamplerate
- MODULES += contrib/lame
- MODULES += contrib/x264
- MODULES += contrib/jansson
-endif
-
-ifeq (1,$(FEATURE.flatpak))
- MODULES += contrib/libopus
- MODULES += contrib/lame
- MODULES += contrib/jansson
- MODULES += contrib/x264
-endif
-
-ifeq (1,$(FEATURE.fdk_aac))
- MODULES += contrib/fdk-aac
-endif
-
-ifeq (1,$(FEATURE.x265))
- MODULES += contrib/x265
- MODULES += contrib/x265_8bit
- MODULES += contrib/x265_10bit
- MODULES += contrib/x265_12bit
-endif
-
-MODULES += contrib/ffmpeg
-MODULES += contrib/libvpx
-MODULES += contrib/libdvdread
-MODULES += contrib/libdvdnav
-MODULES += contrib/libbluray
-
-ifneq (,$(filter $(BUILD.system),mingw))
-ifneq ($(HAS.pthread),1)
-ifneq ($(HAS.pthreadGC2),1)
- MODULES += contrib/pthreadw32
-endif
-endif
-endif
-
-ifeq (1,$(FEATURE.qsv))
- MODULES += contrib/libmfx
-endif
-
-ifeq (1,$(FEATURE.vce))
- MODULES += contrib/amf
-endif
-
-ifeq (1,$(FEATURE.nvenc))
- MODULES += contrib/nvenc
-endif
-
-ifneq (,$(filter $(BUILD.system),darwin))
- MODULES += contrib/xz
-endif
-
-ifneq (,$(filter $(BUILD.system),cygwin mingw))
-ifneq ($(HAS.iconv),1)
- MODULES += contrib/libiconv
-endif
-ifneq ($(HAS.xz),1)
- MODULES += contrib/xz
-endif
-ifneq ($(HAS.libz),1)
- MODULES += contrib/zlib
-endif
-ifneq ($(HAS.regex),1)
- MODULES += contrib/libgnurx
-endif
-endif
-
-ifneq (,$(filter $(BUILD.system),solaris))
- MODULES += contrib/libiconv
-endif
-
-
## these must come after contrib since some contrib modules are optional
MODULES += libhb
@@ -127,6 +36,11 @@ endif
ifeq (1-kfreebsd,$(FEATURE.gtk)-$(BUILD.system))
## build gtk when gtk+kfreebsd
+ MODULES += gtk
+endif
+
+ifeq (1-openbsd,$(FEATURE.gtk)-$(BUILD.system))
+ ## build gtk when gtk+openbsd
MODULES += gtk
endif

View File

@ -0,0 +1,19 @@
HandBrake is an open-source, GPL-licensed, multiplatform, multithreaded
video transcoder with rich selection of features. Both GUI and
command-line only versions are available.
Supported sources:
* Most common multimedia files that libavformat and libavcodec support
* Any DVD or Bluray-like source which is NOT copy-protected (removal
of copy protection is not supported)
Outputs:
* File (container) format: MP4 (M4V) and MKV
* Video: H.264 (x264), H.265 (x265), MPEG-2/MPEG-4 (ffmpeg), or
Theora (libtheora)
* Audio: AAC, CoreAudio AAC/HE-AAC (OS X only), MP3, FLAC, AC3, or
Vorbis; AC-3, DTS, DTS-HD, AAC, and MP3 pass-through
HandBrake also includes support for chapters, subtitles, advanced video
filters, and more. It is also useful for making videos compatible with
portable video devices such as the Apple iPod/iPhone.

View File

@ -0,0 +1,31 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2019/08/05 13:35:20 bcallah Exp $
bin/HandBrake
@bin bin/HandBrakeCLI
@bin bin/ghb
share/applications/fr.handbrake.ghb.desktop
share/icons/hicolor/scalable/apps/fr.handbrake.ghb.svg
share/icons/hicolor/scalable/apps/hb-icon.svg
share/locale/cs/LC_MESSAGES/ghb.mo
share/locale/da/LC_MESSAGES/ghb.mo
share/locale/de/LC_MESSAGES/ghb.mo
share/locale/es/LC_MESSAGES/ghb.mo
share/locale/fr/LC_MESSAGES/ghb.mo
share/locale/it_IT/
share/locale/it_IT/LC_MESSAGES/
share/locale/it_IT/LC_MESSAGES/ghb.mo
share/locale/ja_JP/
share/locale/ja_JP/LC_MESSAGES/
share/locale/ja_JP/LC_MESSAGES/ghb.mo
share/locale/ko/LC_MESSAGES/ghb.mo
share/locale/no/LC_MESSAGES/ghb.mo
share/locale/pt_BR/LC_MESSAGES/ghb.mo
share/locale/ro_RO/
share/locale/ro_RO/LC_MESSAGES/
share/locale/ro_RO/LC_MESSAGES/ghb.mo
share/locale/ru/LC_MESSAGES/ghb.mo
share/locale/th/LC_MESSAGES/ghb.mo
share/locale/zh_CN/LC_MESSAGES/ghb.mo
share/metainfo/
share/metainfo/fr.handbrake.ghb.appdata.xml
@tag update-desktop-database
@tag gtk-update-icon-cache %D/share/icons/hicolor