The attached file is an update for the as-needed.patch file, and applies cleanly during the build. However, the package is still FTBFS with this change, failing later in override_dh_auto_configure with:
dh_auto_configure: ./configure --build=x86_64-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --libdir=${prefix}/lib/x86_64-linux-gnu --libexecdir=${prefix}/lib/x86_64-linux-gnu --disable-maintainer-mode --disable-dependency-tracking --enable-bufr --enable-static --enable-cairo --with-emos-libraries=/usr/lib --with-terralib=/usr --enable-python LDFLAGS=-L/tmp/buildd/magics++-2.12.9/src/.libs -Wl,--as-needed LIBS= -lX11 -lpng12 -lz returned exit code 1 make[1]: *** [override_dh_auto_configure] Error 255 make[1]: Leaving directory `/tmp/buildd/magics++-2.12.9' make: *** [build] Error 2
Author: Alastair McKinstry <mckins...@debian.org> Description: Patch to ensure -Wl,--as-needed is NOT reordered by libtool. Note that this patch is applied by ./debian/rules AFTER autoreconf is run; it cannot be applied in ./debian/patches Bug-Debian: http://bugs.debian.org/347650 Last-Updated: 2011-12-05 Forwarded: no --- ltmain.sh.orig 2011-12-05 23:13:53.614777184 +0000 +++ ltmain.sh 2011-12-05 23:21:58.310794860 +0000 @@ -5512,6 +5512,11 @@ continue ;; + -Wl,--as-needed) + deplibs="$deplibs $arg" + continue + ;; + -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" @@ -6163,6 +6168,15 @@ lib= found=no case $deplib in + -Wl,--as-needed) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + fi + continue + ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test "$linkmode,$pass" = "prog,link"; then