Package: getstream
Version: 20081204-1
Severity: important
Tags: patch
User: [email protected]
Usertags: origin-ubuntu ubuntu-patch oneiric

getstream fails to build with a linker that defaults to --as-needed, as
shown in this Ubuntu bug report:

  https://bugs.launchpad.net/ubuntu/+source/getstream/+bug/770901

This is because its link line order is wrong, putting libraries before
the objects that use them rather than after.  See:

  http://wiki.debian.org/ToolChain/DSOLinking#Only_link_with_needed_libraries

The following patch fixes this.  Note that this applies on top of the
patch in #622278.

  * Fix link order to allow building with 'ld --as-needed'
    (LP: #706912, #770901).

diff -u getstream-20081204/Makefile getstream-20081204/Makefile
--- getstream-20081204/Makefile
+++ getstream-20081204/Makefile
@@ -1,6 +1,6 @@
 CC=gcc
 CFLAGS=-O0 -g -Wall  -I. $(shell pkg-config --cflags glib-2.0)
-LDFLAGS=-levent $(shell pkg-config --libs glib-2.0) -lpthread
+LDLIBS=-levent $(shell pkg-config --libs glib-2.0) -lpthread
 OBJ-getstream=getstream.o fe.o crc32.o \
        libhttp.o libconf.o config.o util.o logging.o \
        stream.o input.o \
@@ -15,10 +15,10 @@
 all: getstream tsdecode
 
 tsdecode: $(OBJ-tsdecode)
-       gcc $(LDFLAGS) -o $@ $+
+       gcc -o $@ $+ $(LDLIBS)
 
 getstream: $(OBJ-getstream)
-       gcc $(LDFLAGS) -o $@ $+
+       gcc -o $@ $+ $(LDLIBS)
 
 clean:
        -rm -f $(OBJ-getstream) $(OBJ-tsdecode)
diff -u getstream-20081204/patch-stamp getstream-20081204/patch-stamp
--- getstream-20081204/patch-stamp
+++ getstream-20081204/patch-stamp
@@ -9,0 +10,3 @@
+debian/patches/as-needed.dpatch (Colin Watson <[email protected]>):
+  Fix link order to allow building with 'ld --as-needed'.
+
diff -u getstream-20081204/debian/patches/00list 
getstream-20081204/debian/patches/00list
--- getstream-20081204/debian/patches/00list
+++ getstream-20081204/debian/patches/00list
@@ -2,0 +3 @@
+as-needed
only in patch2:
unchanged:
--- getstream-20081204.orig/debian/patches/as-needed.dpatch
+++ getstream-20081204/debian/patches/as-needed.dpatch
@@ -0,0 +1,31 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## as-needed.dpatch by Colin Watson <[email protected]>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Fix link order to allow building with 'ld --as-needed'.
+
+@DPATCH@
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' 
'--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' 
getstream-20081204~/Makefile getstream-20081204/Makefile
+--- getstream-20081204~/Makefile       2011-08-19 18:10:03.000000000 +0100
++++ getstream-20081204/Makefile        2011-08-19 18:11:25.000000000 +0100
+@@ -1,6 +1,6 @@
+ CC=gcc
+ CFLAGS=-O0 -g -Wall  -I. $(shell pkg-config --cflags glib-2.0)
+-LDFLAGS=-levent $(shell pkg-config --libs glib-2.0) -lpthread
++LDLIBS=-levent $(shell pkg-config --libs glib-2.0) -lpthread
+ OBJ-getstream=getstream.o fe.o crc32.o \
+       libhttp.o libconf.o config.o util.o logging.o \
+       stream.o input.o \
+@@ -15,10 +15,10 @@
+ all: getstream tsdecode
+ 
+ tsdecode: $(OBJ-tsdecode)
+-      gcc $(LDFLAGS) -o $@ $+
++      gcc -o $@ $+ $(LDLIBS)
+ 
+ getstream: $(OBJ-getstream)
+-      gcc $(LDFLAGS) -o $@ $+
++      gcc -o $@ $+ $(LDLIBS)
+ 
+ clean:
+       -rm -f $(OBJ-getstream) $(OBJ-tsdecode)
only in patch2:
unchanged:
--- getstream-20081204.orig/debian/patched/as-needed.dpatch
+++ getstream-20081204/debian/patched/as-needed.dpatch
@@ -0,0 +1 @@
+patching file Makefile

-- 
Colin Watson                                       [[email protected]]



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to