| 1 |
#!/usr/bin/make -f
|
| 2 |
# -*- makefile -*-
|
| 3 |
# debian/rules for libg2
|
| 4 |
# Author: Eric Cain
|
| 5 |
|
| 6 |
# Uncomment this to turn on verbose mode.
|
| 7 |
#export DH_VERBOSE=1
|
| 8 |
|
| 9 |
# These are used for cross-compiling and for saving the configure script
|
| 10 |
# from having to guess our platform (since we know it already)
|
| 11 |
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
|
| 12 |
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
|
| 13 |
|
| 14 |
|
| 15 |
CFLAGS = -Wall -g
|
| 16 |
|
| 17 |
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
| 18 |
CFLAGS += -O0
|
| 19 |
else
|
| 20 |
CFLAGS += -O2
|
| 21 |
endif
|
| 22 |
|
| 23 |
# Use the latest version number in the CHANGES file
|
| 24 |
version=`head -n 1 CHANGES | \
|
| 25 |
awk '{if (match($$0,/^[0-9]+\.[0-9]+[A-Za-z]/)) print substr($$0,RSTART,RLENGTH)}'`
|
| 26 |
rversion=`head -n 1 CHANGES | \
|
| 27 |
awk '{if (match($$0,/^[0-9]+\.[0-9]+/)) print substr($$0,RSTART,RLENGTH)}'`
|
| 28 |
major=`head -n 1 CHANGES | \
|
| 29 |
awk '{if (match($$0,/^[0-9]+/)) print substr($$0,RSTART,RLENGTH)}'`
|
| 30 |
|
| 31 |
|
| 32 |
config.status:
|
| 33 |
dh_testdir
|
| 34 |
|
| 35 |
QUILT_PATCHES=debian/patches quilt push -a || test $$? = 2
|
| 36 |
|
| 37 |
dh_autotools-dev_updateconfig
|
| 38 |
# do also save configure which is changed here to be able to restore it afterwards in the clean target
|
| 39 |
cp -a configure configure.dh-orig
|
| 40 |
libtoolize -f -c
|
| 41 |
autoconf
|
| 42 |
CFLAGS="$(CFLAGS) -Wl,-z,defs" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
|
| 43 |
|
| 44 |
|
| 45 |
build: build-stamp
|
| 46 |
build-stamp: config.status
|
| 47 |
dh_testdir
|
| 48 |
# compile the package.
|
| 49 |
$(MAKE) depend
|
| 50 |
$(MAKE) libg2.a RVERSION=$(rversion) MVERSION=$(major)
|
| 51 |
# clean up and build the shared lib
|
| 52 |
-rm -f src/*.o src/*/*.o
|
| 53 |
$(MAKE) PICFLAG="-fPIC" RVERSION=$(rversion) MVERSION=$(major) shared
|
| 54 |
(cd ./g2_perl && perl Makefile.PL INSTALLDIRS=vendor LIBS="-L$(CURIDR)/g2_perl/.. -lg2")
|
| 55 |
$(MAKE) -C ./g2_perl
|
| 56 |
|
| 57 |
touch build-stamp
|
| 58 |
|
| 59 |
clean:
|
| 60 |
dh_testdir
|
| 61 |
dh_testroot
|
| 62 |
rm -f build-stamp
|
| 63 |
|
| 64 |
# clean up after the build process.
|
| 65 |
[ ! -f Makefile ] || $(MAKE) RVERSION=$(rversion) MVERSION=$(major) clean
|
| 66 |
|
| 67 |
if [ -f Makefile.bak ] ; then mv Makefile.bak Makefile ; fi
|
| 68 |
if [ -f configure.dh-orig ] ; then mv configure.dh-orig configure ; fi
|
| 69 |
dh_autotools-dev_restoreconfig
|
| 70 |
dh_clean
|
| 71 |
QUILT_PATCHES=debian/patches quilt pop -a -R || test $$? = 2
|
| 72 |
rm -f ltmain.sh
|
| 73 |
rm -rf .pc
|
| 74 |
|
| 75 |
|
| 76 |
install: build
|
| 77 |
dh_testdir
|
| 78 |
dh_testroot
|
| 79 |
dh_prep
|
| 80 |
dh_installdirs
|
| 81 |
|
| 82 |
# install the package into debian/tmp
|
| 83 |
$(MAKE) RVERSION=$(rversion) MVERSION=$(major) install prefix=$(CURDIR)/debian/libg2-dev
|
| 84 |
$(MAKE) -C ./g2_perl install DESTDIR=$(CURDIR)/debian/libg2$(major)-perl
|
| 85 |
|
| 86 |
mkdir -p debian/tmp/usr/lib
|
| 87 |
|
| 88 |
mv debian/libg2-dev/usr/lib/libg2.so.$(rversion) debian/tmp/usr/lib/libg2.so.$(rversion)
|
| 89 |
mv debian/libg2-dev/usr/lib/libg2.so.$(major) debian/tmp/usr/lib/libg2.so.$(major)
|
| 90 |
ln -s libg2.so.$(rversion) debian/tmp/usr/lib/libg2.so
|
| 91 |
|
| 92 |
|
| 93 |
# Build architecture-independent files here.
|
| 94 |
binary-indep: build install
|
| 95 |
# We have nothing to do by default.
|
| 96 |
|
| 97 |
# Build architecture-dependent files here.
|
| 98 |
binary-arch: build install
|
| 99 |
dh_testdir
|
| 100 |
dh_testroot
|
| 101 |
|
| 102 |
# build libg2${major} package by moving files from tmp
|
| 103 |
dh_movefiles -plibg2$(major) \
|
| 104 |
usr/lib/libg2.so.$(major) \
|
| 105 |
usr/lib/libg2.so.$(rversion)
|
| 106 |
|
| 107 |
dh_movefiles -plibg2-dev \
|
| 108 |
usr/lib/libg2.so
|
| 109 |
|
| 110 |
install -m 755 -d debian/libg2$(major)-perl/usr/share/perl5/
|
| 111 |
|
| 112 |
mv debian/libg2$(major)-perl/usr/lib/perl5/*.pm debian/libg2$(major)-perl/usr/share/perl5/
|
| 113 |
|
| 114 |
chrpath --delete $(CURDIR)/debian/libg20-perl/usr/lib/perl5/auto/G2/G2.so
|
| 115 |
|
| 116 |
dh_installchangelogs CHANGES
|
| 117 |
dh_installdocs
|
| 118 |
dh_installexamples
|
| 119 |
dh_link
|
| 120 |
dh_strip
|
| 121 |
dh_compress
|
| 122 |
dh_fixperms
|
| 123 |
dh_perl
|
| 124 |
dh_makeshlibs
|
| 125 |
dh_installdeb
|
| 126 |
dh_shlibdeps
|
| 127 |
dh_gencontrol
|
| 128 |
dh_md5sums
|
| 129 |
dh_builddeb
|
| 130 |
|
| 131 |
binary: binary-indep binary-arch
|
| 132 |
.PHONY: build clean binary-indep binary-arch binary install
|