/[packages]/updates/8/vim/current/SPECS/vim.spec
ViewVC logotype

Contents of /updates/8/vim/current/SPECS/vim.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1744434 - (show annotations) (download)
Wed Sep 8 07:33:33 2021 UTC (2 years, 7 months ago) by neoclust
File size: 16447 byte(s)
Add Patch10000/Patch10001: Fixes CVE-2021-3770 (mga#29444)
1 # Notes / Warning :
2 # - this package is not prefixable
3 # - to update official patches, aka SOURCE4, see README.mga in SOURCE4
4
5 %define python3path %{_includedir}/%{python3}
6
7 %define patchlevel 2143
8
9 %define python_version %(rpm -q --qf '%%{epoch}:%%{version}' python)
10 %define ruby_version %(rpm -q --qf '%%{epoch}:%%{version}' ruby)
11
12 # Should we build X11 gui
13 %define buildgui 1
14
15 %{?_with_gui:%global buildgui 1}
16 %{?_without_gui:%global buildgui 0}
17
18 %define title VI editor
19 %define longtitle All-purpose text editor
20
21 %define baseversion 8.2
22 %define vimdir vim82
23
24 Name: vim
25 Version: %{baseversion}.%{patchlevel}
26 Release: %mkrel 3
27 Summary: VIsual editor iMproved
28 Url: http://www.vim.org/
29 License: Charityware
30 Group: Editors
31 # Generated with SOURCES/vim-update.sh
32 Source0: ftp://ftp.vim.org/pub/vim/unix/vim-%{baseversion}-%{patchlevel}.tar.bz2
33 # read README.mga prior updating official patches:
34 Source3: README.mga
35 # http://vim.sourceforge.net/scripts/script.php?script_id=98
36 Source56: http://trific.ath.cx/Ftp/vim/syntax/dhcpd.vim
37 # from apparmor-utils package
38 Source57: apparmor.vim
39 Source58: cfengine.vim
40 Source59: nagios.vim
41 # icon rendering is ugly in GNOME3, so, adding a svg icon
42 Source60: gvim.svg
43 # empty rpm spec template
44 Source61: template.spec
45
46 # for updating Source0:
47 Source100: vim-update.sh
48
49 # MDK patches
50 Patch2: vim-5.6a-paths.patch
51 Patch3: vim-8.0-rpm-spec-syntax.patch
52 Patch8: vim-6.0af-man-path.patch
53 Patch10: xxd-locale.patch
54 Patch20: vimrc_hebrew.patch
55 # autoload template when creating new rpm spec files
56 Patch21: vim-8.0-mga-vimrc-spec-template-autoload.patch
57 Patch22: vim-8.2-fix-xterms-comments.patch
58 Patch23: vim-8.2-remove-docs.patch
59 Patch24: vim-8.0-outline-mode.patch
60 Patch26: vim-7.4-changelog-mode.patch
61 Patch28: vim-8.0-po-mode.patch
62 Patch30: vim-8.0-add-dhcpd-syntax.patch
63 Patch31: vim70-CVE-2007-2438.patch
64 Patch32: vim-8.0-highligh-global.diff
65 Patch33: vim-8.2-add-haproxy-syntax.patch
66
67 # Fedora patches
68 Patch100: vim-8.0-fortify_warnings-1.patch
69 Patch101: vim-7.4-fstabsyntax.patch
70 Patch3016: vim-8.0-copy-paste.patch
71 # migrate shebangs in script to /usr/bin/python3 and use python2 when necessary
72 Patch3017: vim-python3-tests.patch
73
74 #
75 # Security patches
76 # P10000 -> ...
77 #
78 # CVE-2021-3770
79 Patch10000: b7081e135a16091c93f6f5f7525a5c58fb7ca9f9.patch
80 Patch10001: 2ddb89f8a94425cda1e5491efc80c1ccccb6e08e.patch
81 BuildRequires: python3-devel
82 BuildRequires: gpm-devel
83 BuildRequires: pkgconfig(ruby)
84 BuildRequires: perl-devel
85 BuildRequires: pkgconfig(tinfo)
86 BuildRequires: acl-devel
87 %if %{buildgui}
88 # for sound support
89 BuildRequires: libcanberra-devel
90 BuildRequires: gtk3-devel
91 BuildRequires: pkgconfig(ncurses)
92 BuildRequires: pkgconfig(xt)
93 BuildRequires: tcl
94 BuildRequires: pkgconfig(tcl)
95 %endif
96 BuildRequires: pkgconfig(lua)
97
98 %global __requires_exclude perl\\(getopts.pl\\)
99
100 %description
101 VIM (VIsual editor iMproved) is an updated and improved version of the
102 vi editor. Vi was the first real screen-based editor for UNIX, and is
103 still very popular. VIM improves on vi by adding new features:
104 multiple windows, multi-level undo, block highlighting and more.
105
106 %package common
107 Summary: The common files needed by any version of the VIM editor
108 Group: Editors
109 Requires(pre): coreutils
110 Requires(post): coreutils
111 Requires(preun): coreutils
112 Requires(postun): coreutils
113 # <oden> Installation failed: file /usr/share/vim/syntax/asciidoc.vim from install of vim-common-7.4.052-2.mga4.x86_64 conflicts with file from package asciidoc-8.6.8-2.mga3.noarch
114 Conflicts: asciidoc < 8.6.8-4
115
116 %description common
117 VIM (VIsual editor iMproved) is an updated and improved version of the
118 vi editor. Vi was the first real screen-based editor for UNIX, and is
119 still very popular. VIM improves on vi by adding new features:
120 multiple windows, multi-level undo, block highlighting and more. The
121 vim-common package contains files which every VIM binary will need in
122 order to run.
123
124 %package minimal
125 Summary: A minimal version of the VIM editor
126 Group: Editors
127 Provides: vim
128 Requires(post): update-alternatives
129 Requires(postun): update-alternatives
130
131 %description minimal
132 VIM (VIsual editor iMproved) is an updated and improved version of the
133 vi editor. Vi was the first real screen-based editor for UNIX, and is
134 still very popular. VIM improves on vi by adding new features:
135 multiple windows, multi-level undo, block highlighting and more. The
136 vim-minimal package includes a minimal version of VIM, which is
137 installed into /bin/vi for use when only the root partition is
138 present. NOTE: The online help is only available when the vim-common
139 package is installed.
140
141 %package enhanced
142 Summary: A version of the VIM editor which includes recent enhancements
143 Group: Editors
144 Requires: vim-common >= %{version}-%{release}
145 Provides: vim
146 Requires(post): update-alternatives
147 Requires(postun): update-alternatives
148
149 %description enhanced
150 VIM (VIsual editor iMproved) is an updated and improved version of the
151 vi editor. Vi was the first real screen-based editor for UNIX, and is
152 still very popular. VIM improves on vi by adding new features:
153 multiple windows, multi-level undo, block highlighting and more. The
154 vim-enhanced package contains a version of VIM with extra, recently
155 introduced features like Python and Perl interpreters.
156
157 Install the vim-enhanced package if you'd like to use a version of the
158 VIM editor which includes recently added enhancements like
159 interpreters for the Python and Perl scripting languages. You'll also
160 need to install the vim-common package.
161
162 %if %{buildgui}
163 %package X11
164 Summary: The VIM version of the vi editor for the X Window System
165 Group: Editors
166 Provides: vim
167 Requires: vim-common >= %{version}-%{release}
168 Requires(post): desktop-file-utils
169 Requires(postun): desktop-file-utils
170
171 %description X11
172 VIM (VIsual editor iMproved) is an updated and improved version of the
173 vi editor. Vi was the first real screen-based editor for UNIX, and is
174 still very popular. VIM improves on vi by adding new features:
175 multiple windows, multi-level undo, block highlighting and
176 more. VIM-X11 is a version of the VIM editor which will run within the
177 X Window System. If you install this package, you can run VIM as an X
178 application with a full GUI interface and mouse support by command gvim.
179
180 Install the vim-X11 package if you'd like to try out a version of vi
181 with graphics and mouse capabilities. You'll also need to install the
182 vim-common package.
183 %endif
184
185 %define localedir %{buildroot}%{_datadir}/locale/
186
187 %prep
188 %setup -q -n %{vimdir}
189 # spec plugin
190 rm -f runtime/doc/pi_spec.txt
191 rm -f runtime/ftpplugin/spec.vim
192 cp -a %{SOURCE56} runtime/syntax/
193 cp -a %{SOURCE57} runtime/syntax/
194 cp -a %{SOURCE58} runtime/syntax/
195 cp -a %{SOURCE59} runtime/syntax/
196
197 #mdk patches
198 %patch2 -p1
199 %patch3 -p0 -b .spec
200 %patch8 -p1 -b .manpath
201 %patch10 -p1 -b .xxdloc
202 %patch20 -p1 -b .warly
203 %patch21 -p1 -b .spec-template-autoload
204 %patch22 -p0
205 %patch23 -p0 -b .doc
206 %patch24 -p0
207 %patch26 -p0
208 %patch28 -p1
209 %patch30 -p0
210 %patch32 -p1
211 %patch33 -p1 -b .add-haproxy-syntax
212 # Fedora patches
213 %patch100 -p1
214 %patch101 -p1
215 %patch3016 -p1
216 %patch3017 -p1
217
218 %patch10000 -p1
219 %patch10001 -p1
220
221 perl -pi -e 's|SYS_VIMRC_FILE "\$VIM/vimrc"|SYS_VIMRC_FILE "%_sysconfdir/vim/vimrc"|' src/os_unix.h
222 perl -pi -e 's|SYS_GVIMRC_FILE "\$VIM/gvimrc"|SYS_GVIMRC_FILE "%_sysconfdir/vim/gvimrc"|' src/os_unix.h
223 # disable command echo
224 for i in runtime/{gvimrc_example.vim,vimrc_example.vim,defaults.vim}; do
225 perl -pi -e 's!^set showcmd!set noshowcmd!' $i
226 done
227 perl -pi -e 's|\Qsvn-commit.*.tmp\E|svn-commit*.tmp|' ./runtime/filetype.vim
228
229 %build
230 # ensure xxd works with big files:
231 export CFLAGS="%{optflags} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2"
232 export CXXFLAGS="%{optflags} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2"
233
234 export LDFLAGS="%{ldflags} $(python3-config --libs --embed)"
235
236 %if %{buildgui}
237 # First build: gvim
238 LOCALEDIR=%{localedir} ./configure --prefix=%{_prefix} \
239 --enable-python3interp=dynamic \
240 --enable-perlinterp \
241 --enable-rubyinterp \
242 --enable-tclinterp \
243 --with-features=huge \
244 --enable-acl --with-x=yes --enable-gui=gtk3 --exec-prefix=%{_prefix}/X11R6 \
245 --enable-gtk3-check \
246 --enable-multibyte --enable-xim --enable-fontset --mandir=%{_mandir} \
247 --enable-canberra \
248 --libdir=%{_libdir} --with-compiledby="%packager"
249
250 echo "#define MAX_FEAT 1" >> src/config.h
251 echo "#define FEAT_GUI" >> src/config.h
252 # workaround buggy build system:
253 perl -pi -e 's!/usr/include long!/usr/include !' src/auto/config.mk
254
255 %make_build
256 mv src/vim src/gvim
257 make -C src clean
258 %endif
259
260 # Second build: vim-enhanced
261 ./configure --prefix=%{_prefix} \
262 --enable-acl --enable-rubyinterp --enable-tclinterp \
263 --enable-python3interp=dynamic \
264 --enable-perlinterp --with-features=huge \
265 --libdir=%{_libdir} --with-compiledby="%packager" \
266 --with-x=no --enable-gui=no --exec-prefix=%{_prefix} \
267 --disable-canberra
268
269 %make_build
270 mv src/vim src/vim-enhanced
271 make -C src/ clean
272
273 # Third build: vim-minimal
274 ./configure --prefix=%{_prefix} \
275 --with-features=tiny --disable-tclinterp --disable-cscope \
276 --disable-hangulinput --disable-xim --disable-fontset --disable-gui \
277 --disable-acl --disable-pythoninterp --disable-perlinterp \
278 --libdir=%{_libdir} --with-compiledby="%packager" \
279 --with-x=no --enable-gui=no --disable-gpm --exec-prefix=%{_prefix} --with-tlib=tinfo \
280 --disable-canberra
281
282 %make_build
283 cp src/vim src/vim-minimal
284 %make_build -C src
285
286 cp -al runtime/doc doc
287 # apply os_doc.diff
288 pushd doc
289 rm -f *.1
290 rm -f os_{390,dos,msdos,risc,win32,amiga,mac,os2,beos,mint,qnx,vms}.txt
291 rm -f gui_{w16,w32}.txt
292 rm -f vim2html.pl Makefile *awk
293 popd
294
295 # britton support
296 ln -s tutor.fr runtime/tutor/tutor.br
297 ln -s menu_fr_fr.iso_8859-15.vim runtime/lang/menu_br
298
299 %install
300 perl -pi -e 's!LOCALEDIR=\$\(DEST_LANG\)!LOCALEDIR=\$(DESTDIR)\$\(prefix\)/share/locale!g' src/Makefile
301
302 mkdir -p %{buildroot}{/bin,%{_bindir},%{_datadir}/{vim,locale},%{_mandir}/man1,%{localedir}}
303 # Adding STRIP=/bin/true, because Vim wants to strip the binaries by himself
304 # and put the stripped files into correct dirs. Build system (koji/brew)
305 # does it for us, so there is no need to do it in Vim
306 %make_install VIMRTDIR="" STRIP=/bin/true
307
308
309 make -C src installmacros prefix=%{buildroot}%{_prefix} VIMRTDIR=""
310
311 # fix unreadable files:
312 chmod a+r runtime/{autoload/{tar,netrw}.vim,doc/pi_{netrw,tar}.txt}
313
314 %if %{buildgui}
315 mkdir -p %{buildroot}%{_bindir}
316 install -m 755 src/gvim %{buildroot}%{_bindir}
317 %endif
318
319 install -m 755 src/vim-enhanced %{buildroot}%{_bindir}
320 install -m 755 src/vim-minimal %{buildroot}/bin/vim-minimal
321
322 cd %{buildroot}
323 rm -f ./bin/rvim
324 rm -f ./usr/bin/rview ./usr/bin/rvim ./usr/bin/view
325 for i in ex vimdiff; do
326 ln -sf vim-enhanced ./usr/bin/$i
327 done
328 rm -f ./usr/man/man1/rvim.*
329 rm -f ./usr/share/man/man1/evim.*
330 %if %{buildgui}
331 ln -sf gvim ./usr/bin/gvimdiff
332 ln -sf gvim ./usr/bin/vimx
333 %endif
334 rm -f ./usr/share/vim/*/cmake.vim
335 cd -
336
337 # installing man pages
338 for i in %{buildroot}%{_mandir}/man1/{vi,rvi}; do
339 cp %{buildroot}%{_mandir}/man1/vim.1 $i.1
340 done
341
342 %if %{buildgui}
343 cp %{buildroot}%{_mandir}/man1/vim.1 %{buildroot}%{_mandir}/man1/gvim.1
344 %endif
345
346 ln -sf defaults.vim %{buildroot}/usr/share/vim/vimrc
347
348 cd %{buildroot}/%{_prefix}/share/vim/tools
349 # i need to make a choice :(.
350 rm -f vim132
351 perl -p -i -e 's|#!/usr/bin/nawk|#!/usr/bin/gawk|' mve.awk
352 perl -p -i -e 's|#!/usr/local/bin/perl|#!/usr/bin/perl|' *.pl
353 perl -p -i -e 's|#!/usr/gnu/bin/perl|#!/usr/bin/perl|' *
354 cd -
355
356 # Be short-circuit aware :
357 ln -f runtime/macros/README.txt README_macros.txt
358 ln -f runtime/tools/README.txt README_tools.txt
359 perl -p -i -e "s|#!/usr/local/bin/perl|#!/usr/bin/perl|" runtime/doc/*.pl
360
361 # installing the menu icons & entry
362 %if %{buildgui}
363 install -D -p -m 0644 %{SOURCE60} %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/gvim.svg
364
365 # gvim and fontset (from Pablo) 2001/03/19
366 echo 'set guifontset=-*-fixed-medium-r-normal--14-*-*-*-c-*-*-*,-*-*-medium-r-normal--14-*-*-*-c-*-*-*,-*-*-medium-r-normal--14-*-*-*-m-*-*-*,*' > %{buildroot}%{_datadir}/vim/gvimrc
367 %endif
368
369 # fix the paths in the man pages
370 for i in %{buildroot}/usr/share/man/man1/*.1; do
371 perl -p -i -e "s|%{buildroot}||" $i
372 done
373
374 # prevent including twice the doc
375 rm -fr %{buildroot}/usr/share/vim/doc
376 ln -sf ../../../%{_defaultdocdir}/%{name}-common/doc %{buildroot}/usr/share/vim/doc
377
378 %{find_lang} %{name} --with-man --all-name
379
380 find %{buildroot}%{_datadir}/vim/ -name "tutor.*" | egrep -v 'tutor(|\.vim)$' |
381 sed -e 's!^\(.*tutor.\)\(..\)!%lang(\2) \1\2!g' >> %{name}.lang
382
383 find %{buildroot}%{_datadir}/vim/lang -name "menu*" |
384 sed -e 's!^\(.*menu_\)\(..\)\(_\)!%lang(\2) \1\2\3!g' \
385 -e 's!^\(.*menu\)\(_chinese\)!%lang(zh) \1\2!g' \
386 -e 's!^\(.*menu\)\(_czech_\)!%lang(cs) \1\2!g' \
387 -e 's!^\(.*menu\)\(_french\)!%lang(fr) \1\2!g' \
388 -e 's!^\(.*menu\)\(_german\)!%lang(de) \1\2!g' \
389 -e 's!^\(.*menu\)\(_japanes\)!%lang(ja) \1\2!g' \
390 -e 's!^\(.*menu\)\(_polish\)!%lang(pl) \1\2!g' \
391 -e 's!^\(.*menu\)\(_slovak\)!%lang(sk) \1\2!g' \
392 -e 's!^\(.*menu\)\(_spanis\)!%lang(es) \1\2!g' \
393 >> %{name}.lang
394 # add softlinks:
395 find %{buildroot}%{_datadir}/vim/lang -type l >> %{name}.lang
396 # clean file list:
397 sed -i "s^%{buildroot}^^" %{name}.lang
398
399 rm -f %{buildroot}%{_bindir}/vim
400
401 mkdir -p %{buildroot}%{_sysconfdir}/vim/
402 MESSAGE='"Place your systemwide modification here.\n"%{_datadir}/vim/ files will be overwritten on update\n'
403 echo -e "$MESSAGE\nsource %_datadir/vim/vimrc" > %{buildroot}/%{_sysconfdir}/vim/vimrc
404 %if %{buildgui}
405 echo -e "$MESSAGE\nsource %_datadir/vim/gvimrc" > %{buildroot}/%{_sysconfdir}/vim/gvimrc
406 %endif
407
408 # create templates folder
409 mkdir -p %{buildroot}/%{_datadir}/%{name}/vimfiles
410 install -m 0644 %{SOURCE61} %{buildroot}/%{_datadir}/%{name}/vimfiles/
411
412 %post minimal
413 update-alternatives --install /bin/vi vi /bin/vim-minimal 10 \
414 --slave /bin/view view /bin/vim-minimal \
415 --slave /bin/ex ex /bin/vim-minimal \
416 --slave /bin/rvi rvi /bin/vim-minimal \
417 --slave /bin/rview rview /bin/vim-minimal
418 update-alternatives --install /bin/vim vim /bin/vim-minimal 10 \
419 --slave /bin/rvim rvim /bin/vim-minimal
420
421 %postun minimal
422 [ $1 = 0 ] || exit 0
423 update-alternatives --remove vi /bin/vim-minimal
424 update-alternatives --remove vim /bin/vim-minimal
425
426 %triggerpostun minimal -- vim-minimal < 7.3
427 update-alternatives --remove uvi /bin/vim-minimal
428 for i in view ex rvi rview rvim; do
429 update-alternatives --remove $i /bin/$i || :
430 done
431
432 %post enhanced
433 update-alternatives --install /bin/vi vi /usr/bin/vim-enhanced 20 \
434 --slave /bin/view view /usr/bin/vim-enhanced \
435 --slave /bin/ex ex /usr/bin/vim-enhanced \
436 --slave /bin/rvi rvi /usr/bin/vim-enhanced \
437 --slave /bin/rview rview /usr/bin/vim-enhanced
438 update-alternatives --install /bin/vim vim /usr/bin/vim-enhanced 20 \
439 --slave /bin/rvim rvim /usr/bin/vim-enhanced
440
441 %postun enhanced
442 [ $1 = 0 ] || exit 0
443 update-alternatives --remove vi /usr/bin/vim-enhanced
444 update-alternatives --remove vim /usr/bin/vim-enhanced
445
446 %triggerpostun enhanced -- vim-enhanced < 7.3
447 update-alternatives --remove uvi /usr/bin/vim-enhanced
448
449 %files common -f vim.lang
450 %doc README*.txt
451 #%doc --parents mandriva/README*
452 %doc doc
453 %{_datadir}/vim/doc
454 %dir %{_datadir}/vim/
455 %{_datadir}/vim/[^tlg]*
456 %{_datadir}/vim/gvimrc_example.vim
457 %{_datadir}/vim/lang/README.txt
458 %{_datadir}/vim/tools
459 %{_datadir}/vim/tutor/README.*
460 %{_datadir}/vim/tutor/tutor
461 %{_datadir}/vim/tutor/tutor.vim
462 %{_mandir}/man1/vim.1*
463 %{_mandir}/man1/ex.1*
464 %{_mandir}/man1/vi.1*
465 %{_mandir}/man1/view.1*
466 %{_mandir}/man1/rvi.1*
467 %{_mandir}/man1/rview.1*
468 %{_mandir}/man1/vimdiff.1*
469 %{_mandir}/man1/vimtutor.1*
470 %{_mandir}/man1/rvim.1*
471 %{_bindir}/vimtutor
472 %{_bindir}/xxd
473 %{_mandir}/man1/xxd.1*
474 %dir %{_sysconfdir}/vim/
475 %config(noreplace) %{_sysconfdir}/vim/*
476
477 %files minimal
478 %doc README*.txt
479 /bin/vim-minimal
480
481 %files enhanced
482 %doc README*.txt
483 %{_bindir}/ex
484 %{_bindir}/vimdiff
485 %{_bindir}/vim-enhanced
486
487 %if %{buildgui}
488 %files X11
489 %doc README*.txt
490 %{_bindir}/gvim
491 %{_bindir}/gvimdiff
492 %{_bindir}/vimx
493 %{_mandir}/man1/gvim.1*
494 %{_iconsdir}/hicolor/*/apps/gvim.*
495 %{_iconsdir}/locolor/*/apps/*
496 %{_datadir}/applications/*.desktop
497 %{_datadir}/vim/gvimrc
498 %else
499 %exclude %{_datadir}/applications/*.desktop
500 %exclude %{_iconsdir}/hicolor/*/apps/gvim.*
501 %exclude %{_iconsdir}/locolor/*/apps/*
502 %endif

  ViewVC Help
Powered by ViewVC 1.1.30