| 1 |
#!/usr/bin/make -f |
| 2 |
|
| 3 |
ORIG_SRC_VERSION = 6.0.0 |
| 4 |
|
| 5 |
DPKG_EXPORT_BUILDFLAGS = 1 |
| 6 |
include /usr/share/dpkg/buildflags.mk |
| 7 |
|
| 8 |
# Uncomment this to turn on verbose mode. |
| 9 |
#export DH_VERBOSE=1 |
| 10 |
|
| 11 |
# This has to be exported to make some magic below work. |
| 12 |
export DH_OPTIONS |
| 13 |
|
| 14 |
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
| 15 |
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
| 16 |
JOBSFLAG = -j$(NUMJOBS) |
| 17 |
endif |
| 18 |
|
| 19 |
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) |
| 20 |
export DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) |
| 21 |
export DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) |
| 22 |
export DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) |
| 23 |
|
| 24 |
MAKE_CHECK = : disabled make check |
| 25 |
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) |
| 26 |
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) |
| 27 |
MAKE_CHECK = $(MAKE) check |
| 28 |
endif |
| 29 |
endif |
| 30 |
|
| 31 |
#export CFLAGS = -Wall -g |
| 32 |
#export LDFLAGS = -Wl,-Bsymbolic-functions |
| 33 |
|
| 34 |
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) |
| 35 |
CFLAGS += -O0 |
| 36 |
else |
| 37 |
ifneq (,$(findstring $(DEB_HOST_ARCH), ia64)) |
| 38 |
CFLAGS += -O2 |
| 39 |
else |
| 40 |
CFLAGS += -O3 |
| 41 |
endif |
| 42 |
endif |
| 43 |
|
| 44 |
|
| 45 |
confflags = --prefix=/usr --enable-cxx |
| 46 |
|
| 47 |
ifneq (,$(filter $(DEB_HOST_ARCH), amd64 kfreebsd-amd64 lpia)) |
| 48 |
confflags += --disable-fat |
| 49 |
else |
| 50 |
confflags += --enable-fat |
| 51 |
endif |
| 52 |
|
| 53 |
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) |
| 54 |
AR = ar |
| 55 |
confflags_build += --build $(DEB_BUILD_GNU_TYPE) |
| 56 |
else |
| 57 |
AR = $(DEB_HOST_GNU_TYPE)-ar |
| 58 |
confflags_build += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) --target $(DEB_HOST_GNU_TYPE) |
| 59 |
endif |
| 60 |
|
| 61 |
ifneq (,$(findstring $(DEB_HOST_ARCH), x32)) |
| 62 |
confflags += ABI=x32 |
| 63 |
endif |
| 64 |
|
| 65 |
ifneq (,$(filter $(DEB_HOST_ARCH), mips64 mips64el)) |
| 66 |
confflags += ABI=64 |
| 67 |
endif |
| 68 |
|
| 69 |
confflags_ma = $(confflags) $(confflags_build) --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) |
| 70 |
|
| 71 |
CC = $(DEB_HOST_GNU_TYPE)-gcc |
| 72 |
CXX = $(DEB_HOST_GNU_TYPE)-g++ |
| 73 |
|
| 74 |
|
| 75 |
get-orig-source: gmp-$(ORIG_SRC_VERSION).tar.xz |
| 76 |
tar --xz -xf $< |
| 77 |
mv gmp-$(ORIG_SRC_VERSION) gmp-$(ORIG_SRC_VERSION)+dfsg |
| 78 |
mkdir gmp-doc-$(ORIG_SRC_VERSION) |
| 79 |
mv gmp-$(ORIG_SRC_VERSION)+dfsg/doc/ gmp-doc-$(ORIG_SRC_VERSION)/ |
| 80 |
mkdir gmp-$(ORIG_SRC_VERSION)+dfsg/doc |
| 81 |
touch gmp-$(ORIG_SRC_VERSION)+dfsg/doc/Makefile.am |
| 82 |
touch gmp-$(ORIG_SRC_VERSION)+dfsg/doc/Makefile.in |
| 83 |
cd gmp-$(ORIG_SRC_VERSION)+dfsg/ && autoreconf --force --install |
| 84 |
tar --xz -cf gmp_$(ORIG_SRC_VERSION)+dfsg.orig.tar.xz gmp-$(ORIG_SRC_VERSION)+dfsg |
| 85 |
tar --xz -cf gmp-doc_$(ORIG_SRC_VERSION).orig.tar.xz gmp-doc-$(ORIG_SRC_VERSION) |
| 86 |
rm -rf gmp-$(ORIG_SRC_VERSION)+dfsg gmp-doc-$(ORIG_SRC_VERSION) |
| 87 |
|
| 88 |
gmp-$(ORIG_SRC_VERSION).tar.xz: |
| 89 |
wget ftp://ftp.gnu.org/gnu/gmp/$@ |
| 90 |
|
| 91 |
configure: configure-stamp |
| 92 |
configure-stamp: |
| 93 |
mkdir -p build |
| 94 |
cd build && ../configure $(confflags_ma) \ |
| 95 |
AR=$(AR) CC="$(CC)" CFLAGS="$(CFLAGS)" \ |
| 96 |
CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" |
| 97 |
touch $@ |
| 98 |
|
| 99 |
build: build-stamp |
| 100 |
build-stamp: configure |
| 101 |
dh_testdir |
| 102 |
$(MAKE) $(JOBSFLAG) -C build |
| 103 |
$(MAKE_CHECK) -C build |
| 104 |
touch $@ |
| 105 |
|
| 106 |
clean: |
| 107 |
dh_testdir |
| 108 |
dh_testroot |
| 109 |
rm -rf build build-stamp |
| 110 |
dh_clean |
| 111 |
|
| 112 |
install-prep: |
| 113 |
dh_testdir |
| 114 |
dh_testroot |
| 115 |
dh_prep |
| 116 |
dh_installdirs |
| 117 |
|
| 118 |
install: build-stamp install-prep |
| 119 |
rm -rf debian/tmp |
| 120 |
# Install places gmp.h in 'includeexecdir' which is non-standard and cannot be set at compile time, |
| 121 |
# so override it at install. |
| 122 |
$(MAKE) DESTDIR=`pwd`/debian/tmp includeexecdir=/usr/include/$(DEB_HOST_MULTIARCH) -C build install |
| 123 |
|
| 124 |
dh_install -plibgmp10 usr/lib/*/libgmp.so.* |
| 125 |
dh_install -plibgmpxx4ldbl usr/lib/*/libgmpxx.so.* |
| 126 |
|
| 127 |
dh_install -plibgmp-dev usr/lib/*/lib*.so |
| 128 |
dh_install -plibgmp-dev usr/lib/*/lib*.a |
| 129 |
dh_install -plibgmp-dev usr/include |
| 130 |
|
| 131 |
# Install upstream ChangeLog, AUTHORS, NEWS, and README only in -dev package |
| 132 |
dh_installchangelogs -plibgmp-dev |
| 133 |
dh_installdocs -plibgmp-dev AUTHORS NEWS README |
| 134 |
|
| 135 |
# This single target is used to build all the packages, all at once, or |
| 136 |
# one at a time. So keep in mind: any options passed to commands here will |
| 137 |
# affect _all_ packages. Anything you want to only affect one package |
| 138 |
# should be put in another target, such as the install target. |
| 139 |
binary-common: |
| 140 |
# See 633312, http://wiki.debian.org/ReleaseGoals/LAFileRemoval |
| 141 |
sed -i "/dependency_libs/ s/'.*'/''/" `find debian/ -name '*.la'` |
| 142 |
dh_testdir |
| 143 |
dh_testroot |
| 144 |
# User lower compatibility to avoid installing upstream changelog in all packages |
| 145 |
DH_COMPAT=6 dh_installchangelogs |
| 146 |
dh_installdocs |
| 147 |
dh_installexamples |
| 148 |
dh_installmenu |
| 149 |
dh_lintian |
| 150 |
dh_strip |
| 151 |
dh_link |
| 152 |
dh_compress |
| 153 |
dh_fixperms |
| 154 |
dh_makeshlibs |
| 155 |
dh_installdeb |
| 156 |
dh_shlibdeps |
| 157 |
dh_gencontrol |
| 158 |
dh_md5sums |
| 159 |
dh_builddeb |
| 160 |
|
| 161 |
# Build architecture independant packages using the common target. |
| 162 |
binary-indep: build install |
| 163 |
$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common |
| 164 |
|
| 165 |
# Build architecture dependant packages using the common target. |
| 166 |
binary-arch: build install $(EXTRA_INSTALL) |
| 167 |
$(MAKE) -f debian/rules DH_OPTIONS=-s binary-common |
| 168 |
|
| 169 |
# Any other binary targets build just one binary package at a time. |
| 170 |
binary-%: build install |
| 171 |
make -f debian/rules binary-common DH_OPTIONS=-p$* |
| 172 |
|
| 173 |
build-arch: build |
| 174 |
build-indep: build |
| 175 |
|
| 176 |
binary: binary-indep binary-arch |
| 177 |
.PHONY: build build-arch build-indep clean binary-indep binary-arch binary-common binary install install-prep |