[Pkg-scicomp-devel] Bug#506791: gmp: providing lib32gmp (amd64) and lib64gmp (ppc)

Bill Allombert Bill.Allombert at math.u-bordeaux1.fr
Mon Mar 2 22:12:57 UTC 2009


On Sun, Mar 01, 2009 at 11:49:19PM -0600, Steve M. Robbins wrote:
> Hello Bill,
> 
> On Mon, Nov 24, 2008 at 09:18:53PM +0100, Bill Allombert wrote:
> 
> > It would be great if GMP would provide a 32bit version on amd64
> > and 64bit version on ppc (at least), both library and -dev
> > package.
> > 
> > I had some patch for the etch version, but I do not know how to 
> > do that with cdbs.
> 
> OK, I've just changed the build system for gmp back to simple
> debhelper, in preparation for addressing this.
> 
> I'd be very obliged if you could attach the full patch you
> have.

Please find my patch which is based on GMP 2:4.2.1+dfsg-4 from etch which
currently FTBFS on lenny. So I offer to port it to a newer, non-cdbs
version of GMP. Please note that the Build-dependencies might be wrong
wrong since I could only build the package on etch.

I do not provide lib32gmpxx4 nor lib64gmpxx4 because I do not know
anything that need them, but they could easily be added.

I only provide lib32 on powerpc and lib64 on amd64, though it is trivial
to add more architectures as needed.

Cheers,
-- 
Bill. <ballombe at debian.org>

Imagine a large red swirl here. 
-------------- next part --------------
diff -u gmp-4.2.1+dfsg/debian/control gmp-4.2.1+dfsg/debian/control
--- gmp-4.2.1+dfsg/debian/control
+++ gmp-4.2.1+dfsg/debian/control
@@ -1,7 +1,7 @@
 Source: gmp
 Section: libs
 Priority: optional
-Build-Depends: m4, debhelper (>= 5)
+Build-Depends: m4, debhelper (>= 5), libc6-dev-i386 [amd64], libc6-dev-ppc64 [powerpc]
 Maintainer: Steve M. Robbins <smr at debian.org>
 Uploaders: Philipp Matthias Hahn <pmhahn at debian.org>
 Standards-Version: 3.6.2
@@ -23,6 +23,36 @@
  .
  The home page is http://www.swox.com/gmp
 
+Package: lib32gmp3c2
+Section: libs
+Priority: optional
+Architecture: amd64
+Depends: ${shlibs:Depends}
+Description: Multiprecision arithmetic library (32bit version)
+ GNU MP is a programmer's library for arbitrary precision
+ arithmetic (ie, a bignum package).  It can operate on signed
+ integer, rational, and floating point numeric types.
+ .
+ It has a rich set of functions, and the functions have a regular
+ interface.
+ .
+ The home page is http://www.swox.com/gmp
+
+Package: lib64gmp3c2
+Section: libs
+Priority: optional
+Architecture: powerpc
+Depends: ${shlibs:Depends}
+Description: Multiprecision arithmetic library (64bit version)
+ GNU MP is a programmer's library for arbitrary precision
+ arithmetic (ie, a bignum package).  It can operate on signed
+ integer, rational, and floating point numeric types.
+ .
+ It has a rich set of functions, and the functions have a regular
+ interface.
+ .
+ The home page is http://www.swox.com/gmp
+
 Package: libgmpxx4
 Section: libs
 Priority: optional
@@ -55,6 +85,32 @@
  The MPFR library (multiple-precision floating-point) used to be
  included, but has since been moved to package libmpfr-dev.
 
+Package: lib32gmp3-dev
+Section: libdevel
+Priority: optional
+Architecture: amd64
+Depends: lib32gmp3c2 (= ${Source-Version})
+Suggests: libgmp3-doc
+Description: Multiprecision arithmetic library developers tools (32bit version)
+ This development package provides the header files and the symbolic
+ links to allow compilation and linking of programs that use the libraries
+ provided in the lib32gmp3 package.
+ .
+ Only C bindings are present in this package.
+
+Package: lib64gmp3-dev
+Section: libdevel
+Priority: optional
+Architecture: powerpc
+Depends: lib64gmp3c2 (= ${Source-Version})
+Suggests: libgmp3-doc
+Description: Multiprecision arithmetic library developers tools (64bit version)
+ This development package provides the header files and the symbolic
+ links to allow compilation and linking of programs that use the libraries
+ provided in the lib64gmp3 package.
+ .
+ Only C bindings are present in this package.
+
 Package: libgmp3-doc
 Section: doc
 Priority: optional
