File: rules

package info (click to toggle)
grass 8.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 277,040 kB
  • sloc: ansic: 460,798; python: 227,732; cpp: 42,026; sh: 11,262; makefile: 7,007; xml: 3,637; sql: 968; lex: 520; javascript: 484; yacc: 450; asm: 387; perl: 157; sed: 25; objc: 6; ruby: 4
file content (235 lines) | stat: -rwxr-xr-x 7,971 bytes parent folder | download | duplicates (2)
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
228
229
230
231
232
233
234
235
#!/usr/bin/make -f

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

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

VERSION=$(shell echo `head -2 $(CURDIR)/include/VERSION` | sed -e 's/ //')
ABI=$(shell echo `head -3 $(CURDIR)/include/VERSION` | sed -e 's/ //g' -e 's/RC/-/')
GRASS_ABI=grass$(ABI)
BASE_NAME=grass$(VERSION)
PKG_NAME=grass

# TODO: fix these
CFLAGS+=-Wno-error=format-security

CFLAGS+=-Wall

CFLAGS+=-DNDEBUG

TEMPLATES=$(wildcard debian/*.in)

# Use SOURCE_DATE_EPOCH as random seed for reproducible builds
ifdef SOURCE_DATE_EPOCH
	export GRASS_RANDOM_SEED=$(SOURCE_DATE_EPOCH)
endif

versions:
	@echo "Version: $(VERSION)"
	@echo "ABI: $(ABI)"

templates:
	for TEMPLATE in $(TEMPLATES) ; do \
	    sed -e 's/@VERSION@/$(VERSION)/g' -e 's/@ABI@/$(ABI)/g' $$TEMPLATE > `echo $$TEMPLATE | sed 's/.in$$//'` ; \
	done

%:
	dh $@

execute_after_dh_clean:
	$(RM) lib/proj/nad2bin
	$(RM) utils/timer/main.o
	$(RM) raster/r.terraflow/IOStream/lib/src/libiostream.a
	$(RM) debian/$(BASE_NAME).1
	$(RM) debian/grass-gui.image-file-in-usr-lib.list
	$(RM) error.log

	# clean doxygen documentation (programming man)
	$(RM) doxygen_sqlite3.db lib/doxygen_sqlite3.db
	$(RM) -r \
		doxygenhtml \
		html latex \
		rfc/html rfc/latex \
		lib/html lib/latex \
		gui/wxpython/html gui/wxpython/latex
	for LIBRARY in \
		db \
		g3d \
		gis \
		gmath \
		gpde \
		ogsf \
		proj \
		python \
		segment \
		vector \
		vector/dglib ; \
	do \
		$(RM) -r lib/$$LIBRARY/html lib/$$LIBRARY/latex ; \
	done

override_dh_auto_clean:
	[ ! -f $(CURDIR)/include/Make/Platform.make ] || $(MAKE) distclean

override_dh_auto_configure: templates
	dh_auto_configure -- \
                    --prefix=/usr/lib \
                    --enable-largefile \
                    --enable-socket \
                    --enable-shared \
                    --with-blas \
                    --with-bzlib \
                    --with-cairo \
                    --with-cxx \
                    --with-freetype \
                    --with-freetype-includes=/usr/include/freetype2 \
                    --with-gdal \
                    --with-geos \
                    --with-lapack \
                    --with-motif \
                    --with-mysql \
                    --with-mysql-includes="$(shell mysql_config --include | sed -e 's/-I//g')" \
                    --with-netcdf \
                    --with-nls \
                    --with-odbc \
                    --with-openmp \
                    --with-pdal=no \
                    --with-postgres \
                    --with-postgres-includes=$(shell pg_config --includedir) \
                    --with-proj-share=/usr/share/proj \
                    --with-python \
                    --with-readline \
                    --with-sqlite \
                    --with-x \
                    --with-zstd

execute_after_dh_auto_build:
	chmod 755 debian/fixpaths.sh

	# generate the Programmers' manual (in HTML)
	$(MAKE) htmldocs-single

	# Strip build path
	sed -i "s@$(CURDIR)@@g" lib/html/search/*.js

override_dh_auto_install:
	# install grass core into debian/tmp
	dh_auto_install -- \
		INST_DIR=/usr/lib/$(BASE_NAME) \
		UNIX_BIN=/usr/bin

	# fix links
	debian/fixpaths.sh $(CURDIR)/debian/tmp debian/tmp

	# delete python compiled bytecode files (maybe dh_python2 takes care of this for us?)
	find debian/tmp/ -type f -name "*.pyc" -delete
	find debian/tmp/ -type d -name "__pycache__" -delete

	# change section from 1 to .1grass
	for m in debian/tmp/usr/lib/$(BASE_NAME)/docs/man/man1/*.1; do \
		n=`basename $$m .1`; mv $$m debian/tmp/usr/lib/$(BASE_NAME)/docs/man/man1/$$n.1grass; done
	for m in debian/tmp/usr/lib/$(BASE_NAME)/docs/man/man1/*.1grass; do \
		sed -i -e 's/^.TH \(.*\) 1/.TH \1 1grass/' "$$m"; done

	# escape minus signs which are command line options not hyphens
	for m in debian/tmp/usr/lib/$(BASE_NAME)/docs/man/man1/*.1grass; do \
		sed -i -e 's/\([ ([]\)-\([a-z]\)/\1\\-\2/g' \
			-e 's/\([ []\)--\([a-z]\)/\1\\-\\-\2/g' \
			-e 's/\[-\\fB/[\\-\\fB/' \
			-e 's/\[--\\fB/[\\-\\-\\fB/g' \
			-e 's/"\\fB-\([a-zA-Z0-9]\)/"\\fB\\-\1/' \
			-e 's/"\\fB--\([a-zA-Z0-9]\)/"\\fB\\-\\-\1/' \
			-e 's/\\fI-\([a-zA-Z0-9]\)/\\fI\-\1/g' \
			"$$m"; done

	# adjust from build-server build dir to end-user's install dir
	sed -i -e "s+^\(GRASS_HOME[ ]*=\) .*+\1 /usr/lib/$(BASE_NAME)+" \
		-e "s+^\(RUN_GISBASE[ ]*=\) .*+\1 /usr/lib/$(BASE_NAME)+" \
		debian/tmp/usr/lib/$(BASE_NAME)/include/Make/Platform.make

	# install pkg-config file
	mkdir -p debian/$(PKG_NAME)-dev/usr/share/pkgconfig
	install -m 644 grass.pc debian/$(PKG_NAME)-dev/usr/share/pkgconfig/$(BASE_NAME).pc

	# install icons and desktop file
	mkdir -p debian/tmp/usr/share/icons
	mv debian/tmp/usr/lib/$(BASE_NAME)/share/icons/hicolor debian/tmp/usr/share/icons

	mkdir -p debian/tmp/usr/share/applications
	mv debian/tmp/usr/lib/$(BASE_NAME)/share/applications/grass.desktop debian/tmp/usr/share/applications/$(BASE_NAME).desktop

	# install AppStream metadata
	mkdir -p debian/tmp/usr/share/metainfo
	mv debian/tmp/usr/lib/$(BASE_NAME)/share/metainfo/org.osgeo.grass.appdata.xml debian/tmp/usr/share/metainfo/org.osgeo.grass.appdata.xml

	# install grass wrapper scripts
	install -m 755 debian/x-grass debian/tmp/usr/bin/x-grass

	# Remove files not installed or installed by debhelper
	$(RM) -r debian/tmp/usr/lib/$(BASE_NAME)/AUTHORS \
	         debian/tmp/usr/lib/$(BASE_NAME)/CITING \
	         debian/tmp/usr/lib/$(BASE_NAME)/COPYING \
	         debian/tmp/usr/lib/$(BASE_NAME)/GPL.TXT \
	         debian/tmp/usr/lib/$(BASE_NAME)/INSTALL.md \
	         debian/tmp/usr/lib/$(BASE_NAME)/REQUIREMENTS.md \
	         debian/tmp/usr/lib/$(BASE_NAME)/config.status \
	         debian/tmp/usr/lib/$(BASE_NAME)/contributors.csv \
	         debian/tmp/usr/lib/$(BASE_NAME)/contributors_extra.csv \
	         debian/tmp/usr/lib/$(BASE_NAME)/demolocation/PERMANENT/.tmp/* \
	         debian/tmp/usr/lib/$(BASE_NAME)/translation_status.json \
	         debian/tmp/usr/lib/$(BASE_NAME)/translators.csv

	# Move image files from /usr/lib/$(BASE_NAME) to /usr/share/$(BASE_NAME)
	mkdir -p debian/tmp/usr/share/$(BASE_NAME)/gui
	mv debian/tmp/usr/lib/$(BASE_NAME)/gui/icons/  debian/tmp/usr/share/$(BASE_NAME)/gui/
	mv debian/tmp/usr/lib/$(BASE_NAME)/gui/images/ debian/tmp/usr/share/$(BASE_NAME)/gui/

	find debian/tmp/usr/lib/$(BASE_NAME)/gui/wxpython/ -type f \( -name "*.jpg" -or -name "*.png" \) -print | sort > debian/grass-gui.image-file-in-usr-lib.list

	while read file; do \
		dir=`dirname "$$file" | sed 's/usr\/lib\//usr\/share\//'` ; \
		if [ ! -e "$$dir" ]; then \
			mkdir -p "$$dir" ; \
		fi ; \
		mv "$$file" "$$dir" ; \
	done < debian/grass-gui.image-file-in-usr-lib.list

	# Remove empty files
	find debian/tmp/ -type f -empty -name "class_graphical*" -print -delete

execute_before_dh_install:
	# Strip binaries
	strip --strip-unneeded --remove-section=.comment --remove-section=.note debian/tmp/usr/lib/$(BASE_NAME)/bin/r.in.png
	strip --strip-unneeded --remove-section=.comment --remove-section=.note debian/tmp/usr/lib/$(BASE_NAME)/bin/r.out.png

execute_after_dh_install:
	# delete duplicated grass-gui stuff from grass-core package
	for COMPONENT in gui wxpython; do \
		rm -rf debian/$(PKG_NAME)-core/usr/lib/$(BASE_NAME)/$$COMPONENT; \
	done

override_dh_python3:
	dh_python3 -pgrass-core -pgrass-gui -pgrass-dev
	dh_python3 -pgrass-core /usr/lib/$(BASE_NAME)/etc/
	dh_python3 -pgrass-core /usr/lib/$(BASE_NAME)/scripts/
	dh_python3 -pgrass-gui /usr/lib/$(BASE_NAME)/gui/
	dh_python3 -pgrass-dev /usr/lib/$(BASE_NAME)/utils/

override_dh_numpy3:
	dh_numpy3 -pgrass-core -pgrass-gui

override_dh_shlibdeps:
	dh_shlibdeps -l$(CURDIR)/debian/tmp/usr/lib/$(BASE_NAME)/lib

override_dh_compress:
	dh_compress -XAUTHORS

override_dh_fixperms:
	dh_fixperms -Xr.in.png -Xr.out.png

override_dh_gencontrol:
	dh_gencontrol -- -Vgrass:Provides="$(GRASS_ABI)"

.PHONY: templates versions