File: rules

package info (click to toggle)
gdal 3.1.3+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 103,360 kB
  • sloc: cpp: 1,113,420; ansic: 183,402; python: 24,906; perl: 7,872; sh: 6,877; java: 5,382; xml: 3,100; cs: 2,418; yacc: 1,068; makefile: 514; sql: 112
file content (227 lines) | stat: -rwxr-xr-x 7,310 bytes parent folder | download | duplicates (4)
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
#!/usr/bin/make -f
# -*- makefile -*-
#
# Original debian package by Alessandro Amici 2002-2003.
# Currently maintained by DebianGis contributors.
# Based on: GNU copyright 1997 to 1999 by Joey Hess.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

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

# Disable PIE on Ubuntu where it's still problematic
VENDOR_DERIVES_FROM_UBUNTU ?= $(shell dpkg-vendor --derives-from Ubuntu && echo yes)
DISTRIBUTION_RELEASE       := $(shell lsb_release -cs)

ifeq ($(VENDOR_DERIVES_FROM_UBUNTU),yes)
  ifneq (,$(filter $(DISTRIBUTION_RELEASE),xenial bionic))
    export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-pie
  endif
endif

include /usr/share/dpkg/pkg-info.mk

UPSTREAM_VERSION = $(shell echo $(DEB_VERSION_UPSTREAM) | sed -e 's/\+.*//')

