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
|
#!/usr/bin/make -f
# Debian build script for XML EZ OUT - Copyright (c) 2009 Xavier Grave
include /usr/share/quilt/quilt.make
ADA_SOURCES=$(wildcard mckae*.ad[sb])
aliversion := $(shell sed -n -r 's/^Package: libxmlezout(.*)-dev$$/\1/p' debian/control)
soversion := $(shell sed -n -r 's/^Package: libxmlezout([^-]+)$$/\1/p' debian/control)
soname := libxmlezout.so.$(soversion)
regexp := ^Version: ([^.]+)\.([^.]+)\.([^.]+)-(.*)
major := $(shell dpkg-parsechangelog | grep "^Version: " | sed -r 's/$(regexp)/\1/')
minor := $(shell dpkg-parsechangelog | grep "^Version: " | sed -r 's/$(regexp)/\2/')
extraminor := $(shell dpkg-parsechangelog | grep "^Version: " | sed -r 's/$(regexp)/\3/')
upload := $(shell dpkg-parsechangelog | grep "^Version: " | sed -r 's/$(regexp)/\4/')
mtnversion := t:libxmlezout-1.06.1
mtnbase := base_debian.db
branch := com.mckae.xml_ez_out
mtn_uri := mtn://www.ada-france.org?$(branch)
orig_dir := libxmlezout.orig
orig_tgz := libxmlezout.orig.tar.gz
pkg_orig_dir := libxmlezout-$(major).$(minor).$(extraminor).orig
pkg_orig_tgz := libxmlezout_$(major).$(minor).$(extraminor).orig.tar.gz
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
CPUS := $(shell getconf _NPROCESSORS_ONLN)
ifneq (,$(wildcard /usr/share/dpkg/default.mk))
include /usr/share/dpkg/default.mk
endif
ADAFLAGS := $(patsubst -Wformat -Wformat-security -Werror=format-security,,$(CFLAGS))
get-orig-source:
TMPDIR=$$(mktemp --tmpdir --directory libxmlezout-get-orig-source-XXXXXXXXXX) && \
if [ -e ../$(mtnbase) ]; then \
cp ../$(mtnbase) $$TMPDIR; \
fi; \
mtn clone -d $$TMPDIR/$(mtnbase) $(mtn_uri) -k "" $$TMPDIR/$(orig_dir) && \
(cd $$TMPDIR && tar --create --gzip --exclude="_MTN" $(orig_dir)) > $(orig_tgz) ; \
rm -rf $$TMPDIR
@echo "The file $(orig_tgz) contains the latest Debian snapshot of upstream sources."
get-pkg-source:
TMPDIR=$$(mktemp --tmpdir --directory libxmlezout-get-pkg-source-XXXXXXXXXX) && \
if [ -e ../$(mtnbase) ]; then \
cp ../$(mtnbase) $$TMPDIR; \
fi; \
mtn clone -r $(mtnversion) -d $$TMPDIR/$(mtnbase) $(mtn_uri) -k "" $$TMPDIR/$(pkg_orig_dir) && \
(cd $$TMPDIR && tar --create --gzip --exclude="_MTN" $(pkg_orig_dir)) > $(pkg_orig_tgz) ; \
rm -rf $$TMPDIR
@echo "The file $(pkg_orig_tgz) contains the latest Debian snapshot of upstream sources."
build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp
build-stamp: patch static-lib shared-lib
touch $@
static-lib:libxmlezout.a
shared-lib:$(soname)
clean:pre-wathever-checks
rm -f build-stamp
rm -f libxmlezout.a $(soname) libxmlezout.so
rm -Rf debian/obj-shared debian/obj-static
dh_clean -a -i
$(MAKE) -f debian/rules unpatch
pre-wathever-checks:
dh_testdir
dh_testroot
libxmlezout$(aliversion)-dev: build-stamp pre-wathever-checks
dh_installdirs -p$@ \
usr/lib/$(DEB_HOST_MULTIARCH) \
usr/share/ada/adainclude/xmlezout \
usr/lib/ada/adalib/xmlezout
dh_install -p$@ debian/obj-static/lib/libxmlezout.a \
usr/lib/$(DEB_HOST_MULTIARCH)
dh_install -p$@ debian/obj-shared/*.ali /usr/lib/ada/adalib/xmlezout
dh_install -p$@ $(ADA_SOURCES) /usr/share/ada/adainclude/xmlezout
dh_install -p$@ debian/xmlezout.gpr /usr/share/ada/adainclude/
dh_link -p$@ usr/lib/$(DEB_HOST_MULTIARCH)/libxmlezout.so.$(soversion) \
usr/lib/$(DEB_HOST_MULTIARCH)/libxmlezout.so
dh_installman -p$@ debian/xml_ez_out.7
dh_strip -p$@ -X.a
libxmlezout$(soversion): build-stamp pre-wathever-checks
dh_installdirs -p$@ /usr/lib/$(DEB_HOST_MULTIARCH)
dh_install -p$@ debian/obj-shared/lib/libxmlezout.so.$(soversion) \
usr/lib/$(DEB_HOST_MULTIARCH)
dh_strip -p$@ --dbg-package=libxmlezout-dbg
binary:binary-arch binary-indep
binary-arch: libxmlezout$(soversion) libxmlezout$(aliversion)-dev
dh_installchangelogs -a
dh_installdocs -a
dh_compress -a
dh_fixperms -a
dh_makeshlibs -a
dh_installdeb -a
dh_shlibdeps -a -Llibxmlezout$(soversion) -ldebian/libxmlezout$(soversion)/usr/lib
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a
binary-indep:
patch:
-quilt push -a
libxmlezout.a:$(ADA_SOURCES)
gnatmake -p -j$(CPUS) -Pdebian/build_xmlezout.gpr \
-XLIBRARY_KIND=static -XOBJ_DIR=obj-static -cargs $(ADAFLAGS) -largs $(LDFLAGS)
libxmlezout.so.$(soversion):$(ADA_SOURCES)
gnatmake -p -j$(CPUS) -Pdebian/build_xmlezout.gpr \
-XLIBRARY_KIND=dynamic -XSONAME=$(soname) -XOBJ_DIR=obj-shared -cargs $(ADAFLAGS) -largs $(LDFLAGS)
show_rules_env:
@echo ADA_SOURCES=$(ADA_SOURCES)
@echo aliversion=$(aliversion)
@echo soversion=$(soversion)
@echo soname=$(soname)
@echo major=$(major)
@echo minor=$(minor)
@echo upload=$(upload)
@echo mtncersion=$(mtnversion)
@echo orig_dir=$(orig_dir)
@echo orig_tgz=$(orig_tgz)
|