diff -u gmp-4.2.1+dfsg/debian/rules gmp-4.2.1+dfsg/debian/rules
--- gmp-4.2.1+dfsg/debian/rules
+++ gmp-4.2.1+dfsg/debian/rules
@@ -27,6 +27,15 @@
   confflags += --enable-fat
 endif
 
+ifeq (amd64,$(DEB_HOST_ARCH))
+  DO_LIB32 := true 
+  usrlib32=/emul/ia32-linux/usr/lib
+endif
+
+ifeq (powerpc,$(DEB_HOST_ARCH))
+  DO_LIB64 := true 
+  usrlib64=/usr/lib64
+endif
 
 export CFLAGS = -g
 export LDFLAGS = -Wl,-z,defs
@@ -46,11 +55,30 @@
 	dh_testdir
 
 	chmod +x configure
-	./configure $(confflags) --prefix=/usr \
-		--enable-cxx --enable-mpbsd
-	$(MAKE)
+	mkdir build
+	cd build && ../configure $(confflags) \
+               $(confflags) --prefix=/usr --enable-cxx --enable-mpbsd
+	$(MAKE) -C build
+ifdef DO_LIB32
+	mkdir build32
+	cd build32 && env CFLAGS="-m32 $(CFLAGS)" ../configure ABI=32 \
+                $(confflags) --prefix=/usr --disable-cxx --enable-mpbsd
+	$(MAKE) -C build32
+endif
+ifdef DO_LIB64
+	mkdir build64
+	cd build64 && env CFLAGS="-m64 $(CFLAGS)" ../configure ABI=64 \
+           $(confflags) --prefix=/usr --disable-cxx --enable-mpbsd
+	$(MAKE) -C build64
+endif
 ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
-	$(MAKE) check
+	$(MAKE) check -C build
+ifdef DO_LIB32
+	$(MAKE) check -C build32
+endif
+ifdef DO_LIB64
+	$(MAKE) check -C build64
+endif
 endif
 
 	touch build-stamp
@@ -62,6 +90,11 @@
 
 	-$(MAKE) clean
 	-$(MAKE) distclean
+	-rm -rf build
+	-rm -rf build32
+	-rm -rf build64
+	-rm -rf debian/tmp32
+	-rm -rf debian/tmp64
 
 	dh_clean
 
@@ -73,10 +106,16 @@
 	dh_installdirs
 
 # Hack around libtool madness.  Thanks a heap to Kevin Ryde for this.
-	sed "/^relink_command/s:libgmp.la:-L`pwd`/debian/tmp/usr/lib libgmp.la:" <libgmpxx.la >libgmpxx.la.tmp
-	mv libgmpxx.la.tmp libgmpxx.la
+	sed "/^relink_command/s:libgmp.la:-L`pwd`/debian/tmp/usr/lib libgmp.la:" <build/libgmpxx.la >build/libgmpxx.la.tmp
+	mv build/libgmpxx.la.tmp build/libgmpxx.la
 
-	$(MAKE) DESTDIR=`pwd`/debian/tmp install
+	$(MAKE) -C build   DESTDIR=`pwd`/debian/tmp install
+ifdef DO_LIB32
+	$(MAKE) -C build32 DESTDIR=`pwd`/debian/tmp32 install
+endif
+ifdef DO_LIB64
+	$(MAKE) -C build64 DESTDIR=`pwd`/debian/tmp64 install
+endif
 
 	# Library packages
 	dh_install -plibgmp3c2 --autodest debian/tmp/usr/lib/libgmp.so.*
