在 2020-02-05三的 12:21 +0800,YunQiang Su写道:
> On Wed, 05 Feb 2020 00:15:13 +0800 YunQiang Su <s...@debian.org>
> wrote:
> > On Tue, 4 Feb 2020 21:20:59 +0800 YunQiang Su <wzss...@gmail.com>
> > wrote:
> > > Package: src:gmp
> > > Version: 6.2.0+dfsg-3
> > > 
> > > Since binutils/gcc meet some problem due to 2GB/3GB memory
> limitation
> > > on 32bit system.
> > > Now one solution is to have host64-target32 toolchains if the
> > > arch
> > > have compatible 64bit arch,
> > > just like x86, mips, powerpc.
> > 
> > This is a WIP patch. Tested on i386 and amd64.
> > I will need to test it on x32, powerpc, and mipsel.
> 
> I tested it on x32 and mipsel. This patch works fine.
> The porterbox for powerpc is down. So I cannot test it.

The previous version of patch cannot work on powerpc, since
powerpc need ABI=mode64 instead of ABI=64

> 
> > > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=950527
> > > 
> > > 
> > > -- 
> > > YunQiang Su
> > > 
> > > 
diff --git a/debian/control b/debian/control
index 8682742..392e97b 100644
--- a/debian/control
+++ b/debian/control
@@ -3,8 +3,7 @@ Maintainer: Debian Science Team <debian-science-maintainers@lists.alioth.debian.
 Uploaders: Steve M. Robbins <s...@debian.org>
 Section: libs
 Priority: optional
-Build-Depends: m4,
-               debhelper (>= 9)
+Build-Depends: m4, debhelper (>= 9), g++-multilib [i386 x32 powerpc mips mipsel mipsn32 mipsn32el mipsr6 mipsr6el mipsn32r6 mipsn32r6el]
 Standards-Version: 4.1.3
 Vcs-Browser: https://salsa.debian.org/science-team/gmp
 Vcs-Git: https://salsa.debian.org/science-team/gmp.git
@@ -26,6 +25,22 @@ Description: Multiprecision arithmetic library
  It has a rich set of functions, and the functions have a regular
  interface.
 
+Package: lib64gmp10
+Architecture: i386 x32 powerpc mips mipsel mipsn32 mipsn32el mipsr6 mipsr6el mipsn32r6 mipsn32r6el
+Multi-Arch: no
+Section: libs
+Priority: optional
+Depends: ${shlibs:Depends},
+         ${misc:Depends}
+Pre-Depends: ${misc:Pre-Depends}
+Description: Multiprecision arithmetic library (64bit)
+ 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.
+
 Package: libgmpxx4ldbl
 Architecture: any
 Multi-Arch: same
@@ -42,6 +57,19 @@ Description: Multiprecision arithmetic library (C++ bindings)
  arithmetic (ie, a bignum package).  It can operate on signed
  integer, rational, and floating point numeric types.
 
+Package: lib64gmpxx4ldbl
+Architecture: i386 x32 powerpc mips mipsel mipsn32 mipsn32el mipsr6 mipsr6el mipsn32r6 mipsn32r6el
+Multi-Arch: no
+Section: libs
+Priority: optional
+Depends: ${shlibs:Depends},
+         ${misc:Depends}
+Pre-Depends: ${misc:Pre-Depends}
+Description: Multiprecision arithmetic library (C++ bindings, 64bit)
+ 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.
+
 Package: libgmp-dev
 Architecture: any
 Multi-Arch: same
@@ -63,7 +91,27 @@ Description: Multiprecision arithmetic library developers tools
  provided in the libgmp10 package.
  .
  Both C and C++ bindings are present in this package.  Package
- libstdc++-dev is required to use the C++ bindings.  
+ libstdc++-dev is required to use the C++ bindings.
+ .
+ The MPFR library (multiple-precision floating-point) used to be
+ included, but has since been moved to package libmpfr-dev.
+
+Package: lib64gmp-dev
+Architecture: i386 x32 powerpc mips mipsel mipsn32 mipsn32el mipsr6 mipsr6el mipsn32r6 mipsn32r6el
+Multi-Arch: no
+Section: libdevel
+Priority: optional
+Depends: lib64gmp10 (= ${binary:Version}),
+         lib64gmpxx4ldbl (= ${binary:Version}),
+         libgmp-dev (= ${binary:Version}),
+         ${misc:Depends}
+Description: Multiprecision arithmetic library developers tools (64bit)
+ 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 libgmp10 package.
+ .
+ Both C and C++ bindings are present in this package.  Package
+ libstdc++-dev is required to use the C++ bindings.
  .
  The MPFR library (multiple-precision floating-point) used to be
  included, but has since been moved to package libmpfr-dev.
diff --git a/debian/rules b/debian/rules
index 03b0925..047903f 100755
--- a/debian/rules
+++ b/debian/rules
@@ -46,6 +46,33 @@ else
   confflags += --enable-fat
 endif
 
