File: rules

package info (click to toggle)
gmt 5.3.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 150,460 kB
  • ctags: 18,539
  • sloc: ansic: 194,217; sh: 7,349; xml: 149; makefile: 72; fortran: 49; lisp: 41; csh: 5
file content (115 lines) | stat: -rwxr-xr-x 3,776 bytes parent folder | download
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
#! /usr/bin/make -f

# Enable hardening build flags
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

CFLAGS += $(CPPFLAGS)

ifneq (,$(findstring verbose,$(DEB_BUILD_OPTIONS)))
   DH_VERBOSE=1
   export DH_VERBOSE
endif

UPSTREAM_VERSION=$(shell dpkg-parsechangelog | sed -ne 's/^Version: \(.*\)-.*/\1/p' | sed -e 's/\+.*//; s/^[0-9]://')
BUILD_DATE=$(shell dpkg-parsechangelog | sed -ne 's/^Date: //p' | LC_ALL=C date -u "+%d %B %Y" -f -)

MANPAGES:=$(wildcard debian/man/*.*.xml)

BUILDDIR = $(CURDIR)/debian/build

CMAKE_OPTS = -DCMAKE_BUILD_TYPE=RelWithDebInfo \
             -DCMAKE_C_FLAGS="-fstrict-aliasing $(CFLAGS)" \
             -DCMAKE_INSTALL_PREFIX=/usr \
             -DDCW_ROOT=/usr/share/gmt-dcw \
             -DGSHHG_ROOT=/usr/share/gmt-gshhg \
             -DNETCDF_ROOT=/usr \
             -DFFTW3_ROOT=/usr \
             -DGDAL_ROOT=/usr \
             -DPCRE_ROOT=/usr \
             -DGMT_INSTALL_MODULE_LINKS=off \
             -DGMT_INSTALL_TRADITIONAL_FOLDERNAMES=off \
             -DLICENSE_RESTRICTED=LGPL

%:
	dh $@ --buildsystem cmake \
	      --sourcedirectory=$(CURDIR) --builddirectory=$(BUILDDIR) \
	      --parallel

override_dh_clean:
	dh_clean debian/man/*.1

override_dh_auto_configure:
	dh_auto_configure -- $(CMAKE_OPTS)

override_dh_auto_build-arch:
	dh_auto_build -a

override_dh_auto_build-indep:
	$(MAKE) -C $(BUILDDIR) docs_man docs_html

override_dh_auto_install:
	# Create man pages from DocBook XML
	for x in $(MANPAGES) ; do \
	  docbook2x-man --string-param header-3="$(BUILD_DATE)" $$x ; \
	  mv `basename $$x | sed 's/.xml$$//'` `dirname $$x` ; \
	done

	dh_auto_install

	# Uncompress examples stuff 
	#find  $(CURDIR)/debian/gmt-examples/usr/share/doc/gmt-examples/examples -name "*.gz" -exec gunzip {} \;
	# Remove +x 
	#find  $(CURDIR)/debian/gmt-examples/usr/share/doc/gmt-examples/examples -name "*.bat" -exec chmod -x {} \;

	# Remove executable bit from shell includes & examples
	chmod -x debian/tmp/usr/share/gmt/tools/gmt_aliases.csh \
	         debian/tmp/usr/share/doc/gmt/examples/ex41/my_color.cpt \
	         debian/tmp/usr/share/doc/gmt/examples/ex41/my_data.txt \
	         debian/tmp/usr/share/doc/gmt/examples/ex41/my_symbol.def \
	         debian/tmp/usr/share/doc/gmt/examples/ex41/my_table.txt

	# Remove embedded sphinx copies of JS libraries in favor of packaged ones
	rm -f debian/tmp/usr/share/doc/gmt/html/_static/jquery.js \
	      debian/tmp/usr/share/doc/gmt/html/_static/underscore.js

	# Remove empty directory
	rm -rfv debian/tmp/usr/share/doc/gmt/html/_images/math/

	# Remove extra license files
	rm -rf debian/tmp/usr/share/doc/gmt/copying/

	# Fix bash-completion installation
	mkdir -p debian/tmp/usr/share/bash-completion/completions
	mv debian/tmp/usr/etc/bash_completion.d/gmt debian/tmp/usr/share/bash-completion/completions
	rm -rf debian/tmp/usr/etc/bash_completion.d
	rmdir debian/tmp/usr/etc/

	# Strip RPATH
	chrpath --delete \
	        debian/tmp/usr/lib/*/gmt/plugins/supplements.so \
	        debian/tmp/usr/lib/*/lib*.so.*.* \
	        debian/tmp/usr/bin/gmt

override_dh_install:
	dh_install --list-missing

override_dh_installman:
	dh_installman

	# Fix gmt_shell_functions.sh man page installation
	if [ -e "debian/gmt-common/usr/share/man/sh/man1/gmt_shell_functions.1gmt" ]; then \
		mv debian/gmt-common/usr/share/man/sh/man1/gmt_shell_functions.1gmt \
		   debian/gmt-common/usr/share/man/man1/gmt_shell_functions.sh.1gmt ; \
		rm -rf debian/gmt-common/usr/share/man/sh/ ; \
	fi

override_dh_compress:
	# Don't compress the pdf files needed for the gmt-doc-pdf package, nor the examples
	dh_compress -X.pdf -Xusr/share/doc/gmt-examples/examples/

override_dh_strip:
	dh_strip --dbg-package=gmt-dbg

override_dh_makeshlibs:
	dh_makeshlibs -- -v$(UPSTREAM_VERSION)