PYVERS=$(shell py3versions -v -r)
PYDEF=$(shell py3versions -dv)
PERLDEF=$(shell perl -V:version|cut -d\' -f2)
SWIGVER=$(shell swig -version |grep Version|cut -d' ' -f3|sed -e 's/\.//g')

GDALVER=$(shell cat VERSION|sed -e 's/\./ /g')
GDAL_MAJOR=$(word 1,$(GDALVER))
GDAL_MINOR=$(word 2,$(GDALVER))
GDAL_PATCH=$(word 3,$(GDALVER))

ifeq (,$(DEB_HOST_MULTIARCH))
  DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
endif

ifneq ($(wildcard /usr/lib/$(DEB_HOST_MULTIARCH)/hdf5/serial/libhdf5.so),)
  WITH_HDF5:=--with-hdf5=/usr/lib/$(DEB_HOST_MULTIARCH)/hdf5/serial
else
  WITH_HDF5:=
endif

ifneq (,$(filter $(DEB_HOST_ARCH),amd64 i386))
  WITH_SSE=yes
  WITH_SSSE3=yes
  WITH_AVX=yes
else
  WITH_SSE=no
  WITH_SSSE3=no
  WITH_AVX=no
endif

NJOBS := -j1
ifneq (,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
NJOBS := -j$(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
endif

versions:
	@echo Gdal version: $(GDAL_MAJOR).$(GDAL_MINOR).$(GDAL_PATCH)
	@echo Swig version: $(SWIGVER)
	@echo Python default: $(PYDEF)
	@echo Python versions: $(PYVERS)
	@echo Perl default: $(PERLDEF)

#
# The following targets are useful to autogen independent plugins sources
#
gdal-grass: override_dh_auto_configure gdal-grass-dist override_dh_auto_clean override_dh_clean
gdal-grass-dist:
	ln -fs $(CURDIR)/GDALmake.opt-$(PYDEF) $(CURDIR)/GDALmake.opt
	[ -e $(CURDIR)/GDALmake.opt ] && $(MAKE) -C $(CURDIR)/frmts/grass dist
	mv $(CURDIR)/frmts/grass/libgdal-grass-*.tar.gz $(CURDIR)/..
	rm -f $(CURDIR)/GDALmake.opt

gdal-ecw: override_dh_auto_configure gdal-ecw-dist override_dh_auto_clean override_dh_clean
gdal-ecw-dist:
	ln -fs $(CURDIR)/GDALmake.opt-$(PYDEF) $(CURDIR)/GDALmake.opt
	[ -e $(CURDIR)/GDALmake.opt ] && $(MAKE) -C $(CURDIR)/frmts/ecw dist
	mv $(CURDIR)/frmts/ecw/libgdal-ecw-*.tar.gz $(CURDIR)/..
	rm -f $(CURDIR)/GDALmake.opt

gdal-mrsid: override_dh_auto_configure gdal-mrsid-dist override_dh_auto_clean override_dh_clean
gdal-mrsid-dist:
	ln -fs $(CURDIR)/GDALmake.opt-$(PYDEF) $(CURDIR)/GDALmake.opt
	[ -e $(CURDIR)/GDALmake.opt ] && $(MAKE) -C $(CURDIR)/frmts/mrsid dist
	mv $(CURDIR)/frmts/mrsid/libgdal-mrsid-*.tar.gz $(CURDIR)/..
	rm -f $(CURDIR)/GDALmake.opt

%:
	if [ "$@" != "gdal-grass" -a "$@" != "gdal-ecw" -a "$@" != "gdal-mrsid" ]; then \
		dh $@ --with python3 ; \
	fi

override_dh_clean:
	dh_clean config.log

override_dh_auto_clean:
	[ ! -f GDALmake.opt ] || $(MAKE) distclean
	rm -rf $(CURDIR)/swig/perl/*.bs $(CURDIR)/swig/perl/doc
	rm -rf $(CURDIR)/.libs
	rm -f GDALmake.opt-*
	rm -rf $(CURDIR)/debian/tmp $(CURDIR)/debian/python-tmp
	rm -rf $(CURDIR)/doc/br/html $(CURDIR)/doc/ru/html
	rm -rf $(CURDIR)/frmts/o/.libs
	rm -f  $(CURDIR)/islibdappost310.*

override_dh_auto_configure:
	for V in $(PYVERS); do \
		PYTHON=/usr/bin/python$$V ./configure --prefix=/usr \
			--mandir=\$$\{prefix\}/share/man \
			--includedir=\$$\{prefix\}/include/gdal \
			--with-hide-internal-symbols=yes \
			--with-rename-internal-libtiff-symbols=yes \
			--with-rename-internal-libgeotiff-symbols=yes \
			--with-threads \
			--with-sse=$(WITH_SSE) \
			--with-ssse3=$(WITH_SSSE3) \
			--with-avx=$(WITH_AVX) \
			--with-bash-completion=yes \
			--with-armadillo=yes \
			--with-cfitsio=yes \
			--with-charls \
			--with-curl \
			--with-ecw=no \
			--with-epsilon=/usr \
			--with-freexl=yes \
			--with-geos \
			--with-geotiff=yes \
			--with-grass=no \
			$(WITH_HDF5) \
			--with-libjson-c=/usr \
			--with-libkml=yes \
			--with-liblzma=yes \
			--with-libtiff=yes \
			--with-mrsid=no \
			--with-mysql \
			--with-netcdf \
			--with-odbc \
			--with-ogdi \
			--with-openjpeg=yes \
			--with-pg \
			--with-poppler=yes \
			--with-proj=yes \
			--with-qhull=yes \
			--with-sosi=yes \
			--with-spatialite=/usr \
			--with-sqlite3 \
			--with-webp \
			--with-xerces \
			--with-zstd \
			--with-dods-root=/usr \
			--with-perl \
			--with-python; \
		mv GDALmake.opt GDALmake.opt-$$V; \
	done

override_dh_auto_build:
	cp `ls GDALmake.opt-*|tail -1` GDALmake.opt
	$(MAKE) $(NJOBS) lib-target apps-target
	rm -rf $(CURDIR)/swig/perl/*.c  $(CURDIR)/swig/perl/*.cpp
	$(MAKE) $(NJOBS) -C $(CURDIR)/swig/perl generate build doc

	# It needs pre-installing just after the building due to intermediate cleaning.
	for V in $(PYVERS); do \
		cp GDALmake.opt-$$V GDALmake.opt && \
		$(MAKE) $(NJOBS) -C $(CURDIR)/swig/python clean && \
		$(MAKE) -C $(CURDIR)/swig/python generate && \
		$(MAKE) $(NJOBS) -C $(CURDIR)/swig/python build && \
		$(MAKE) $(NJOBS) -C $(CURDIR)/swig/python install DESTDIR=$(CURDIR)/debian/python-tmp; \
	done

override_dh_auto_install:
	cp `ls GDALmake.opt-*|tail -1` GDALmake.opt
	$(MAKE) $(NJOBS) install BINDINGS="perl" DESTDIR=$(CURDIR)/debian/tmp
	$(MAKE) $(NJOBS) install-man DESTDIR=$(CURDIR)/debian/tmp \
		"INST_MAN=\$$(prefix)/share/man"

	# install python stuff previuosly built and pre-installed
	cp -a $(CURDIR)/debian/python-tmp/usr/lib/* $(CURDIR)/debian/tmp/usr/lib/.
	install -o root -g root -d $(CURDIR)/debian/tmp/usr/bin
	install -o root -g root -m 755 $(CURDIR)/swig/python/scripts/*.py $(CURDIR)/debian/tmp/usr/bin/.

	# removing useless autogenerated man pages
	rm -f $(CURDIR)/debian/tmp/usr/share/man/man1/_*_apps_.1

	# removing license file
	rm -f $(CURDIR)/debian/tmp/usr/share/gdal/LICENSE.TXT

	# removing la file
	rm -f $(CURDIR)/debian/tmp/usr/lib/libgdal.la

	# removing embedded rpath in main lib
	-find $(CURDIR)/debian/tmp/usr/lib -type f -name "*.so*" -exec chrpath --delete {} \;

	# copy sample programs for python3-gdal
	install -o root -g root -d $(CURDIR)/debian/tmp/usr/share/doc/python3-gdal/examples
	install -o root -g root -m 755 $(CURDIR)/swig/python/samples/*.py $(CURDIR)/debian/tmp/usr/share/doc/python3-gdal/examples/.

override_dh_install:
	dh_install --autodest --list-missing

override_dh_installchangelogs:
	dh_installchangelogs NEWS

override_dh_installdocs:
	dh_installdocs -A third_party/LercLib/NOTICE

	# Remove autogenerated Doxygen files
	rm -f $(CURDIR)/debian/*/usr/share/doc/libgdal-perl-doc/*/*.md5

override_dh_python3:
	dh_python3 -X.info -pgdal-bin -ppython3-gdal --shebang=/usr/bin/python3
	dh_numpy3 -pgdal-bin -ppython3-gdal

override_dh_makeshlibs:
	# Forces failure ignoring to collect new symbols on all archs
	dh_makeshlibs -- -v$(UPSTREAM_VERSION) -c0
	# Forces failure when symbols change
	#dh_makeshlibs -- -v$(UPSTREAM_VERSION)

override_dh_shlibdeps:
	dh_shlibdeps -L libgdal26 -l debian/libgdal26/usr/lib