- Fix WANTLIB for archs building with GCC

- Enable the multi resolution encoder
- Fix the build on PowerPC
- Add a use-after-free fix

from Brad (maintainer)
This commit is contained in:
ajacoutot 2018-10-17 08:22:29 +00:00
parent aebe7409b2
commit 3d636b1978
5 changed files with 89 additions and 7 deletions

View File

@ -1,9 +1,10 @@
# $OpenBSD: Makefile,v 1.36 2018/09/26 07:14:28 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.37 2018/10/17 08:22:29 ajacoutot Exp $
COMMENT= Google VP8/VP9 video codec
VER= 1.7.0
CATEGORIES= multimedia
REVISION= 0
EPOCH= 0
GH_ACCOUNT= webmproject
GH_PROJECT= libvpx
@ -18,7 +19,7 @@ MAINTAINER= Brad Smith <brad@comstyle.com>
# BSD
PERMIT_PACKAGE_CDROM= Yes
WANTLIB= c m pthread ${LIBCXX}
WANTLIB= c m pthread ${COMPILER_LIBCXX}
# XXX requires __atomic builtins
COMPILER = base-clang ports-gcc
@ -32,6 +33,8 @@ MAKE_FLAGS= LIBVPX_VERSION=${LIBvpx_VERSION} verbose=yes
USE_GMAKE= Yes
CONFIGURE_STYLE= simple
CONFIGURE_ARGS+=--enable-shared \
--enable-multi-res-encoding \
--enable-runtime-cpu-detect \
--prefix=${PREFIX} \
--disable-optimizations \
--disable-unit-tests

View File

@ -1,16 +1,19 @@
$OpenBSD: patch-configure,v 1.16 2018/09/26 07:14:28 ajacoutot Exp $
$OpenBSD: patch-configure,v 1.17 2018/10/17 08:22:29 ajacoutot Exp $
Index: configure
--- configure.orig
+++ configure
@@ -116,6 +116,7 @@ all_platforms="${all_platforms} mips32-linux-gcc"
@@ -114,8 +114,10 @@ all_platforms="${all_platforms} armv7s-darwin-gcc"
all_platforms="${all_platforms} armv8-linux-gcc"
all_platforms="${all_platforms} mips32-linux-gcc"
all_platforms="${all_platforms} mips64-linux-gcc"
+all_platforms="${all_platforms} ppc-linux-gcc"
all_platforms="${all_platforms} ppc64-linux-gcc"
all_platforms="${all_platforms} ppc64le-linux-gcc"
+all_platforms="${all_platforms} sparc-linux-gcc"
all_platforms="${all_platforms} sparc-solaris-gcc"
all_platforms="${all_platforms} x86-android-gcc"
all_platforms="${all_platforms} x86-darwin8-gcc"
@@ -170,7 +171,7 @@ for t in ${all_targets}; do
@@ -170,7 +172,7 @@ for t in ${all_targets}; do
[ -f "${source_path}/${t}.mk" ] && enable_feature ${t}
done
@ -19,7 +22,7 @@ Index: configure
die "diff missing: Try installing diffutils via your package manager."
fi
@@ -185,19 +186,6 @@ if [ "`cd \"${source_path}\" && pwd`" != "`pwd`" ]; th
@@ -185,19 +187,6 @@ if [ "`cd \"${source_path}\" && pwd`" != "`pwd`" ]; th
fi
fi
@ -39,7 +42,7 @@ Index: configure
# disable codecs when their source directory does not exist
[ -d "${source_path}/vp8" ] || disable_codec vp8
[ -d "${source_path}/vp9" ] || disable_codec vp9
@@ -518,7 +506,7 @@ process_detect() {
@@ -518,7 +507,7 @@ process_detect() {
# here rather than at option parse time because the target auto-detect
# magic happens after the command line has been parsed.
case "${tgt_os}" in

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-vp8_common_postproc_c,v 1.1 2018/10/17 08:22:29 ajacoutot Exp $
Use-after-free fix.
Index: vp8/common/postproc.c
--- vp8/common/postproc.c.orig
+++ vp8/common/postproc.c
@@ -65,7 +65,7 @@ void vp8_deblock(VP8_COMMON *cm, YV12_BUFFER_CONFIG *s
double level = 6.0e-05 * q * q * q - .0067 * q * q + .306 * q + .0065;
int ppl = (int)(level + .5);
- const MODE_INFO *mode_info_context = cm->show_frame_mi;
+ const MODE_INFO *mode_info_context = cm->mi;
int mbr, mbc;
/* The pixel thresholds are adjusted according to if or not the macroblock

View File

@ -0,0 +1,27 @@
$OpenBSD: patch-vpx_ports_arm_cpudetect_c,v 1.1 2018/10/17 08:22:29 ajacoutot Exp $
Allow ARM CPU runtime detection code to build on OpenBSD.
Index: vpx_ports/arm_cpudetect.c
--- vpx_ports/arm_cpudetect.c.orig
+++ vpx_ports/arm_cpudetect.c
@@ -147,6 +147,19 @@ int arm_cpu_caps(void) {
}
return flags & mask;
}
+#elif defined(__OpenBSD__)
+int arm_cpu_caps(void) {
+ int flags;
+ int mask;
+ if (!arm_cpu_env_flags(&flags)) {
+ return flags;
+ }
+ mask = arm_cpu_env_mask();
+#if HAVE_NEON || HAVE_NEON_ASM
+ flags |= HAS_NEON;
+#endif /* HAVE_NEON || HAVE_NEON_ASM */
+ return flags & mask;
+}
#else /* end __linux__ */
#error \
"--enable-runtime-cpu-detect selected, but no CPU detection method " \

View File

@ -0,0 +1,33 @@
$OpenBSD: patch-vpx_ports_ppc_cpudetect_c,v 1.1 2018/10/17 08:22:29 ajacoutot Exp $
Allow PowerPC CPU runtime detection code to build on OpenBSD.
Index: vpx_ports/ppc_cpudetect.c
--- vpx_ports/ppc_cpudetect.c.orig
+++ vpx_ports/ppc_cpudetect.c
@@ -8,16 +8,19 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#if defined(__linux__)
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
#include <asm/cputable.h>
#include <linux/auxvec.h>
+#endif
#include "./vpx_config.h"
#include "vpx_ports/ppc.h"
#if CONFIG_RUNTIME_CPU_DETECT
+#if defined(__linux__)
static int cpu_env_flags(int *flags) {
char *env;
env = getenv("VPX_SIMD_CAPS");
@@ -77,4 +80,5 @@ out_close:
// If there is no RTCD the function pointers are not used and can not be
// changed.
int ppc_simd_caps(void) { return 0; }
+#endif
#endif // CONFIG_RUNTIME_CPU_DETECT