#!/usr/bin/make -f #export DH_VERBOSE=1 CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS) CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS) CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) $(CPPFLAGS) LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS) include /usr/share/dpkg/default.mk VER_PATCH = $(shell echo $(DEB_VERSION_UPSTREAM) | cut -f2 -d~) UPSTREAM_SRC = dicom3tools_1.00.snapshot.$(VER_PATCH) VER_FULL = $(DEB_VERSION_UPSTREAM) DEBIAN_SRC_DIR = dicom3tools-$(VER_FULL) DEBIAN_SRC_TAR = dicom3tools_$(VER_FULL).orig.tar.gz ifneq (,$(findstring regression_testing_dicom,$(MM_BUILD_OPTIONS))) DCLIST = -name andump\* -o -name dcsmpte\* -o -name dccp\* -o -name dcintro\* -o -name pdftodc\* -o -name rawnjl2\* -o -name ancreate\* -o -name dcencap\* -o -name dctoraw\* -o -name dcjpeg\* -o -name dcmulti\* -o -name dcuncat\* -o -name pnmtodc\* -o -name dcjls\* -o -name dcj2k\* -o -name dcunjpeg\* -o -name dcunjls\* -o -name bmpdump\* -o -name jpegdump\* -o -name dcdirdmp\* -o -name dcdump\* -o -name dcentvfy\* -o -name dcfile\* -o -name dchist\* -o -name dciodvfy\* -o -name dckey\* -o -name dcsort\* -o -name dcsrdump\* -o -name dcstats\* -o -name dctable\* -o -name dctopgm8\* -o -name dcposn\* -o -name dctopgx\* -o -name dctopnm\* -o -name pgxtodc\* -o -name rawftodc\* -o -name rawtodc\* -o -name dcunrgb\* ifneq (,$(filter default_uid_root=%,$(MM_BUILD_OPTIONS))) DEFAULTUIDROOT = $(patsubst default_uid_root=%,%,$(filter default_uid_root=%,$(MM_BUILD_OPTIONS))) IMAKEFLAGS = -DDefaultUIDRoot=$(DEFAULTUIDROOT) endif else DCLIST = -name andump\* -o -name jpegdump\* -o -name dcdirdmp\* -o -name dcdump\* -o -name dcentvfy\* -o -name dcfile\* -o -name dchist\* -o -name dcintro\* -o -name dciodvfy\* -o -name dckey\* -o -name dcsort\* -o -name dcsrdump\* -o -name dcstats\* -o -name dctable\* -o -name dctopgm8\* -o -name dcposn\* -o -name dctopgx\* -o -name dctopnm\* -o -name dcunrgb\* endif # Commands that must be present in the package. dcintro is documentation # only (a man page), so it is deliberately absent here. EXPECTED_COMMANDS = andump dcdirdmp dcdump dcentvfy dcfile dchist dciodvfy \ dckey dcposn dcsort dcsrdump dcstats dctable dctable_decompressingprn \ dctopgm8 dctopgx dctopnm dcunrgb jpegdump %: dh $@ override_dh_clean: dh_clean find . -mindepth 2 -name Makefile -delete if [ -d libsrc/support.bak ] ; then rm -rf libsrc/support; mv libsrc/support.bak libsrc/support ; fi override_dh_auto_configure: cp -a libsrc/support libsrc/support.bak # http://www.gnu.org/manual/gawk/html_node/Special-FD.html find . -name \*.awk -exec sed -i -e 's@/dev/tty@/dev/stderr@g' {} \; sh Configure imake -I./config -DTmpPath=/tmp -DOptimizeLevel=-O2 $(IMAKEFLAGS) override_dh_auto_build: $(MAKE) World C_DEBUGFLAGS="$(CFLAGS)" CPLUSPLUS_DEBUGFLAGS="$(CXXFLAGS)" C_EXTRA_LOAD_FLAGS="$(LDFLAGS)" CPLUSPLUS_EXTRA_LOAD_FLAGS="$(LDFLAGS)" CPLUSPLUS_OPTIONS="$(CXXFLAGS) $(CPPFLAGS)" override_dh_installman: $(MAKE) DESTDIR=$(CURDIR)/debian/dicom3tools install.man # remove empty man page find $(CURDIR)/debian/dicom3tools -type f -size 0 -print | xargs rm # Move the special .so (groff source file to /usr/share/dicom3tools to please lintian mkdir -p $(CURDIR)/debian/dicom3tools/usr/share/dicom3tools mv $(CURDIR)/debian/dicom3tools/usr/share/man/man1/*.so $(CURDIR)/debian/dicom3tools/usr/share/dicom3tools # Let's use the new file location: find $(CURDIR)/debian/dicom3tools/usr/share/man/man1 -type f -exec sed -i -e 's@.so man1@.so ../dicom3tools@g' {} \; # Cannot start a line with a . (it is a macro) # http://www.mail-archive.com/groff@gnu.org/msg04712.html find $(CURDIR)/debian/dicom3tools/usr/share/man/man1 -type f -exec sed -i -e 's/^\.\.\.$$/\\\&\.\.\./g' {} \; # a newline character is not allowed in an escape name / a space character is not allowed in an escape name find $(CURDIR)/debian/dicom3tools/usr/share/man/man1 -type f -exec sed -i -e 's/\\n/\\/g' {} \; # hyphen-used-as-minus-sign #find $(CURDIR)/debian/dicom3tools/usr/share/man/man1 -type f -exec sed -i -e 's/-/\\-/g' {} \; # Can't use above -> manpage-has-bad-whatis-entry # Remove (except special list from official upstream releases) : find $(CURDIR)/debian/dicom3tools/usr/bin -type f -not \( $(DCLIST) \) -print | xargs rm; find $(CURDIR)/debian/dicom3tools/usr/share/man -type f -not \( $(DCLIST) \) -print | xargs rm; # Recursive make used to hide per-directory build failures, silently # producing a package with missing commands. Refuse to build such a # package instead. @for cmd in $(EXPECTED_COMMANDS); do \ if [ ! -e $(CURDIR)/debian/dicom3tools/usr/bin/$$cmd ]; then \ echo "ERROR: expected command $$cmd is missing from the package" >&2; \ exit 1; \ fi; \ done override_dh_install: dh_install # now that we have removed empty man page, we need to remove associated binaries for file in ancp andiff antodc.all binpatch dcanon dcburn dccmp dccomb dcdecmpr dcdiff dclutburn \ dclutmix dcmvhier.8only dcmvhier.all dcortho dcostosr dcpost dcproj dcrmsfx.all \ dcsrmrg dcsub dcswab dcunjpeg.all dumptiff dumpwhat gentodc.dat.all \ jpegsplit pbmswbit pgmtobmp pnmpred pqsplit rawarith rawdiff rawmask; do \ find $(CURDIR)/debian/dicom3tools -type f -name $$file\* -print | xargs rm; \ done # Remove all static lib rm -rf $(CURDIR)/debian/dicom3tools/usr/lib # Upstream's test suite needs the separate images/ and test/ data # directories, which are not part of the source tarball. The recursive # make used to hide the resulting failures. Run the tests only when that # data is actually available. override_dh_auto_test: @if [ -d images ] && [ -d test ]; then \ $(MAKE) test; \ else \ echo "Skipping upstream test suite: images/ and test/ data not shipped"; \ fi override_dh_installchangelogs: dh_installchangelogs CHANGES