Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2
3 export DH_OPTIONS
4
5 # Upstream handles the _FORTIFY_SOURCE flag on their own
6 DEB_BUILD_MAINT_OPTIONS = hardening=+all,-fortify future=+lfs
7
8 include /usr/share/dpkg/default.mk
9
10 BUILDER = [email protected]
11
12 # Work around #1082125
13 ifeq (s390x,$(DEB_HOST_ARCH))
14 CFLAGS += -O1
15 endif
16
17 MAKETEST = no
18 ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
19 MAKETEST = yes
20 endif
21
22 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
23 NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
24 MAKEFLAGS += -j$(NUMJOBS)
25 endif
26
27 ifneq (,$(filter pkg.vim.noruby,$(DEB_BUILD_PROFILES)))
28 RUBY_SUBSTVARS = -Vvim:Ruby-Provides= -Vvim:Ruby-Desc=
29 RUBY_CFGFLAGS = --disable-ruby
30 else ifneq (,$(filter alpha ia64,$(DEB_HOST_ARCH)))
31 # Disable ruby on these architectures at the request of porters (c.f., #983308)
32 RUBY_SUBSTVARS = -Vvim:Ruby-Provides= -Vvim:Ruby-Desc=
33 RUBY_CFGFLAGS = --disable-rubyinterp
34 else
35 RUBY_SUBSTVARS = -Vvim:Ruby-Provides='vim-ruby (= $${binary:Version})' -Vvim:Ruby-Desc=' Ruby,'
36 RUBY_CFGFLAGS = --enable-rubyinterp
37 endif
38
39 # Set to TEST_SKIP_PAT=<vim pattern> to exclude running tests matching the pattern
40 EXCLUDE_PAT = TEST_SKIP_PAT='Test_crash1\|glvs\|termdebug\|Test_client_server_stopinsert'
41
42 CFGFLAGS = --prefix=/usr --mandir='$${prefix}'/share/man --without-local-dir
43 CFGFLAGS += --with-modified-by="$(BUILDER)"
44 CFGFLAGS += --with-compiledby="$(BUILDER)"
45 CFGFLAGS += --enable-fail-if-missing
46 CFGFLAGS += --with-global-runtime='/var/lib/vim/addons,/etc/vim,$$VIM/vimfiles'
47 CFGFLAGS += --disable-gtk4-check
48
49 TINYFLAGS = --with-features=small
50 TINYFLAGS += --disable-gui
51 TINYFLAGS += --disable-xsmp
52 TINYFLAGS += --disable-xsmp-interact
53 TINYFLAGS += --disable-netbeans
54 TINYFLAGS += --disable-gpm
55 TINYFLAGS += --enable-nls
56 TINYFLAGS += --enable-acl
57 TINYFLAGS += --disable-terminal
58 TINYFLAGS += --disable-canberra
59 TINYFLAGS += --disable-libsodium
60
61 OPTFLAGS = --enable-cscope
62 ifeq ($(DEB_HOST_ARCH_OS),linux)
63 OPTFLAGS += --enable-gpm
64 OPTFLAGS += --enable-selinux --disable-smack
65 TINYFLAGS += --enable-selinux --disable-smack
66 else
67 OPTFLAGS += --disable-gpm
68 endif
69 OPTFLAGS += --with-features=huge
70 OPTFLAGS += --enable-acl
71 OPTFLAGS += --enable-terminal
72 OPTFLAGS += --enable-libsodium
73
74 NOXFLAGS = --without-x
75 NOXFLAGS += --enable-gui=no
76 NOXFLAGS += --disable-canberra
77 NOXFLAGS += --without-wayland
78
79 GUIFLAGS = --with-x
80 GUIFLAGS += --enable-xim
81 GUIFLAGS += --enable-canberra
82 ifneq ($(DEB_HOST_ARCH_OS),hurd)
83 GUIFLAGS += --with-wayland
84 else
85 GUIFLAGS += --without-wayland
86 endif
87
88 GTK3FLAGS = --enable-gui=gtk3
89 GTK3FLAGS += --enable-gtk3-check
90 GTK3FLAGS += --disable-gnome-check
91 GTK3FLAGS += --disable-motif-check
92 GTK3FLAGS += --disable-motif-check
93 GTK3FLAGS += --disable-fontset
94
95 MOTIFFLAGS = --enable-gui=motif
96 MOTIFFLAGS += --disable-gtk2-check
97 MOTIFFLAGS += --disable-gtk3-check
98 MOTIFFLAGS += --disable-gnome-check
99 MOTIFFLAGS += --disable-motif-check
100 MOTIFFLAGS += --enable-motif-check
101 MOTIFFLAGS += --enable-fontset
102
103 NOINTERPFLAGS = --disable-luainterp
104 NOINTERPFLAGS += --disable-mzschemeinterp
105 NOINTERPFLAGS += --disable-perlinterp
106 ifeq ($(DEB_VENDOR),Ubuntu)
107 NOINTERPFLAGS += --enable-python3interp --with-python3-config-dir=$(shell python3-config --configdir)
108 NOINTERPFLAGS += --disable-pythoninterp
109 else
110 NOINTERPFLAGS += --disable-pythoninterp
111 NOINTERPFLAGS += --disable-python3interp
112 endif
113 NOINTERPFLAGS += --disable-rubyinterp
114 NOINTERPFLAGS += --disable-tclinterp
115
116 ALLINTERPFLAGS = --enable-luainterp
117 ALLINTERPFLAGS += --disable-mzschemeinterp
118 ALLINTERPFLAGS += --enable-perlinterp
119 ALLINTERPFLAGS += --enable-python3interp --with-python3-config-dir=$(shell python3-config --configdir)
120 ALLINTERPFLAGS += --disable-pythoninterp
121 ALLINTERPFLAGS += --enable-tclinterp
122 ALLINTERPFLAGS += --with-tclsh=/usr/bin/tclsh
123
124 # Each vim-xxx package is said to be a vim variant and contains only a vim
125 # binary built with some compile-time options. Makefile VARIANTS below are
126 # one-to-one with those packages with the exception of "vim-basic". In this
127 # Makefile vim-basic is used to build 4 packages: "vim", "vim-runtime",
128 # "vim-common", "vim-gui-common". "vim-tiny" is the only variant package not
129 # depending on vim-runtime.
130
131 VARIANTS += vim-tiny
132 VARIANTS += vim-gtk3
133 VARIANTS += vim-motif
134 VARIANTS += vim-nox
135 VARIANTS += vim-basic
136
137 ifneq ($(origin VARIANT), undefined)
138 VARIANTS = $(VARIANT) vim-basic
139 endif
140
141 CFLAGS += -DSYS_VIMRC_FILE="'\"/etc/vim/vimrc\"'" -DSYS_GVIMRC_FILE="'\"/etc/vim/gvimrc\"'"
142
143 CFLAGS_vim-basic = $(CFLAGS)
144 CFGFLAGS_vim-basic = $(CFGFLAGS) $(OPTFLAGS) $(NOXFLAGS) $(NOINTERPFLAGS)
145
146 CFLAGS_vim-tiny = $(CFLAGS) -DTINY_VIMRC -DSYS_TINYRC_FILE="'\"/etc/vim/vimrc.tiny\"'"
147 CFGFLAGS_vim-tiny = $(CFGFLAGS) $(TINYFLAGS)
148
149 CFLAGS_vim-gtk3 = $(CFLAGS)
150 CFGFLAGS_vim-gtk3 = $(CFGFLAGS) $(OPTFLAGS) $(GUIFLAGS) $(ALLINTERPFLAGS) $(GTK3FLAGS) $(RUBY_CFGFLAGS)
151
152 CFLAGS_vim-motif = $(CFLAGS)
153 CFGFLAGS_vim-motif = $(CFGFLAGS) $(OPTFLAGS) $(GUIFLAGS) $(MOTIFFLAGS) $(ALLINTERPFLAGS) $(RUBY_CFGFLAGS)
154
155 CFLAGS_vim-nox = $(CFLAGS)
156 CFGFLAGS_vim-nox = $(CFGFLAGS) $(OPTFLAGS) $(NOXFLAGS) $(ALLINTERPFLAGS) $(RUBY_CFGFLAGS)
157
158 NAME = vim
159 # Convert x.y.z to x.y
160 VERSION = $(basename $(DEB_VERSION_UPSTREAM))
161 VIMMAJOR = $(basename $(VERSION))
162 VIMCUR = $(NAME)$(subst .,,$(VERSION))
163 LANGS = da de fr it ja pl ru sv tr
164
165 DOT_IN_DEPS = debian/vim-runtime.postrm
166 DOT_IN_DEPS += debian/vim-runtime.preinst
167 DOT_IN_DEPS_TINY = debian/tiny/vimrc.tiny
168
169 foreach-variant = \
170 set -e; for v in $(VARIANTS); do \
171 $1; \
172 done
173
174 %:
175 dh $@
176
177 override_dh_auto_clean:
178 # The vim-basic variant is always enabled, so we can rely on it when checking
179 # whether we can call "make distclean". The config.cache check is to avoid
180 # calling make when configure has not run, otherwise make will run configure to
181 # generate an include file
182 [ ! -f src/vim-basic/auto/config.cache ] || make distclean
183 [ ! -f debian/configure.dist ] || mv debian/configure.dist src/auto/configure
184 find src/testdir -name '*.pyc' -delete
185 for v in $(VARIANTS); do \
186 if [ "$${v}" = vim-basic ]; then \
187 [ ! -L src/"$${v}"/po ] || $(MAKE) -C src/"$${v}"/po clean; \
188 fi; \
189 rm -rf src/"$${v}"; \
190 done
191 rm -f $(DOT_IN_DEPS)
192 rm -f $(DOT_IN_DEPS_TINY)
193
194 override_dh_auto_configure-indep: autoconf-stamp
195 $(MAKE) -f debian/rules configure-vim-basic
196
197 override_dh_auto_configure-arch: autoconf-stamp
198 $(call foreach-variant, $(MAKE) -f debian/rules configure-"$${v}")
199
200 override_dh_auto_build-indep: autoconf-stamp
201 override_dh_auto_build-indep:
202 $(MAKE) -f debian/rules build-vim-basic
203 $(MAKE) -C runtime/doc html
204 $(MAKE) -C debian/policy text html
205 $(MAKE) -C src/po vim.pot VIMPROG=$(CURDIR)/src/vim-basic/vim
206
207 override_dh_auto_build-arch: autoconf-stamp
208 $(call foreach-variant, $(MAKE) -f debian/rules build-"$${v}")
209 $(MAKE) -C src/vim-basic xxd/xxd
210
211 override_dh_auto_test-indep:
212
213 override_dh_auto_test-arch:
214 $(call foreach-variant, $(MAKE) -f debian/rules test-"$${v}")
215
216 autoconf-stamp:
217 dh_testdir
218 [ -f debian/configure.dist ] || cp src/auto/configure debian/configure.dist
219 # The autoconf target generates a new configure, and touches some other
220 # configure-related things. Need to run scratch afterward or timestamps
221 # will be off and the next make that runs will think it needs to run
222 # configure. This breaks parallel builds since two configures are being run
223 # in the same directory at the same time instead of in their own shadow
224 # directories.
225 $(MAKE) -C src autoconf
226 $(MAKE) -C src scratch
227 touch $@
228
229 src/vim-%: VARIANT=vim-$*
230 src/vim-%:
231 $(MAKE) -C src shadow SHADOWDIR=$(VARIANT)
232
233 configure-vim-%: VARIANT=vim-$*
234 configure-vim-%: autoconf-stamp
235 configure-vim-%:
236 $(MAKE) -f debian/rules src/$(VARIANT)
237 cd src/$(VARIANT) && LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS_$(VARIANT))" ./configure $(CFGFLAGS_$(VARIANT))
238
239 build-vim-%: VARIANT=vim-$*
240 build-vim-%: configure-$(VARIANT)
241 build-vim-%:
242 $(MAKE) -C src/$(VARIANT)
243 $(MAKE) -C runtime/doc tags VIMPROG=$(CURDIR)/src/$(VARIANT)/vim
244
245 test-vim-%: VARIANT=vim-$*
246 test-vim-%:
247 :
248 ifeq (yes,$(MAKETEST))
249 # Sanitize LC_* env so they don't leak through to child processes and cause problems in build chroots (e.g., missing locales)
250 # and set sane values for TERM/LC_ALL/LANG
251 for e in ADDRESS COLLATE CTYPE IDENTIFICATION MEASUREMENT MESSAGES MONETARY NAME NUMERIC PAPER TELEPHONE TIME; do \
252 unset LC_$${e}; \
253 done; \
254 env $(EXCLUDE_PAT) TERM=xterm LC_ALL=C.UTF-8 LANG=C.UTF-8 $(MAKE) -j1 -C src/$(VARIANT) test
255 endif
256
257 override_dh_auto_install-arch:
258
259 # Use UTF-8 manpages for all languages
260 # If a .UTF-8 directory doesn't exist, then the $L directory is already UTF-8.
261 define munge-man-directories
262 for L in $(LANGS); do \
263 if [ -d "$(DESTDIR)/usr/share/man/$$L.UTF-8" ]; then \
264 rm -rf "$(DESTDIR)/usr/share/man/$$L"; \
265 mv "$(DESTDIR)/usr/share/man/$$L.UTF-8" "$(DESTDIR)/usr/share/man/$$L"; \
266 fi; \
267 rm -rf "$(DESTDIR)/usr/share/man/$$L."*; \
268 done
269 endef
270
271 override_dh_auto_install-indep: DESTDIR=$(CURDIR)/debian/tmp
272 override_dh_auto_install-indep:
273 $(MAKE) -f debian/rules build-vim-basic
274 mkdir -p "$(DESTDIR)/usr/bin"
275 # installruntime requires a "vim" in /usr/bin
276 cp src/vim-basic/vim "$(DESTDIR)/usr/bin"
277 $(MAKE) -C src/vim-basic "DESTDIR=$(DESTDIR)" \
278 installtutorbin \
279 installgtutorbin \
280 installruntime \
281 install-languages \
282 install-icons
283 rm -f "$(DESTDIR)/usr/bin/vim"
284
285 COMMON_HELP_PATHS = runtime/doc/uganda.txt runtime/doc/sponsor.txt runtime/doc/version$(VIMMAJOR).txt
286 debian/tiny/doc/tags: $(COMMON_HELP_PATHS)
287 ./debian/generate-tiny-tags debian/tiny/doc/help.txt $(COMMON_HELP_PATHS) > debian/tiny/doc/tags
288
289 override_dh_install-indep: DESTDIR=$(CURDIR)/debian/tmp
290 override_dh_install-indep:
291 $(MAKE) -f debian/rules $(DOT_IN_DEPS)
292 $(munge-man-directories)
293
294 # rm stuff handled by alternatives or our own symlinks
295 find "$(DESTDIR)/usr/share/man" \( -name view.1 -o -name ex.1 -o -name rvim.1 -o -name rview.1 \) -delete
296
297 # helpztags manpage
298 pod2man -c "User Commands" -s 1 -q none -r "vim $(VERSION)" \
299 -d "August 2010" debian/helpztags debian/helpztags.1
300
301 # Icons
302 gs -sDefaultCMYKProfile=ps_cmyk.icc -sOutputICCProfile=ps_rgb.icc \
303 -dSAFER -dEPSCrop -dBATCH -dNOPAUSE \
304 -sDEVICE=ps2write -sOutputFile=debian/tmplogo.ps runtime/vimlogo.eps
305 ps2pdf debian/tmplogo.ps debian/tmplogo.pdf
306 pdf2svg debian/tmplogo.pdf debian/vim-common/usr/share/icons/hicolor/scalable/apps/gvim.svg
307
308 env VIMCUR=$(VIMCUR) VIMMAJOR=$(VIMMAJOR) dh_install -p vim-runtime $(subst runtime/doc/,-X ,$(COMMON_HELP_PATHS)) -X vim2html.pl -X 'README*.txt' -X README.el.txt -X README.el.cp737.txt
309 env VIMCUR=$(VIMCUR) VIMMAJOR=$(VIMMAJOR) dh_install -i -N vim-runtime
310 # adjust things for vim-gui-common
311 cp debian/vim-common/usr/share/man/man1/vim.1 \
312 debian/vim-gui-common/usr/share/man/man1/gvim.1
313 cp debian/vim-common/usr/share/man/man1/vimdiff.1 \
314 debian/vim-gui-common/usr/share/man/man1/gvimdiff.1
315 cp debian/vim-runtime/usr/share/man/man1/vimtutor.1 \
316 debian/vim-gui-common/usr/share/man/man1/gvimtutor.1
317 for L in $(LANGS); do \
318 DIR=usr/share/man/$$L; \
319 [ ! -e "debian/vim-common/$$DIR/man1/vim.1" ] || \
320 cp debian/vim-common/$$DIR/man1/vim.1 \
321 debian/vim-gui-common/$$DIR/man1/gvim.1; \
322 [ ! -e "debian/vim-common/$$DIR/man1/vimdiff.1" ] || \
323 cp debian/vim-common/$$DIR/man1/vimdiff.1 \
324 debian/vim-gui-common/$$DIR/man1/gvimdiff.1; \
325 [ ! -e "debian/vim-runtime/$$DIR/man1/vimtutor.1" ] || \
326 cp debian/vim-runtime/$$DIR/man1/vimtutor.1 \
327 debian/vim-gui-common/$$DIR/man1/gvimtutor.1; \
328 done
329
330 install-xxd: DESTDIR=$(CURDIR)/debian/xxd
331 install-xxd:
332 $(MAKE) -C src/vim-basic STRIP=: DESTDIR=$(DESTDIR) installtools install-tool-languages
333 rm -r $(DESTDIR)/usr/share/vim
334 $(munge-man-directories)
335 # No xxd.1 translations for these languages yet
336 for lang in da de tr.ISO8859-9 tr.UTF-8 tr; do \
337 rmdir $(DESTDIR)/usr/share/man/$$lang/man1 $(DESTDIR)/usr/share/man/$$lang; \
338 done
339
340 override_dh_auto_install-arch:
341 $(MAKE) -f debian/rules install-xxd
342
343 override_dh_bugfiles:
344 $(call foreach-variant, dh_bugfiles -A -p "$${v%-basic}")
345
346 install-vim-%: SHADOWDIR=vim-$*
347 install-vim-%: VARIANT=$*
348 install-vim-%: BIN=$(subst -,.,vim-$(VARIANT))
349 install-vim-%:
350 cp src/$(SHADOWDIR)/vim src/$(SHADOWDIR)/$(BIN)
351 [ $(VARIANT) != tiny ] || $(MAKE) -f debian/rules $(DOT_IN_DEPS_TINY) debian/tiny/doc/tags
352
353 override_dh_install-arch:
354 $(call foreach-variant, $(MAKE) -f debian/rules install-$${v})
355 env VIMCUR=$(VIMCUR) VIMMAJOR=$(VIMMAJOR) dh_install -a
356
357 $(DOT_IN_DEPS) $(DOT_IN_DEPS_TINY): %: %.in
358 cat $< | sed 's/@VIMCUR@/$(VIMCUR)/' > $@
359
360 override_dh_gencontrol:
361 dh_gencontrol -- $(RUBY_SUBSTVARS)
362
363 .NOTPARALLEL:
364 # vim: set foldmethod=marker: