Package: tickr
Version: 0.5.3-1
Severity: wishlist
User: debian-...@lists.debian.org
Usertags: ld-as-needed
Tags: patch

tickr fails to build with ld --as-needed.
With --as-needed libraries need to be placed before objects needing
their symbols.
In autotools this archieved by placing the libraries into the LIBS or LDADD 
variable.
The makefile of tickr wrongly placed them in LDFLAGS.

See the ubuntu buildlog for the failure:
https://launchpadlibrarian.net/83193352/buildlog_ubuntu-precise-i386.tickr_0.5.3-1_FAILEDTOBUILD.txt.gz

The way upstreams autotools file determin the flags is incorrect.
It uses shell backtick expansions which are not allowed in LDADD.
The correct way is to use the PKG_CHECK_MODULES autoconf macro.
The attached patch does that, but it won't work in the package because
the autotools files are not regenerated.
Please consider regenerating the files in the package or apply a similar
patch to Makefile.in.
Description: correct the determination of buildflags
 libraries must go into the LDADD variable to build correctly
 with ld --as-needed.
 To do this the flags must be determined in configure.ac via
 the pkg-config macros
Author: Julian Taylor <jtaylor.deb...@googlemail.com>
--- tickr-0.5.3.orig/configure.ac
+++ tickr-0.5.3/configure.ac
@@ -28,6 +28,9 @@ AC_FUNC_MALLOC
 AC_FUNC_REALLOC
 AC_CHECK_FUNCS([memset select socket strerror strncasecmp strtoul])
 
+PKG_CHECK_MODULES(GTK2, gtk+-2.0, ,)
+PKG_CHECK_MODULES(XML2, xml-2.0, ,)
+
 AC_CONFIG_FILES([Makefile
                  src/Makefile
                  src/tickr/Makefile
--- tickr-0.5.3.orig/src/tickr/Makefile.am
+++ tickr-0.5.3/src/tickr/Makefile.am
@@ -24,11 +24,11 @@ tickr_SOURCES = news_main.c\
 	news_connectwin.c
 
 tickr_CFLAGS = -O2 -Wall -Wextra -Wunused-parameter -Wshadow -Wpointer-arith -ffast-math\
-	-pedantic `pkg-config --cflags gtk+-2.0` `xml2-config --cflags`
+	-pedantic $(GTK2_CFLAGS) $(XML2_CFLAGS)
 
-tickr_LDFLAGS = ../libetm-0.4/libetm.a `pkg-config --libs gtk+-2.0` `xml2-config --libs`
+tickr_LDFLAGS = ../libetm-0.4/libetm.a
 
-tickr_LDADD = ../libetm-0.4/libetm.a
+tickr_LDADD = ../libetm-0.4/libetm.a $(GTK2_LIBS) $(XML2_LIBS)
 
 tickr_DATA = ../../images/tickr-icon.png ../../images/tickr-logo.png\
 	../../images/tickr-rss-icon.png ../../images/tickr-icon.xpm

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to