summaryrefslogtreecommitdiff
path: root/multimedia
diff options
context:
space:
mode:
authoradam <adam@pkgsrc.org>2022-09-26 17:00:21 +0000
committeradam <adam@pkgsrc.org>2022-09-26 17:00:21 +0000
commit2053ae9d1df5c8e6cfd31ed2a96c00de76776d6c (patch)
tree4bf96a42b28dafe5a2872f5535e574cfecd6868e /multimedia
parent576dca12839ba73acd7ea5ed8dfb46fb32d71e48 (diff)
downloadpkgsrc-2053ae9d1df5c8e6cfd31ed2a96c00de76776d6c.tar.gz
x264: added version 20220601
x264 is a free software library and application for encoding video streams into the H.264/MPEG-4 AVC compression format.
Diffstat (limited to 'multimedia')
-rw-r--r--multimedia/Makefile3
-rw-r--r--multimedia/x264/DESCR2
-rw-r--r--multimedia/x264/Makefile76
-rw-r--r--multimedia/x264/PLIST8
-rw-r--r--multimedia/x264/buildlink3.mk23
-rw-r--r--multimedia/x264/distinfo7
-rw-r--r--multimedia/x264/options.mk16
-rw-r--r--multimedia/x264/patches/patch-configure135
-rw-r--r--multimedia/x264/patches/patch-encoder_analyse.c15
9 files changed, 284 insertions, 1 deletions
diff --git a/multimedia/Makefile b/multimedia/Makefile
index f76f69d1a56..19d2dcfb087 100644
--- a/multimedia/Makefile
+++ b/multimedia/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.325 2022/09/24 20:22:49 adam Exp $
+# $NetBSD: Makefile,v 1.326 2022/09/26 17:00:21 adam Exp $
#
COMMENT= Multimedia utilities
@@ -213,6 +213,7 @@ SUBDIR+= transcode
SUBDIR+= tstools
SUBDIR+= vlc
SUBDIR+= win32-codecs
+SUBDIR+= x264
SUBDIR+= x264-devel
SUBDIR+= x265
SUBDIR+= xawtv
diff --git a/multimedia/x264/DESCR b/multimedia/x264/DESCR
new file mode 100644
index 00000000000..c1479206379
--- /dev/null
+++ b/multimedia/x264/DESCR
@@ -0,0 +1,2 @@
+x264 is a free software library and application for encoding video streams into
+the H.264/MPEG-4 AVC compression format.
diff --git a/multimedia/x264/Makefile b/multimedia/x264/Makefile
new file mode 100644
index 00000000000..46db4678800
--- /dev/null
+++ b/multimedia/x264/Makefile
@@ -0,0 +1,76 @@
+# $NetBSD: Makefile,v 1.1 2022/09/26 17:00:21 adam Exp $
+
+# Download https://code.videolan.org/videolan/x264/-/archive/stable/x264-stable.tar.bz2
+# Rename to x264-<last-commit-date>.tar.bz2 and upload to MASTER_SITE_LOCAL.
+
+DISTNAME= x264-20220601
+CATEGORIES= multimedia
+MASTER_SITES= ${MASTER_SITE_LOCAL}
+EXTRACT_SUFX= .tar.bz2
+
+MAINTAINER= adam@NetBSD.org
+HOMEPAGE= https://www.videolan.org/developers/x264.html
+COMMENT= GPL licensed H.264 encoder
+LICENSE= gnu-gpl-v2
+
+WRKSRC= ${WRKDIR}/x264-stable
+
+.include "../../mk/bsd.prefs.mk"
+
+# Assembler code still needs to be disabled on at least SunOS.
+# NetBSD/i386 needs ASM disabled to avoid text relocations.
+# NetBSD/mips needs ASM disabled because it uses the MSA extension
+# (requires MIPS64 revision 2) and fails to build.
+.if ${OPSYS} == "SunOS" || \
+ !empty(MACHINE_PLATFORM:MNetBSD-*-i386) || \
+ !empty(MACHINE_PLATFORM:MNetBSD-*-mips*)
+CONFIGURE_ARGS+= --disable-asm
+.elif ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" || \
+ (${OPSYS} == "Darwin" && ${MACHINE_ARCH} == "aarch64")
+TOOL_DEPENDS+= nasm>=2.13.0:../../devel/nasm
+.endif
+
+USE_TOOLS+= bash gmake
+USE_LIBTOOL= yes
+HAS_CONFIGURE= yes
+CONFIG_SHELL= ${BASH}
+CONFIGURE_ARGS+= --enable-shared
+CONFIGURE_ARGS+= --enable-static
+CONFIGURE_ARGS+= --enable-pic
+CONFIGURE_ARGS+= --prefix=${PREFIX}
+.if ${OPSYS} == "Darwin"
+USE_TOOLS+= perl
+.else
+CONFIGURE_ARGS+= --disable-opencl
+.endif
+MAKE_ENV+= SH=${SH:Q}
+
+# tries to use /usr/ucb/install to create multiple directories
+# PR pkg/56512
+MAKE_FLAGS.SunOS+= INSTALL=${INSTALL:Q}
+
+.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS]) || !empty(MACHINE_PLATFORM:MDarwin-*-aarch64)
+# XXX Consider passing this whether cross-compiling or not.
+CONFIGURE_ARGS+= --host=${MACHINE_GNU_PLATFORM}
+.endif
+
+BUILD_TARGET= default
+INSTALL_TARGET= install-lib-shared install-lib-static install-cli
+INSTALLATION_DIRS= bin
+REPLACE_SH= version.sh
+
+.include "../../mk/dlopen.buildlink3.mk"
+
+CHECK_BUILTIN.pthread:= yes
+.include "../../mk/pthread.builtin.mk"
+CHECK_BUILTIN.pthread:= no
+
+.if ${USE_BUILTIN.pthread:M[Yy][Ee][Ss]}
+X264_BUILD_THREADS_SUPPORT= yes
+.else
+X264_BUILD_THREADS_SUPPORT= ${DLOPEN_REQUIRE_PTHREADS}
+.endif
+
+.include "options.mk"
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/multimedia/x264/PLIST b/multimedia/x264/PLIST
new file mode 100644
index 00000000000..db9c6dd27db
--- /dev/null
+++ b/multimedia/x264/PLIST
@@ -0,0 +1,8 @@
+@comment $NetBSD: PLIST,v 1.1 2022/09/26 17:00:21 adam Exp $
+bin/x264
+include/x264.h
+include/x264_config.h
+lib/libx264.a
+lib/libx264.so
+lib/libx264.so.164
+lib/pkgconfig/x264.pc
diff --git a/multimedia/x264/buildlink3.mk b/multimedia/x264/buildlink3.mk
new file mode 100644
index 00000000000..2b40701de57
--- /dev/null
+++ b/multimedia/x264/buildlink3.mk
@@ -0,0 +1,23 @@
+# $NetBSD: buildlink3.mk,v 1.1 2022/09/26 17:00:21 adam Exp $
+
+BUILDLINK_TREE+= x264
+
+.if !defined(X264_BUILDLINK3_MK)
+X264_BUILDLINK3_MK:=
+
+# NOTE: When changing BUILDLINK_A[BP]I_DEPENDS.x264, please record
+# the value of X264_BUILD in x264.h along with the appropriate
+# dependency specification. Perhaps we should incorporate this
+# into the version number and/or pkg-config file?
+BUILDLINK_API_DEPENDS.x264+= x264>=20220601 # X264_BUILD 164
+BUILDLINK_ABI_DEPENDS.x264+= x264>=20220601
+BUILDLINK_PKGSRCDIR.x264?= ../../multimedia/x264
+pkgbase:= x264
+.include "../../mk/pkg-build-options.mk"
+
+.if ${PKG_BUILD_OPTIONS.x264:Mthreads}
+. include "../../mk/pthread.buildlink3.mk"
+.endif
+.endif # X264_BUILDLINK3_MK
+
+BUILDLINK_TREE+= -x264
diff --git a/multimedia/x264/distinfo b/multimedia/x264/distinfo
new file mode 100644
index 00000000000..3102dd063cd
--- /dev/null
+++ b/multimedia/x264/distinfo
@@ -0,0 +1,7 @@
+$NetBSD: distinfo,v 1.1 2022/09/26 17:00:21 adam Exp $
+
+BLAKE2s (x264-20220601.tar.bz2) = 2990b29a9425fc9ad246905ddad2a9c0e888919fb1c3fd28b96209af823a085a
+SHA512 (x264-20220601.tar.bz2) = 73b8be945a2a82ea7af5039f5baa816440292887c1cad2672556f699a9d80eb8fbc2d5e44826cb36fecbbe83e6e75095c9ccd352bd2cb128caff7d4d7ed84e81
+Size (x264-20220601.tar.bz2) = 777576 bytes
+SHA1 (patch-configure) = c986b2ad87f940bd2cf1a96f471bd497e075b872
+SHA1 (patch-encoder_analyse.c) = 2057583899e029a4c2173c511293e6a35cf80f78
diff --git a/multimedia/x264/options.mk b/multimedia/x264/options.mk
new file mode 100644
index 00000000000..0162454d312
--- /dev/null
+++ b/multimedia/x264/options.mk
@@ -0,0 +1,16 @@
+# $NetBSD: options.mk,v 1.1 2022/09/26 17:00:21 adam Exp $
+
+PKG_OPTIONS_VAR= PKG_OPTIONS.x264
+PKG_SUPPORTED_OPTIONS= threads
+
+.if !empty(X264_BUILD_THREADS_SUPPORT:M[Yy][Ee][Ss])
+PKG_SUGGESTED_OPTIONS+= threads
+.endif
+
+.include "../../mk/bsd.options.mk"
+
+.if !empty(PKG_OPTIONS:Mthreads)
+. include "../../mk/pthread.buildlink3.mk"
+.else
+CONFIGURE_ARGS+= --disable-pthread
+.endif
diff --git a/multimedia/x264/patches/patch-configure b/multimedia/x264/patches/patch-configure
new file mode 100644
index 00000000000..d3ce8601c3d
--- /dev/null
+++ b/multimedia/x264/patches/patch-configure
@@ -0,0 +1,135 @@
+$NetBSD: patch-configure,v 1.1 2022/09/26 17:00:21 adam Exp $
+
+Add support for DragonFly.
+Use 'amd64' as a synonym for 'x86_64'.
+Avoid endian test failure for -flto.
+Do not force compiler optimisations.
+If we fail an assembly test, continue as if --disable-asm
+was passed.
+
+--- configure.orig 2022-09-13 09:25:28.000000000 +0000
++++ configure
+@@ -664,6 +664,10 @@ case $host_os in
+ SYS="FREEBSD"
+ libm="-lm"
+ ;;
++ dragonfly*)
++ SYS="DRAGONFLY"
++ LDFLAGS="$LDFLAGS -lm"
++ ;;
+ kfreebsd*-gnu)
+ SYS="FREEBSD"
+ define HAVE_MALLOC_H
+@@ -764,7 +768,7 @@ case $host_cpu in
+ ASFLAGS="$ASFLAGS -f elf32"
+ fi
+ ;;
+- x86_64)
++ x86_64|amd64)
+ ARCH="X86_64"
+ AS="${AS-nasm}"
+ AS_EXT=".asm"
+@@ -793,14 +797,15 @@ case $host_cpu in
+ fi
+ ;;
+ powerpc*)
+- ARCH="PPC"
+ if [ $asm = auto ] ; then
+ define HAVE_ALTIVEC
+ AS="${AS-${CC}}"
+ AS_EXT=".c"
+ if [ $SYS = MACOSX ] ; then
++ ARCH="POWERPC"
+ CFLAGS="$CFLAGS -faltivec -fastf -mcpu=G4"
+ else
++ ARCH="PPC"
+ CFLAGS="$CFLAGS -maltivec -mabi=altivec"
+ define HAVE_ALTIVEC_H
+ fi
+@@ -839,6 +844,18 @@ case $host_cpu in
+ AS="${AS-${CC}}"
+ fi
+ ;;
++ aarch64|arm64*)
++ ARCH="AARCH64"
++ stack_alignment=16
++ if [ "$SYS" = MACOSX ] ; then
++ AS="${AS-${CC}}"
++ ASFLAGS="$ASFLAGS -DPREFIX -DPIC"
++ elif [ "$SYS" = WINDOWS ] && [ "$compiler" = CL ] ; then
++ AS="${AS-${SRCPATH}/tools/gas-preprocessor.pl -arch aarch64 -as-type armasm -- armasm64 -nologo}"
++ else
++ AS="${AS-${CC}}"
++ fi
++ ;;
+ arm*)
+ ARCH="ARM"
+ if [ "$SYS" = MACOSX ] ; then
+@@ -985,8 +1002,8 @@ if [ $asm = auto -a $ARCH = ARM ] ; then
+ ASFLAGS="$ASFLAGS -c"
+ else
+ echo "You specified a pre-ARMv6 or Thumb-1 CPU in your CFLAGS."
+- echo "If you really want to run on such a CPU, configure with --disable-asm."
+- exit 1
++ echo "Disabling asm"
++ asm="no"
+ fi
+ fi
+
+@@ -1000,8 +1017,8 @@ if [ $asm = auto -a $ARCH = AARCH64 ] ;
+ ASFLAGS="$ASFLAGS -c"
+ else
+ echo "no NEON support, try adding -mfpu=neon to CFLAGS"
+- echo "If you really want to run on such a CPU, configure with --disable-asm."
+- exit 1
++ echo "Disabling asm"
++ asm="no"
+ fi
+ fi
+
+@@ -1019,8 +1036,8 @@ if [ $asm = auto -a $ARCH = MIPS ] ; the
+ define HAVE_MSA
+ else
+ echo "You specified a pre-MSA CPU in your CFLAGS."
+- echo "If you really want to run on such a CPU, configure with --disable-asm."
+- exit 1
++ echo "Disabling asm"
++ asm="no"
+ fi
+ fi
+
+@@ -1037,7 +1054,7 @@ ASFLAGS="$ASFLAGS -DSTACK_ALIGNMENT=$sta
+ CPU_ENDIAN="little-endian"
+ if [ $compiler = GNU ]; then
+ echo "int i[2] = {0x42494745,0}; double f[2] = {0x1.0656e6469616ep+102,0};" > conftest.c
+- $CC $CFLAGS -fno-lto conftest.c -c -o conftest.o 2>/dev/null || die "endian test failed"
++ $CC $CPPFLAGS -fno-lto conftest.c -c -o conftest.o 2>/dev/null || die "endian test failed"
+ if (${STRINGS} -a conftest.o | grep -q BIGE) && (${STRINGS} -a conftest.o | grep -q FPendian) ; then
+ define WORDS_BIGENDIAN
+ CPU_ENDIAN="big-endian"
+@@ -1060,7 +1077,7 @@ fi
+
+ # autodetect options that weren't forced nor disabled
+
+-libpthread=""
++libpthread="$PTHREAD_LDFLAGS $PTHREAD_LIBS"
+ if [ "$SYS" = "WINDOWS" -a "$thread" = "posix" ] ; then
+ if [ "$gpl" = "no" ] ; then
+ echo "Warning: pthread-win32 is LGPL and is therefore not supported with --disable-gpl"
+@@ -1319,7 +1336,7 @@ if [ "$pic" = "yes" ] ; then
+ [ "$SYS" != WINDOWS -a "$SYS" != CYGWIN ] && CFLAGS="$CFLAGS -fPIC"
+ [[ "$ASFLAGS" != *"-DPIC"* ]] && ASFLAGS="$ASFLAGS -DPIC"
+ # resolve textrels in the x86 asm
+- cc_check stdio.h "-shared -Wl,-Bsymbolic" && SOFLAGS="$SOFLAGS -Wl,-Bsymbolic"
++ cc_check stdio.h "-Wl,-Bsymbolic" && LDFLAGS="$LDFLAGS -Wl,-Bsymbolic"
+ [ $SYS = SunOS -a "$ARCH" = "X86" ] && SOFLAGS="$SOFLAGS -mimpure-text"
+ fi
+
+@@ -1335,7 +1352,6 @@ if [ "$debug" = "yes" ]; then
+ CFLAGS="-O1 -g $CFLAGS"
+ RCFLAGS="$RCFLAGS -DDEBUG"
+ else
+- CFLAGS="-O3 -ffast-math $CFLAGS"
+ if [ "$lto" = "auto" ] && [ $compiler = GNU ] && cc_check "" "-flto" ; then
+ lto="yes"
+ CFLAGS="$CFLAGS -flto"
diff --git a/multimedia/x264/patches/patch-encoder_analyse.c b/multimedia/x264/patches/patch-encoder_analyse.c
new file mode 100644
index 00000000000..54cbac2d417
--- /dev/null
+++ b/multimedia/x264/patches/patch-encoder_analyse.c
@@ -0,0 +1,15 @@
+$NetBSD: patch-encoder_analyse.c,v 1.1 2022/09/26 17:00:21 adam Exp $
+
+Use logf() instead of log2f.
+
+--- encoder/analyse.c.orig 2017-07-12 20:45:03.000000000 +0000
++++ encoder/analyse.c
+@@ -309,7 +309,7 @@ int x264_analyse_init_costs( x264_t *h )
+
+ logs[0] = 0.718f;
+ for( int i = 1; i <= 2*4*mv_range; i++ )
+- logs[i] = log2f( i+1 ) * 2.0f + 1.718f;
++ logs[i] = logf(i+1)*2.88539f + 1.718f;
+
+ for( int qp = X264_MIN( h->param.rc.i_qp_min, QP_MAX_SPEC ); qp <= h->param.rc.i_qp_max; qp++ )
+ if( init_costs( h, logs, qp ) )