Package: grads
Version: 2.0.a8-2
Severity: normal
Tags: patch
User: vor...@debian.org
Usertags: multiarch

Hi Alistair,

The grads package fails to build in a multiarch environment because it
hard-codes the paths to .so files it wants to link against.  If instead it
allows the compiler to resolve the library paths via "-l" options, as in the
attached patch, the package builds fine.  This is strongly preferred over
hard-coded paths, not only for multiarch but also for any other cases where
a user might like to rebuild the package against local versions of
libraries.

As there were two existing patches in debian/patches which partially dealt
with this issue, this patch drops one of these patches and uses the other to
fully address the problem.

Since multiarch is imminent in Debian, please consider including this patch
in your next upload of grads.  The patch has been applied in Ubuntu with the
following changelog:

  * debian/patches/supplibs.patch: gut the wrong upstream library lookups,
    we should be linking with -l$lib instead of passing filenames.  Fixes
    build failures when building in a multiarch environment.  LP: #749178.

Thanks,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru grads-2.0.a8/debian/patches/lib_suffix.patch grads-2.0.a8/debian/patches/lib_suffix.patch
--- grads-2.0.a8/debian/patches/lib_suffix.patch	2010-05-09 10:54:12.000000000 -0700
+++ grads-2.0.a8/debian/patches/lib_suffix.patch	1969-12-31 16:00:00.000000000 -0800
@@ -1,17 +0,0 @@
-Author: Alastair McKinstry <mckins...@debian.org>
-Description: Dynamic libs need to have .so suffix; linking just .a's breaks by not including dependencies
-Last-Updated: 2010-05-09
-
-Index: grads-2.0.a8/acinclude.m4
-===================================================================
---- grads-2.0.a8.orig/acinclude.m4	2010-05-09 16:12:08.000000000 +0100
-+++ grads-2.0.a8/acinclude.m4	2010-05-09 16:12:20.000000000 +0100
-@@ -79,7 +79,7 @@
- AC_DEFUN([GA_SET_LIB_VAR],
- [
-   ga_lib_prefix='$(supp_lib_dir)/lib'
--  ga_lib_suffix='.a'
-+  ga_lib_suffix='.so'
-   for ga_lib_name in $2 ; do
-       $1="$$1 ${ga_lib_prefix}${ga_lib_name}${ga_lib_suffix}"
-   done  
diff -Nru grads-2.0.a8/debian/patches/series grads-2.0.a8/debian/patches/series
--- grads-2.0.a8/debian/patches/series	2010-05-09 10:54:12.000000000 -0700
+++ grads-2.0.a8/debian/patches/series	2011-04-11 22:30:26.000000000 -0700
@@ -3,6 +3,5 @@
 udunits2.patch
 hdf5_hl.patch
 asneeded.patch
-lib_suffix.patch
 gasdf_fix.patch
 libsz_notpresent.patch
diff -Nru grads-2.0.a8/debian/patches/supplibs.patch grads-2.0.a8/debian/patches/supplibs.patch
--- grads-2.0.a8/debian/patches/supplibs.patch	2010-05-09 10:54:12.000000000 -0700
+++ grads-2.0.a8/debian/patches/supplibs.patch	2011-04-11 21:49:53.000000000 -0700
@@ -1,19 +1,49 @@
-Author: Alastair McKinstry <mckins...@debian.org>
-Description: Add a default value for SUPPLIBS, and 
-Last-Updated: 2010-05-09
-Forwarded: no
+Author: Steve Langasek <steve.langa...@linaro.org>
+Description: remove wrong "supplibs" dir handling
+ pass libraries as -l arguments, instead of guessing and passing absolute
+ paths.
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/749178
 
 Index: grads-2.0.a8/src/Makefile.am
 ===================================================================
---- grads-2.0.a8.orig/src/Makefile.am	2010-05-09 14:58:21.000000000 +0100
-+++ grads-2.0.a8/src/Makefile.am	2010-05-09 14:58:35.000000000 +0100
-@@ -16,6 +16,9 @@
- # Targets that will not always be built
- EXTRA_PROGRAMS	       = gxtran grib2scan
+--- grads-2.0.a8.orig/src/Makefile.am
++++ grads-2.0.a8/src/Makefile.am
+@@ -24,18 +24,13 @@
+ # Compiler and linker settings
+ #
  
-+# Set default SUPPLIBS
-+SUPPLIBS	       = /usr
-+
- # Convenience target
- utils: bufrscan gribscan gribmap gxeps gxps stnmap wgrib $(extra_utils)
+-# Paths to external headers and libraries
+-supp_include_dir	= $(SUPPLIBS)/include
+-supp_lib_dir		= $(SUPPLIBS)/lib
+-
+ # Settings used for all binaries
+-LDADD			= -L$(supp_lib_dir) 
+ INCLUDES		= $(readline_inc) $(printim_inc) $(grib2_inc) $(nc_inc) \
+ 			  $(hdf_inc) $(hdf5_inc) $(geotiff_inc) $(shp_inc) $(gadap_inc) \
+                           $(X_CFLAGS) $(XAW_CFLAGS) $(GD_CFLAGS) $(HDF4_CFLAGS)
+ 
+ # Settings used for all GrADS binaries
+-common_ldadd            = $(LDADD) $(X_LIBS) $(host_ldadd) -lX11
++common_ldadd            = $(X_LIBS) $(host_ldadd) -lX11
+ 
+ ######################################################################
+ #
+--- grads-2.0.a8.orig/acinclude.m4
++++ grads-2.0.a8/acinclude.m4
+@@ -74,14 +74,12 @@ AC_DEFUN([GA_UNSET_FLAGS],
+ ])
+ 
+ dnl GA_SET_LIB_VAR : Puts necessary linker options to link with libraries given into
+-dnl                  a shell variable. They will have the form 'supplib_dir/libname.a'.
++dnl                  a shell variable.
+ dnl   args:	   : shell-variable-name, list-of-libraries (e.g. [readline termcap])
+ AC_DEFUN([GA_SET_LIB_VAR],
+ [
+-  ga_lib_prefix='$(supp_lib_dir)/lib'
+-  ga_lib_suffix='.a'
+   for ga_lib_name in $2 ; do
+-      $1="$$1 ${ga_lib_prefix}${ga_lib_name}${ga_lib_suffix}"
++      $1="$$1 -l${ga_lib_name}"
+   done  
+ ])
  

Reply via email to