File: rules

package info (click to toggle)
dicom3tools 1.00~20170109062447-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 9,892 kB
  • ctags: 6,207
  • sloc: cpp: 69,522; awk: 3,567; sh: 3,548; makefile: 63; sed: 1
file content (76 lines) | stat: -rwxr-xr-x 4,444 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/make -f
#export DH_VERBOSE=1

-include /usr/share/dpkg/buildflags.mk
CFLAGS+=$(CPPFLAGS)
CXXFLAGS+=$(CPPFLAGS)

VER_MAJOR = 1
VER_MINOR = 00
VER_PATCH = $(shell dpkg-parsechangelog | grep '^Version' | cut -d' ' -f2 | cut -f1 -d- | cut -f2 -d~)
UPSTREAM_SRC = dicom3tools_1.00.snapshot.$(VER_PATCH)

VER_FULL = $(VER_MAJOR).$(VER_MINOR)~$(VER_PATCH)
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 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

%:
	dh $@

override_dh_auto_configure:
	# 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)"

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;

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

override_dh_installchangelogs:
	dh_installchangelogs CHANGES

get-orig-source:
	uscan --verbose --force-download --rename --destdir ../tarballs