+lib64_archs = i386 x32 powerpc mips mipsn32 mipsel mipsn32el mipsr6 mipsr6n32 mipsr6el mipsn32r6el
+ifneq (,$(filter $(DEB_HOST_ARCH), i386 x32))
+  host64_gnu_type = x86_64-linux-gnu
+  CFLAGS_64 = -m64
+  confflags64 = $(confflags) ABI=64
+else ifneq (,$(filter $(DEB_HOST_ARCH), powerpc))
+  host64_gnu_type = powerpc64-linux-gnu
+  CFLAGS_64 = -m64
+  confflags64 = $(confflags) ABI=mode64
+else ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsn32))
+  host64_gnu_type = mips64-linux-gnuabi64
+  CFLAGS_64 = -mabi=64
+  confflags64 = $(confflags) ABI=64
+else ifneq (,$(filter $(DEB_HOST_ARCH), mipsel mipsn32el))
+  host64_gnu_type = mips64el-linux-gnuabi64
+  CFLAGS_64 = -mabi=64
+  confflags64 = $(confflags) ABI=64
+else ifneq (,$(filter $(DEB_HOST_ARCH), mipsr6 mipsn32r6))
+  host64_gnu_type = mipsisa64r6-linux-gnuabi64
+  CFLAGS_64 = -mabi=64
+  confflags64 = $(confflags) ABI=64
+else ifneq (,$(filter $(DEB_HOST_ARCH), mipsr6el mipsn32r6el))
+  host64_gnu_type = mipsisa64r6el-linux-gnuabi64
+  CFLAGS_64 = -mabi=64
+  confflags64 = $(confflags) ABI=64
+endif
+
 ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
   AR = ar
   confflags_build += --build $(DEB_BUILD_GNU_TYPE)
@@ -63,6 +90,7 @@ ifneq (,$(filter $(DEB_HOST_ARCH), mips64 mips64el))
 endif
 
 confflags_ma = $(confflags) $(confflags_build) --libdir=/usr/lib/$(DEB_HOST_MULTIARCH)
+confflags64 += --build $(DEB_BUILD_GNU_TYPE) --host $(host64_gnu_type) --target $(host64_gnu_type) --libdir=/usr/lib64
 
 CC   = $(DEB_HOST_GNU_TYPE)-gcc
 CXX   = $(DEB_HOST_GNU_TYPE)-g++
@@ -85,24 +113,41 @@ gmp-$(ORIG_SRC_VERSION).tar.xz:
 	wget https://gmplib.org/download/gmp/$@
 
 configure: configure-stamp
+ifneq (,$(filter $(DEB_HOST_ARCH), $(lib64_archs)))
+configure: configure64-stamp
+endif
 configure-stamp:
 	mkdir -p build
 	cd build && ../configure $(confflags_ma) \
 	    AR=$(AR) CC="$(CC)" CFLAGS="$(CFLAGS)" \
 	    CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)"
 	touch $@
+configure64-stamp:
+	mkdir -p build64
+	cd build64 && ../configure $(confflags64) \
+	    AR=$(AR) CC="$(CC)" CFLAGS="$(CFLAGS) $(CFLAGS_64)" \
+	    CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS) $(CFLAGS_64)"
+	touch $@
 
 build: build-stamp
+ifneq (,$(filter $(DEB_HOST_ARCH), $(lib64_archs)))
+build: build64-stamp
+endif
 build-stamp: configure
 	dh_testdir
 	$(MAKE) $(JOBSFLAG) -C build
 	$(MAKE_CHECK) -C build
 	touch $@
+build64-stamp: configure
+	dh_testdir
+	$(MAKE) $(JOBSFLAG) -C build64
+	$(MAKE_CHECK) -C build64
+	touch $@
 
 clean:
 	dh_testdir
 	dh_testroot
-	rm -rf build build-stamp
+	rm -rf build build-stamp build64 build64-stamp
 	dh_clean
 
 install-prep:
@@ -123,7 +168,19 @@ install: build-stamp install-prep
 	dh_install -plibgmp-dev usr/lib/*/lib*.so
 	dh_install -plibgmp-dev usr/lib/*/lib*.a
 	dh_install -plibgmp-dev usr/lib/*/pkgconfig
-	dh_install -plibgmp-dev usr/include
+	dh_install -plibgmp-dev usr/include/gmpxx.h
+	dh_install -plibgmp-dev usr/include/$(DEB_HOST_MULTIARCH)
+
+ifneq (,$(filter $(DEB_HOST_ARCH), $(lib64_archs)))
+	$(MAKE) DESTDIR=`pwd`/debian/tmp includeexecdir=/usr/include -C build64 install
+	dh_install -plib64gmp10 usr/lib64/libgmp.so.*
+	dh_install -plib64gmpxx4ldbl usr/lib64/libgmpxx.so.*
+
+	dh_install -plib64gmp-dev usr/lib64/lib*.so
+	dh_install -plib64gmp-dev usr/lib64/lib*.a
+	dh_install -plib64gmp-dev usr/lib64/pkgconfig
+	dh_install -plib64gmp-dev usr/include/gmp.h
+endif
 
 	# Install upstream ChangeLog, AUTHORS, NEWS, and README only in -dev package
 	dh_installchangelogs -plibgmp-dev

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to