summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2015-07-07 02:30:25 -0400
committerMark H Weaver <mhw@netris.org>2015-07-07 10:52:04 -0400
commit23da88f61e82e2b32d6dedb3af467f665cd03bf5 (patch)
treedc58ab24ba57f3b7cfae50639e80a5a2f9ba5d21
parent4ca5c91f65bdc5a90e30991d2cc346667b54ceee (diff)
downloadguix-23da88f61e82e2b32d6dedb3af467f665cd03bf5.tar.gz
gnu: liba52: Build shared library.
* gnu/packages/patches/liba52-enable-pic.patch,
  gnu/packages/patches/liba52-link-with-libm.patch,
  gnu/packages/patches/liba52-set-soname.patch,
  gnu/packages/patches/liba52-use-mtune-not-mcpu.patch: New files.
* gnu-system.am (dist_patch_DATA): Add them.
* gnu/packages/video.scm (liba52)[source]: Add patches.
  [native-inputs]: Add autoconf, automake, and libtool.
  [arguments]: Add "--enable-shared" to configure-flags.
  Add 'bootstrap' phase.
-rw-r--r--gnu-system.am4
-rw-r--r--gnu/packages/patches/liba52-enable-pic.patch25
-rw-r--r--gnu/packages/patches/liba52-link-with-libm.patch33
-rw-r--r--gnu/packages/patches/liba52-set-soname.patch23
-rw-r--r--gnu/packages/patches/liba52-use-mtune-not-mcpu.patch24
-rw-r--r--gnu/packages/video.scm23
6 files changed, 129 insertions, 3 deletions
diff --git a/gnu-system.am b/gnu-system.am
index 71c238b564..11ae3e630c 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -486,6 +486,10 @@ dist_patch_DATA =						\
   gnu/packages/patches/jbig2dec-ignore-testtest.patch		\
   gnu/packages/patches/kmod-module-directory.patch		\
   gnu/packages/patches/lftp-dont-save-unknown-host-fingerprint.patch \
+  gnu/packages/patches/liba52-enable-pic.patch			\
+  gnu/packages/patches/liba52-link-with-libm.patch		\
+  gnu/packages/patches/liba52-set-soname.patch			\
+  gnu/packages/patches/liba52-use-mtune-not-mcpu.patch		\
   gnu/packages/patches/libarchive-CVE-2013-0211.patch		\
   gnu/packages/patches/libarchive-fix-lzo-test-case.patch	\
   gnu/packages/patches/libarchive-mtree-filename-length-fix.patch \
