1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
#!/usr/bin/make -f
SHELL=/bin/bash
DESTDIR=$(shell pwd)/debian/tmp
debversion=$(shell head -n1 debian/changelog | cut -d ' ' -f2 | sed 's/[()]//g')
source=$(shell head -n1 debian/changelog | cut -d ' ' -f1)
soname=3
soversion=3.6
changelog=README.36
libpkg=libregina$(soname)
rexxpkg=regina-rexx
destprefix=usr
export DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
export DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
confflags=--prefix=/$(destprefix) --with-addon-dir=/usr/lib/$(source)/$(soversion)/
# Enable Regina GCI only on supported platforms.
ifneq ($(filter alpha amd64 i386,$(DEB_HOST_ARCH)), )
confflags+=--enable-gci
endif
ifeq ($(DEB_BUILD_ARCH), ia64)
CCOPTS=-g
else
CCOPTS:=$(shell dpkg-buildflags --get CFLAGS)
endif
CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)
build: build-arch build-indep
build-arch: stamp-build
build-indep: stamp-build
stamp-build: stamp-configure
$(checkdir)
$(MAKE) DEB_CFLAGS="$(CCOPTS) $(CPPFLAGS)"
touch stamp-build
configure: stamp-configure
stamp-configure:
$(checkdir)
cp -f /usr/share/misc/config.sub common/
cp -f /usr/share/misc/config.guess common/
LDFLAGS="$(LDFLAGS)" ./configure $(confflags)
touch stamp-configure
clean:
$(checkdir)
-rm -f stamp-build stamp-configure config.cache config.log config.guess config.sub
[ ! -f Makefile ] || $(MAKE) distclean
-chmod 644 debian/md5_sums
-rm -f `find . \( -name '*~' -o -name '*.bak' \) -print`
-rm -rf core debian/tmp* debian/files* debian/*substvars debian/shlibs.local
rm -f common/config.sub common/config.guess
binary-indep: checkroot build
$(checkdir)
binary-arch: checkroot build
$(checkdir)
rm -rf debian/tmp{-lib,-dev,-rexx}
install -d -m 755 debian/tmp{-lib,-dev,-rexx}/DEBIAN
install -d -m 755 debian/tmp-lib/$(destprefix)/share/doc/$(libpkg)
install -d -m 755 debian/tmp-rexx/$(destprefix)/share/doc/$(rexxpkg)
install -d -m 755 debian/tmp-dev/$(destprefix)/share/doc/$(libpkg)-dev
#
install -m 755 debian/postinst debian/tmp-lib/DEBIAN/postinst
install -m 755 debian/postrm debian/tmp-lib/DEBIAN/postrm
echo "libregina $(soname) $(libpkg) (>= $(debversion))" > debian/shlibs.local
install -m 644 debian/shlibs.local debian/tmp-lib/DEBIAN/shlibs
#
$(MAKE) install-lib prefix=debian/tmp-lib/$(destprefix)
$(MAKE) install-dev prefix=debian/tmp-dev/$(destprefix)
$(MAKE) install-rexx prefix=debian/tmp-rexx/$(destprefix) \
rexx_examples=share/doc/$(rexxpkg)/examples
#
dpkg-gensymbols -p$(libpkg) -Pdebian/tmp-lib -Idebian/$(libpkg).symbols
#
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
strip --strip-unneeded --remove-section=.comment --remove-section=.note \
debian/tmp-lib/$(destprefix)/lib/libregina.so.$(soversion)
strip --strip-unneeded --remove-section=.comment --remove-section=.note \
debian/tmp-lib/$(destprefix)/lib/regina-rexx/$(soversion)/libregutil.so
strip --strip-debug debian/tmp-dev/$(destprefix)/lib/libregina.a
strip --strip-all --remove-section=.comment \
--remove-section=.note debian/tmp-rexx/$(destprefix)/bin/*
endif
#
cp $(changelog) debian/tmp-lib/$(destprefix)/share/doc/$(libpkg)/changelog
cp debian/changelog debian/tmp-lib/$(destprefix)/share/doc/$(libpkg)/changelog.Debian
gzip -9f debian/tmp-lib/$(destprefix)/share/doc/$(libpkg)/*
cp debian/copyright debian/tmp-lib/$(destprefix)/share/doc/$(libpkg)
#
gzip -9f debian/tmp-rexx/$(destprefix)/share/man/man1/*.1
ln -sf regina.1.gz debian/tmp-rexx/$(destprefix)/share/man/man1/rexx.1.gz
cp $(changelog) debian/tmp-rexx/$(destprefix)/share/doc/$(rexxpkg)/changelog
cp debian/changelog debian/tmp-rexx/$(destprefix)/share/doc/$(rexxpkg)/changelog.Debian
gzip -9f debian/tmp-rexx/$(destprefix)/share/doc/$(rexxpkg)/changelog*
cp debian/copyright debian/tmp-rexx/$(destprefix)/share/doc/$(rexxpkg)
#
gzip -9f debian/tmp-dev/$(destprefix)/share/man/man1/*.1
cp $(changelog) debian/tmp-dev/$(destprefix)/share/doc/$(libpkg)-dev/changelog
cp debian/changelog debian/tmp-dev/$(destprefix)/share/doc/$(libpkg)-dev/changelog.Debian
gzip -9f debian/tmp-dev/$(destprefix)/share/doc/$(libpkg)-dev/changelog*
cp debian/copyright debian/tmp-dev/$(destprefix)/share/doc/$(libpkg)-dev
#
LD_LIBRARY_PATH=/$(destprefix)/lib/libfakeroot:$(DESTDIR)-lib/$(destprefix)/lib \
dpkg-shlibdeps debian/tmp-lib/$(destprefix)/lib/libregina.so.$(soversion) \
debian/tmp-lib/$(destprefix)/lib/regina-rexx/$(soversion)/libregutil.so
dpkg-gencontrol -isp -p$(libpkg) -Pdebian/tmp-lib
echo "regver:Depends=$(libpkg) (= $(debversion))" > debian/dev-substvars
dpkg-gencontrol -isp -p$(libpkg)-dev -Tdebian/dev-substvars -Pdebian/tmp-dev
#
LD_LIBRARY_PATH=/$(destprefix)/lib/libfakeroot:$(DESTDIR)-lib/$(destprefix)/lib \
dpkg-shlibdeps debian/tmp-rexx/$(destprefix)/bin/rexx \
debian/tmp-rexx/$(destprefix)/bin/regina
dpkg-gencontrol -isp -p$(rexxpkg) -Pdebian/tmp-rexx
#
chown -R root.root debian/tmp-{lib,dev,rexx}
chmod -R go=rX,u+w debian/tmp-{lib,dev,rexx}
chmod 755 debian/md5_sums
debian/md5_sums tmp-{lib,dev,rexx}
dpkg --build debian/tmp-lib ..
dpkg --build debian/tmp-dev ..
dpkg --build debian/tmp-rexx ..
define checkdir
test -f debian/rules
endef
binary: binary-indep binary-arch
checkroot:
$(checkdir)
test root = "`whoami`"
.PHONY: binary binary-arch binary-indep clean checkroot
|