Package: dh-haskell
Version: 0.1
Severity: important
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu yakkety ubuntu-patch

On Ubuntu, "dpkg-buildflags --get LDFLAGS" defaults to
"-Wl,-Bsymbolic-functions -Wl,-z,relro".  dh-haskell's handling of the
output of LDFLAGS is buggy in that it only works correctly when a single
flag is returned (I think it probably even breaks if LDFLAGS is empty).
This results in errors such as:

  [1 of 5] Compiling Data.These       ( Data/These.hs, 
dist-ghc/build/Data/These.p_o )
  /usr/bin/ld: unrecognized option '-Bsymbolic-functions -Wl'
  /usr/bin/ld: use the --help option for usage information
  collect2: error: ld returned 1 exit status

Patch follows.

diff --git a/lib/Debian/Debhelper/Buildsystem/haskell.pm 
b/lib/Debian/Debhelper/Buildsystem/haskell.pm
index aabed89..4bc85fa 100644
--- a/lib/Debian/Debhelper/Buildsystem/haskell.pm
+++ b/lib/Debian/Debhelper/Buildsystem/haskell.pm
@@ -321,7 +321,9 @@ ghc, that harden generated binaries and fix corresponding 
lintian warning.
 =cut
 
 sub ghc_linker_flags {
-    my @link_flags = `dpkg-buildflags --get LDFLAGS` or die $!;
+    my $link_flags = `dpkg-buildflags --get LDFLAGS` or die $!;
+    chomp $link_flags;
+    my @link_flags = split " ", $link_flags;
     return map "--ghc-option=-optl$_", @link_flags;
 }
 

Thanks,

-- 
Colin Watson                                       [cjwat...@ubuntu.com]

Reply via email to