diff --git a/gnu/packages/patches/liba52-enable-pic.patch b/gnu/packages/patches/liba52-enable-pic.patch
new file mode 100644
index 0000000000..924ac1331f
--- /dev/null
+++ b/gnu/packages/patches/liba52-enable-pic.patch
@@ -0,0 +1,25 @@
+Copied from Debian.
+
+Description: Disabling -prefer-non-pic which enables -fPIC
+Bug-Debian: http://bugs.debian.org/401590
+Author: Daniel Baumann <daniel@debian.org>, Dmitrijs Ledkovs <dmitrij.ledkov@gmail.com>
+
+
+---
+ liba52/configure.incl |    3 ---
+ 1 files changed, 0 insertions(+), 3 deletions(-)
+
+Index: a52dec-deb/liba52/configure.incl
+===================================================================
+--- a52dec-deb.orig/liba52/configure.incl	2009-12-05 02:52:12.000000000 +0000
++++ a52dec-deb/liba52/configure.incl	2009-12-05 03:23:45.000000000 +0000
+@@ -1,9 +1,6 @@
+ AC_SUBST([LIBA52_CFLAGS])
+ AC_SUBST([LIBA52_LIBS])
+ 
+-dnl avoid -fPIC when possible
+-LIBA52_CFLAGS="$LIBA52_CFLAGS -prefer-non-pic"
+-
+ AC_ARG_ENABLE([double],
+     [  --enable-double         use double-precision samples])
+ if test x"$enable_double" = x"yes"; then
diff --git a/gnu/packages/patches/liba52-link-with-libm.patch b/gnu/packages/patches/liba52-link-with-libm.patch
new file mode 100644
index 0000000000..a0771aaa62
--- /dev/null
+++ b/gnu/packages/patches/liba52-link-with-libm.patch
@@ -0,0 +1,33 @@
+Copied from Debian.
+
+Description: Explicitely link against -lm
+Bug-Debian: http://bugs.debian.org/553595
+Author: Fabian Greffrath <fabian@debian-unofficial.org>, Dmitrijs Ledkovs <dmitrij.ledkov@gmail.com>
+
+---
+ libao/Makefile.am |    1 +
+ src/Makefile.am   |    2 +-
+ 2 files changed, 2 insertions(+), 1 deletions(-)
+
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -1,9 +1,9 @@
+-CFLAGS = @A52DEC_CFLAGS@
++AM_CFLAGS = @A52DEC_CFLAGS@
+ 
+ bin_PROGRAMS = a52dec extract_a52
+ a52dec_SOURCES = a52dec.c getopt.c gettimeofday.c
+ a52dec_LDADD = $(top_builddir)/liba52/liba52.la \
+-	       $(top_builddir)/libao/libao.a @LIBAO_LIBS@
++	       $(top_builddir)/libao/libao.a @LIBAO_LIBS@ -lm
+ extract_a52_SOURCES = extract_a52.c getopt.c
+ 
+ man_MANS = a52dec.1 extract_a52.1
+--- a/liba52/Makefile.am
++++ b/liba52/Makefile.am
+@@ -1,4 +1,4 @@
+-CFLAGS = @CFLAGS@ @LIBA52_CFLAGS@
++AM_CFLAGS = @CFLAGS@ @LIBA52_CFLAGS@
+ 
+ lib_LTLIBRARIES = liba52.la
+ 
diff --git a/gnu/packages/patches/liba52-set-soname.patch b/gnu/packages/patches/liba52-set-soname.patch
new file mode 100644
index 0000000000..3eba1fb038
--- /dev/null
+++ b/gnu/packages/patches/liba52-set-soname.patch
@@ -0,0 +1,23 @@
+Copied from Debian.
+
+Description: Sets the soname to liba52-$(VERSION).so
+Bug-Debian: http://bugs.debian.org/401636
+Author: Daniel Baumann <daniel@debian.org>, Dmitrijs Ledkovs <dmitrij.ledkov@gmail.com>
+
+
+---
+ liba52/Makefile.am |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+Index: a52dec-deb/liba52/Makefile.am
+===================================================================
+--- a52dec-deb.orig/liba52/Makefile.am	2009-12-05 02:52:12.000000000 +0000
++++ a52dec-deb/liba52/Makefile.am	2009-12-05 03:23:47.000000000 +0000
+@@ -4,6 +4,6 @@
+ 
+ liba52_la_SOURCES = bitstream.c imdct.c bit_allocate.c parse.c downmix.c
+ liba52_la_LIBADD = @LIBA52_LIBS@ -lm
+-liba52_la_LDFLAGS = -no-undefined
++liba52_la_LDFLAGS = -no-undefined -release @VERSION@
+ 
+ EXTRA_DIST = configure.incl a52_internal.h bitstream.h tables.h
diff --git a/gnu/packages/patches/liba52-use-mtune-not-mcpu.patch b/gnu/packages/patches/liba52-use-mtune-not-mcpu.patch
new file mode 100644
index 0000000000..d78ecbbab0
--- /dev/null
+++ b/gnu/packages/patches/liba52-use-mtune-not-mcpu.patch
@@ -0,0 +1,24 @@
+Copied from Debian.
+
+From: Rodeo
+Origin: https://github.com/HandBrake/HandBrake/blob/master/contrib/a52dec/A04-modern-gcc-cflags.patch
+
+--- a52dec-0.7.4/configure.in.orig
++++ a52dec-0.7.4/configure.in
+@@ -34,11 +34,11 @@
+     case "$host" in
+     i?86-* | k?-*)
+ 	case "$host" in
+-	i386-*) OPT_CFLAGS="$CFLAGS -mcpu=i386";;
+-	i486-*) OPT_CFLAGS="$CFLAGS -mcpu=i486";;
+-	i586-*) OPT_CFLAGS="$CFLAGS -mcpu=pentium";;
+-	i686-*) OPT_CFLAGS="$CFLAGS -mcpu=pentiumpro";;
+-	k6-*)   OPT_CFLAGS="$CFLAGS -mcpu=k6";;
++	i386-*) OPT_CFLAGS="$CFLAGS -mtune=i386";;
++	i486-*) OPT_CFLAGS="$CFLAGS -mtune=i486";;
++	i586-*) OPT_CFLAGS="$CFLAGS -mtune=pentium";;
++	i686-*) OPT_CFLAGS="$CFLAGS -mtune=pentiumpro";;
++	k6-*)   OPT_CFLAGS="$CFLAGS -mtune=k6";;
+ 	esac
+ 	AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS]);;
+     sparc-* | sparc64-*)
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 0c2c7d47a2..259e858e7d 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -128,15 +128,32 @@ old-fashioned output methods with powerful ascii-art renderer.")
                     ".tar.gz"))
               (sha256
                (base32
-                "0czccp4fcpf2ykp16xcrzdfmnircz1ynhls334q374xknd5747d2"))))
+                "0czccp4fcpf2ykp16xcrzdfmnircz1ynhls334q374xknd5747d2"))
+              (patches (map search-patch '("liba52-enable-pic.patch"
+                                           "liba52-set-soname.patch"
+                                           "liba52-use-mtune-not-mcpu.patch"
+                                           "liba52-link-with-libm.patch")))))
     (build-system gnu-build-system)
+    ;; XXX We need to run ./bootstrap because of the build system fixes above.
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)))
     (arguments `(#:configure-flags
-                 '(;; FIXME: liba52-0.7.4's config.guess fails on mips64el.
+                 '("--enable-shared"
+                   ;; FIXME: liba52-0.7.4's config.guess fails on mips64el.
                    ,@(if (%current-target-system)
                          '()
                          (let ((triplet
                                 (nix-system->gnu-triplet (%current-system))))
-                           (list (string-append "--build=" triplet)))))))
+                           (list (string-append "--build=" triplet)))))
+                 #:phases
+                 (modify-phases %standard-phases
+                   ;; XXX We need to run ./bootstrap because of the build
+                   ;; system fixes above.
+                   (add-after
+                    'unpack 'bootstrap
+                    (lambda _ (zero? (system* "sh" "bootstrap")))))))
     (home-page "http://liba52.sourceforge.net/")
     (synopsis "ATSC A/52 stream decoder")
     (description "liba52 is a library for decoding ATSC A/52 streams.  The