summaryrefslogtreecommitdiff
path: root/user/libtheora
diff options
context:
space:
mode:
Diffstat (limited to 'user/libtheora')
-rw-r--r--user/libtheora/APKBUILD75
-rw-r--r--user/libtheora/automake.patch11
-rw-r--r--user/libtheora/enc.patch11
-rw-r--r--user/libtheora/fix-mmx.patch31
-rw-r--r--user/libtheora/fix-timeb.patch75
-rw-r--r--user/libtheora/libtheora-flags.patch14
6 files changed, 217 insertions, 0 deletions
diff --git a/user/libtheora/APKBUILD b/user/libtheora/APKBUILD
new file mode 100644
index 000000000..a1e1e1948
--- /dev/null
+++ b/user/libtheora/APKBUILD
@@ -0,0 +1,75 @@
+# Maintainer:
+pkgname=libtheora
+pkgver=1.1.1
+pkgrel=14
+pkgdesc="An open video codec developed by the Xiph.org"
+url="https://www.theora.org/"
+arch="all"
+license="BSD-3-Clause"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-examples"
+depends_dev="libogg-dev"
+makedepends="libvorbis-dev libogg-dev sdl-dev autoconf automake libtool
+ linux-headers"
+source="http://downloads.xiph.org/releases/theora/$pkgname-$pkgver.tar.bz2
+ libtheora-flags.patch
+ enc.patch
+ fix-timeb.patch
+ fix-mmx.patch
+ automake.patch
+ "
+
+prepare() {
+ default_prepare
+ cd "$builddir"
+
+ sed -i 's/png_\(sizeof\)/\1/g' examples/png2theora.c
+
+ libtoolize --force
+ aclocal -I m4
+ autoconf --force
+ automake --force --add-missing
+}
+
+build() {
+ cd "$builddir"
+
+ CFLAGS="${CFLAGS/-Os/-O3}" CPPFLAGS="${CPPFLAGS/-Os/-O3}" ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --enable-shared \
+ --enable-static
+ make -C lib
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+
+ make -j1 DESTDIR="$pkgdir" install
+
+ install -m755 -d "$pkgdir"/usr/share/licenses/$pkgname
+ install -m644 LICENSE COPYING "$pkgdir"/usr/share/licenses/$pkgname/
+}
+
+examples() {
+ pkgdesc="Example applications for libtheora"
+
+ cd "$builddir"/examples/.libs
+
+ install -d "$subpkgdir"/usr/bin
+ install -m755 dump_psnr player_example dump_video encoder_example \
+ "$subpkgdir"/usr/bin/
+}
+
+sha512sums="9ab9b3af1c35d16a7d6d84f61f59ef3180132e30c27bdd7c0fa2683e0d00e2c791accbc7fd2c90718cc947d8bd10ee4a5940fb55f90f1fd7b0ed30583a47dbbd libtheora-1.1.1.tar.bz2
+72916c4ed0f9609b84af7c72b35b558ecfb2ed7533739e170ed088e06d0e82a585dcc1185f3c5a5d0644d30901459813b635df2ba951e2290bcd4303cfebc20b libtheora-flags.patch
+569132fd0a576abb26b3c28fe84c4c2c66ff871129f00bfb23e593b8f985e47d61bc910d383aa3fc7477cc9de21e86f8df412901c609a62da972410733ec41f2 enc.patch
+985dd5f5f3afcb36d71a636082c6e09ec18bb9e442b552babc4706299f502b90e79fb4aacb50a43c5e87a0b8429b311bcfeb21027f6cdca6fdb81e76b491dfff fix-timeb.patch
+f86b15fe5b1029c1e82b8f3785cbd6c81dd5e17dc6c8e4052de3c55482be3948d53828930df864a4668078c5cbab38b1d06b5807563f5fa342da1d084ce924b2 fix-mmx.patch
+d72648de058d42ed85d9870596d8c42148f9bcf5b08e2a333c279e1516f4bfa6535566cda807abb06ae58bfb1e373909148cb5c10aad6f56879d9c8452f2cc4f automake.patch"
diff --git a/user/libtheora/automake.patch b/user/libtheora/automake.patch
new file mode 100644
index 000000000..f00497058
--- /dev/null
+++ b/user/libtheora/automake.patch
@@ -0,0 +1,11 @@
+--- ./configure.ac.orig 2012-12-31 20:15:29.384600257 +0000
++++ ./configure.ac 2012-12-31 20:15:38.461347599 +0000
+@@ -9,7 +9,7 @@
+ AC_CANONICAL_HOST
+ AC_CANONICAL_TARGET
+
+-AM_CONFIG_HEADER([config.h])
++AC_CONFIG_HEADER([config.h])
+ AC_CONFIG_SRCDIR([lib/fdct.c])
+ AM_INIT_AUTOMAKE
+ AM_MAINTAINER_MODE
diff --git a/user/libtheora/enc.patch b/user/libtheora/enc.patch
new file mode 100644
index 000000000..ea604d28e
--- /dev/null
+++ b/user/libtheora/enc.patch
@@ -0,0 +1,11 @@
+--- ./lib/Makefile.am.orig
++++ ./lib/Makefile.am
+@@ -152,7 +154,7 @@
+ Version_script-enc theoraenc.exp
+ libtheoraenc_la_LDFLAGS = \
+ -version-info @THENC_LIB_CURRENT@:@THENC_LIB_REVISION@:@THENC_LIB_AGE@ \
+- @THEORAENC_LDFLAGS@ $(OGG_LIBS)
++ -ltheoradec @THEORAENC_LDFLAGS@ $(OGG_LIBS)
+
+ libtheora_la_SOURCES = \
+ $(decoder_sources) \
diff --git a/user/libtheora/fix-mmx.patch b/user/libtheora/fix-mmx.patch
new file mode 100644
index 000000000..63fb9f76e
--- /dev/null
+++ b/user/libtheora/fix-mmx.patch
@@ -0,0 +1,31 @@
+http://bugs.alpinelinux.org/issues/6132
+https://trac.xiph.org/ticket/2287
+
+patch rebased for libtheory 1.1.1 stable
+
+diff -ru libtheora-1.1.1.orig/lib/encode.c libtheora-1.1.1/lib/encode.c
+--- libtheora-1.1.1.orig/lib/encode.c 2009-08-22 18:14:04.000000000 +0000
++++ libtheora-1.1.1/lib/encode.c 2016-09-15 05:27:02.065785527 +0000
+@@ -864,6 +864,9 @@
+ }
+
+ static void oc_enc_frame_pack(oc_enc_ctx *_enc){
++ /*musl libc malloc()/realloc() calls might use floating point, so make sure
++ we've cleared the MMX state for them.*/
++ oc_restore_fpu(&_enc->state);
+ oggpackB_reset(&_enc->opb);
+ /*Only proceed if we have some coded blocks.
+ If there are no coded blocks, we can drop this frame simply by emitting a
+diff -ru libtheora-1.1.1.orig/lib/decode.c libtheora-1.1.1/lib/decode.c
+--- libtheora-1.1.1.orig/lib/decode.c 2009-09-26 20:55:21.000000000 +0000
++++ libtheora-1.1.1/lib/decode.c 2016-09-15 05:29:45.912196850 +0000
+@@ -1181,6 +1181,9 @@
+
+
+ static int oc_dec_postprocess_init(oc_dec_ctx *_dec){
++ /*musl libc malloc()/realloc() calls might use floating point, so make sure
++ we've cleared the MMX state for them.*/
++ oc_restore_fpu(&_dec->state);
+ /*pp_level 0: disabled; free any memory used and return*/
+ if(_dec->pp_level<=OC_PP_LEVEL_DISABLED){
+ if(_dec->dc_qis!=NULL){
diff --git a/user/libtheora/fix-timeb.patch b/user/libtheora/fix-timeb.patch
new file mode 100644
index 000000000..5344c0757
--- /dev/null
+++ b/user/libtheora/fix-timeb.patch
@@ -0,0 +1,75 @@
+--- libtheora-1.1.1.orig/examples/dump_psnr.c
++++ libtheora-1.1.1/examples/dump_psnr.c
+@@ -37,7 +37,6 @@
+ #endif
+ #include <stdlib.h>
+ #include <string.h>
+-#include <sys/timeb.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ /*Yes, yes, we're going to hell.*/
+--- libtheora-1.1.1.orig/examples/dump_video.c
++++ libtheora-1.1.1/examples/dump_video.c
+@@ -37,7 +37,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <sys/timeb.h>
++#include <sys/time.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ /*Yes, yes, we're going to hell.*/
+@@ -205,9 +205,9 @@
+ int long_option_index;
+ int c;
+
+- struct timeb start;
+- struct timeb after;
+- struct timeb last;
++ struct timeval start;
++ struct timeval after;
++ struct timeval last;
+ int fps_only=0;
+ int frames = 0;
+
+@@ -418,8 +418,8 @@
+ }
+
+ if(fps_only){
+- ftime(&start);
+- ftime(&last);
++ gettimeofday(&start, NULL);
++ gettimeofday(&last, NULL);
+ }
+
+ while(!got_sigint){
+@@ -433,7 +433,7 @@
+ videobuf_ready=1;
+ frames++;
+ if(fps_only)
+- ftime(&after);
++ gettimeofday(&after, NULL);
+ }
+
+ }else
+@@ -442,16 +442,16 @@
+
+ if(fps_only && (videobuf_ready || fps_only==2)){
+ long ms =
+- after.time*1000.+after.millitm-
+- (last.time*1000.+last.millitm);
++ after.tv_sec*1000.+after.tv_usec/1000-
++ (last.tv_sec*1000.+last.tv_usec/1000);
+
+ if(ms>500 || fps_only==1 ||
+ (feof(infile) && !videobuf_ready)){
+ float file_fps = (float)ti.fps_numerator/ti.fps_denominator;
+ fps_only=2;
+
+- ms = after.time*1000.+after.millitm-
+- (start.time*1000.+start.millitm);
++ ms = after.tv_sec*1000.+after.tv_usec/1000-
++ (start.tv_sec*1000.+start.tv_usec/1000);
+
+ fprintf(stderr,"\rframe:%d rate:%.2fx ",
+ frames,
diff --git a/user/libtheora/libtheora-flags.patch b/user/libtheora/libtheora-flags.patch
new file mode 100644
index 000000000..a47cc5771
--- /dev/null
+++ b/user/libtheora/libtheora-flags.patch
@@ -0,0 +1,14 @@
+diff -ur libtheora-1.0beta2.orig/configure.ac libtheora-1.0beta2/configure.ac
+--- libtheora-1.0beta2.orig/configure.ac 2007-10-13 00:01:38.000000000 +0300
++++ libtheora-1.0beta2/configure.ac 2007-11-25 22:44:49.000000000 +0200
+@@ -102,8 +102,8 @@
+ case $host in
+ *)
+ DEBUG="-g -Wall -Wno-parentheses -DDEBUG -D__NO_MATH_INLINES"
+- CFLAGS="-Wall -Wno-parentheses -O3 -fforce-addr -fomit-frame-pointer -finline-functions -funroll-loops"
+- PROFILE="-Wall -Wno-parentheses -pg -g -O3 -fno-inline-functions -DDEBUG";;
++ CFLAGS="-Wall -Wno-parentheses"
++ PROFILE="-Wall -Wno-parentheses -pg -g -fno-inline-functions -DDEBUG";;
+ esac
+ fi
+ CFLAGS="$CFLAGS $cflags_save"