Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2
3 # Uncomment this to turn on verbose mode.
4 #export DH_VERBOSE=1
5
6 # Enable hardening build flags
7 export DEB_BUILD_MAINT_OPTIONS=hardening=+all
8
9 VERSION=$(shell echo `head -2 $(CURDIR)/include/VERSION` | sed -e 's/ //')
10 ABI=$(shell echo `head -3 $(CURDIR)/include/VERSION` | sed -e 's/ //g' -e 's/RC/-/')
11 GRASS_ABI=grass$(ABI)
12 BASE_NAME=grass$(VERSION)
13 PKG_NAME=grass
14
15 # TODO: fix these
16 CFLAGS+=-Wno-error=format-security
17
18 CFLAGS+=-Wall
19
20 CFLAGS+=-DNDEBUG
21
22 # Use SOURCE_DATE_EPOCH as random seed for reproducible builds
23 ifdef SOURCE_DATE_EPOCH
24 export GRASS_RANDOM_SEED=$(SOURCE_DATE_EPOCH)
25 endif
26
27 versions:
28 @echo "Version: $(VERSION)"
29 @echo "ABI: $(ABI)"
30
31 %:
32 dh $@
33
34 execute_after_dh_clean:
35 $(RM) lib/proj/nad2bin
36 $(RM) utils/timer/main.o
37 $(RM) raster/r.terraflow/IOStream/lib/src/libiostream.a
38 $(RM) debian/$(BASE_NAME).1
39 $(RM) debian/grass-gui.image-file-in-usr-lib.list
40 $(RM) error.log
41
42 # clean doxygen documentation (programming man)
43 $(RM) doxygen_sqlite3.db lib/doxygen_sqlite3.db
44 $(RM) -r \
45 doxygenhtml \
46 html latex \
47 rfc/html rfc/latex \
48 lib/html lib/latex \
49 gui/wxpython/html gui/wxpython/latex
50 for LIBRARY in \
51 db \
52 g3d \
53 gis \
54 gmath \
55 gpde \
56 ogsf \
57 proj \
58 python \
59 segment \
60 vector \
61 vector/dglib ; \
62 do \
63 $(RM) -r lib/$$LIBRARY/html lib/$$LIBRARY/latex ; \
64 done
65
66 override_dh_auto_clean:
67 [ ! -f $(CURDIR)/include/Make/Platform.make ] || $(MAKE) distclean
68
69 override_dh_auto_configure:
70 dh_auto_configure -- \
71 --prefix=/usr/lib \
72 --enable-largefile \
73 --enable-socket \
74 --enable-shared \
75 --with-blas \
76 --with-bzlib \
77 --with-cairo \
78 --with-cxx \
79 --with-freetype \
80 --with-freetype-includes=/usr/include/freetype2 \
81 --with-gdal \
82 --with-geos \
83 --with-lapack \
84 --with-motif \
85 --with-mysql \
86 --with-mysql-includes="$(shell mysql_config --include | sed -e 's/-I//g')" \
87 --with-netcdf \
88 --with-nls \
89 --with-odbc \
90 --with-openmp \
91 --with-pdal=no \
92 --with-postgres \
93 --with-postgres-includes=$(shell pg_config --includedir) \
94 --with-proj-share=/usr/share/proj \
95 --with-python \
96 --with-readline \
97 --with-sqlite \
98 --with-x \
99 --with-zstd
100
101 execute_after_dh_auto_build:
102 chmod 755 debian/fixpaths.sh
103
104 # generate the Programmers' manual (in HTML)
105 $(MAKE) htmldocs-single
106
107 # Strip build path
108 sed -i "s@$(CURDIR)@@g" lib/html/search/*.js
109
110 override_dh_auto_install:
111 # install grass core into debian/tmp
112 dh_auto_install -- \
113 INST_DIR=/usr/lib/$(BASE_NAME) \
114 UNIX_BIN=/usr/bin
115
116 # fix links
117 debian/fixpaths.sh $(CURDIR)/debian/tmp debian/tmp
118
119 # delete python compiled bytecode files (maybe dh_python2 takes care of this for us?)
120 find debian/tmp/ -type f -name "*.pyc" -delete
121 find debian/tmp/ -type d -name "__pycache__" -delete
122
123 # change section from 1 to .1grass
124 for m in debian/tmp/usr/lib/$(BASE_NAME)/docs/man/man1/*.1; do \
125 n=`basename $$m .1`; mv $$m debian/tmp/usr/lib/$(BASE_NAME)/docs/man/man1/$$n.1grass; done
126 for m in debian/tmp/usr/lib/$(BASE_NAME)/docs/man/man1/*.1grass; do \
127 sed -i -e 's/^.TH \(.*\) 1/.TH \1 1grass/' "$$m"; done
128
129 # escape minus signs which are command line options not hyphens
130 for m in debian/tmp/usr/lib/$(BASE_NAME)/docs/man/man1/*.1grass; do \
131 sed -i -e 's/\([ ([]\)-\([a-z]\)/\1\\-\2/g' \
132 -e 's/\([ []\)--\([a-z]\)/\1\\-\\-\2/g' \
133 -e 's/\[-\\fB/[\\-\\fB/' \
134 -e 's/\[--\\fB/[\\-\\-\\fB/g' \
135 -e 's/"\\fB-\([a-zA-Z0-9]\)/"\\fB\\-\1/' \
136 -e 's/"\\fB--\([a-zA-Z0-9]\)/"\\fB\\-\\-\1/' \
137 -e 's/\\fI-\([a-zA-Z0-9]\)/\\fI\-\1/g' \
138 "$$m"; done
139
140 # adjust from build-server build dir to end-user's install dir
141 sed -i -e "s+^\(GRASS_HOME[ ]*=\) .*+\1 /usr/lib/$(BASE_NAME)+" \
142 -e "s+^\(RUN_GISBASE[ ]*=\) .*+\1 /usr/lib/$(BASE_NAME)+" \
143 debian/tmp/usr/lib/$(BASE_NAME)/include/Make/Platform.make
144
145 # install pkg-config file
146 mkdir -p debian/$(PKG_NAME)-dev/usr/share/pkgconfig
147 install -m 644 grass.pc debian/$(PKG_NAME)-dev/usr/share/pkgconfig/$(BASE_NAME).pc
148
149 # install icons and desktop file
150 mkdir -p debian/tmp/usr/share/icons
151 mv debian/tmp/usr/lib/$(BASE_NAME)/share/icons/hicolor debian/tmp/usr/share/icons
152
153 mkdir -p debian/tmp/usr/share/applications
154 mv debian/tmp/usr/lib/$(BASE_NAME)/share/applications/grass.desktop debian/tmp/usr/share/applications/$(BASE_NAME).desktop
155
156 # install AppStream metadata
157 mkdir -p debian/tmp/usr/share/metainfo
158 mv debian/tmp/usr/lib/$(BASE_NAME)/share/metainfo/org.osgeo.grass.appdata.xml debian/tmp/usr/share/metainfo/org.osgeo.grass.appdata.xml
159
160 # install grass wrapper scripts
161 install -m 755 debian/x-grass debian/tmp/usr/bin/x-grass
162
163 # Remove files not installed or installed by debhelper
164 $(RM) -r debian/tmp/usr/lib/$(BASE_NAME)/AUTHORS \
165 debian/tmp/usr/lib/$(BASE_NAME)/CITING \
166 debian/tmp/usr/lib/$(BASE_NAME)/COPYING \
167 debian/tmp/usr/lib/$(BASE_NAME)/GPL.TXT \
168 debian/tmp/usr/lib/$(BASE_NAME)/INSTALL.md \
169 debian/tmp/usr/lib/$(BASE_NAME)/REQUIREMENTS.md \
170 debian/tmp/usr/lib/$(BASE_NAME)/config.status \
171 debian/tmp/usr/lib/$(BASE_NAME)/contributors.csv \
172 debian/tmp/usr/lib/$(BASE_NAME)/contributors_extra.csv \
173 debian/tmp/usr/lib/$(BASE_NAME)/demolocation/PERMANENT/.tmp/* \
174 debian/tmp/usr/lib/$(BASE_NAME)/translation_status.json \
175 debian/tmp/usr/lib/$(BASE_NAME)/translators.csv
176
177 # Move image files from /usr/lib/$(BASE_NAME) to /usr/share/$(BASE_NAME)
178 mkdir -p debian/tmp/usr/share/$(BASE_NAME)/gui
179 mv debian/tmp/usr/lib/$(BASE_NAME)/gui/icons/ debian/tmp/usr/share/$(BASE_NAME)/gui/
180 mv debian/tmp/usr/lib/$(BASE_NAME)/gui/images/ debian/tmp/usr/share/$(BASE_NAME)/gui/
181
182 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
183
184 while read file; do \
185 dir=`dirname "$$file" | sed 's/usr\/lib\//usr\/share\//'` ; \
186 if [ ! -e "$$dir" ]; then \
187 mkdir -p "$$dir" ; \
188 fi ; \
189 mv "$$file" "$$dir" ; \
190 done < debian/grass-gui.image-file-in-usr-lib.list
191
192 # Remove empty files
193 find debian/tmp/ -type f -empty -name "class_graphical*" -print -delete
194
195 execute_before_dh_install:
196 # Strip binaries
197 strip --strip-unneeded --remove-section=.comment --remove-section=.note debian/tmp/usr/lib/$(BASE_NAME)/bin/r.in.png
198 strip --strip-unneeded --remove-section=.comment --remove-section=.note debian/tmp/usr/lib/$(BASE_NAME)/bin/r.out.png
199
200 execute_after_dh_install:
201 # delete duplicated grass-gui stuff from grass-core package
202 for COMPONENT in gui wxpython; do \
203 rm -rf debian/$(PKG_NAME)-core/usr/lib/$(BASE_NAME)/$$COMPONENT; \
204 done
205
206 override_dh_python3:
207 dh_python3 -pgrass-core -pgrass-gui -pgrass-dev
208 dh_python3 -pgrass-core /usr/lib/$(BASE_NAME)/etc/
209 dh_python3 -pgrass-core /usr/lib/$(BASE_NAME)/scripts/
210 dh_python3 -pgrass-gui /usr/lib/$(BASE_NAME)/gui/
211 dh_python3 -pgrass-dev /usr/lib/$(BASE_NAME)/utils/
212
213 override_dh_numpy3:
214 dh_numpy3 -pgrass-core -pgrass-gui
215
216 override_dh_shlibdeps:
217 dh_shlibdeps -l$(CURDIR)/debian/tmp/usr/lib/$(BASE_NAME)/lib
218
219 override_dh_compress:
220 dh_compress -XAUTHORS
221
222 override_dh_fixperms:
223 dh_fixperms -Xr.in.png -Xr.out.png
224
225 override_dh_gencontrol:
226 dh_gencontrol -- -Vgrass:Provides="$(GRASS_ABI)"
227
228 .PHONY: versions