@@ -87,6 +126,22 @@
 	dh_install -plibgmp3-dev --autodest debian/tmp/usr/lib/libgmp.so
 	dh_install -plibgmp3-dev --autodest debian/tmp/usr/lib/libgmp.a
 	dh_install -plibgmp3-dev --autodest debian/tmp/usr/lib/libgmp.la
+ifdef DO_LIB32
+	dh_install -plib32gmp3c2 debian/tmp32/usr/lib/libgmp.so.* $(usrlib32)
+	dh_install -plib32gmp3c2 debian/tmp32/usr/lib/libmp.so.*  $(usrlib32)
+	dh_install -plib32gmp3-dev debian/tmp32/usr/lib/libgmp.so $(usrlib32)
+	dh_install -plib32gmp3-dev debian/tmp32/usr/lib/libgmp.a  $(usrlib32)
+	dh_install -plib32gmp3-dev debian/tmp32/usr/lib/libgmp.la $(usrlib32)
+endif
+ifdef DO_LIB64
+	dh_install -plib64gmp3c2 debian/tmp64/usr/lib/libgmp.so.* $(usrlib64)
+	dh_install -plib64gmp3c2 debian/tmp64/usr/lib/libmp.so.*  $(usrlib64)
+	dh_install -plib64gmp3-dev debian/tmp64/usr/lib/libgmp.so $(usrlib64)
+	dh_install -plib64gmp3-dev debian/tmp64/usr/lib/libgmp.a  $(usrlib64)
+	dh_install -plib64gmp3-dev debian/tmp64/usr/lib/libgmp.la $(usrlib64)
+endif
+
+	# Developer packages
 	dh_install -plibgmp3-dev --autodest debian/tmp/usr/include/gmp.h
 
 	dh_install -plibgmp3-dev --autodest debian/tmp/usr/lib/libmp.so
@@ -113,6 +168,12 @@
 	dh_install
 
 	dh_makeshlibs -v -plibgmp3c2 -V 'libgmp3c2'
+ifdef DO_LIB32
+	dh_makeshlibs -v -plib32gmp3c2 -V 'lib32gmp3c2'
+endif
+ifdef DO_LIB64
+	dh_makeshlibs -v -plib64gmp3c2 -V 'lib64gmp3c2'
+endif
 	dh_makeshlibs -v -plibgmpxx4 -V 'libgmpxx4'
 
 # This single target is used to build all the packages, all at once, or
@@ -136,6 +197,12 @@
 #	dh_makeshlibs
 	dh_installdeb
 	dh_shlibdeps -L libgmp3c2 -l debian/libgmp3c2/usr/lib:debian/libgmpxx4/usr/lib
+ifdef DO_LIB32
+	dh_shlibdeps -L lib32gmp3c2 -l debian/lib32gmp3c2/$(usrlib32)
+endif
+ifdef DO_LIB64
+	dh_shlibdeps -L lib64gmp3c2 -l debian/lib64gmp3c2/$(usrlib64)
+endif
 	dh_gencontrol
 	dh_md5sums
 	dh_builddeb
@@ -146,7 +213,7 @@
 
 # Build architecture dependant packages using the common target.
 binary-arch: build install
-	$(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
+	$(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
 
 # Any other binary targets build just one binary package at a time.
 binary-%: build install
diff -u gmp-4.2.1+dfsg/debian/changelog gmp-4.2.1+dfsg/debian/changelog
--- gmp-4.2.1+dfsg/debian/changelog
+++ gmp-4.2.1+dfsg/debian/changelog
@@ -1,3 +1,9 @@
+gmp (2:4.2.1+dfsg-5) unstable; urgency=low
+
+  * Build extra lib64gmp3c2 on powerpc, and lib32gmp3c2 on amd64.
+
+ -- Bill Allombert <ballombe at debian.org>  Mon, 02 Mar 2009 14:58:31 +0100
+
 gmp (2:4.2.1+dfsg-4) unstable; urgency=high
 
   * Build with -O0 on m68k due to a bug in gcc-4.1.  Closes: #378719.


More information about the Pkg-scicomp-devel mailing list