# Notes / Warning : # - this package is not prefixable # - to update official patches, aka SOURCE4, see README.mga in SOURCE4 %define python3path %{_includedir}/%{python3} %define patchlevel 1412 %define python_version %(rpm -q --qf '%%{epoch}:%%{version}' python) %define ruby_version %(rpm -q --qf '%%{epoch}:%%{version}' ruby) # Should we build X11 gui %define buildgui 1 %{?_with_gui:%global buildgui 1} %{?_without_gui:%global buildgui 0} %define title VI editor %define longtitle All-purpose text editor %define baseversion 8.2 %define vimdir vim82 Name: vim Version: %{baseversion}.%{patchlevel} Release: %mkrel 2 Summary: VIsual editor iMproved Url: http://www.vim.org/ License: Charityware Group: Editors # Generated with SOURCES/vim-update.sh Source0: ftp://ftp.vim.org/pub/vim/unix/vim-%{baseversion}-%{patchlevel}.tar.bz2 # read README.mga prior updating official patches: Source3: README.mga # http://vim.sourceforge.net/scripts/script.php?script_id=98 Source56: http://trific.ath.cx/Ftp/vim/syntax/dhcpd.vim # from apparmor-utils package Source57: apparmor.vim Source58: cfengine.vim Source59: nagios.vim # icon rendering is ugly in GNOME3, so, adding a svg icon Source60: gvim.svg # empty rpm spec template Source61: template.spec # for updating Source0: Source100: vim-update.sh # MDK patches Patch2: vim-5.6a-paths.patch Patch3: vim-8.0-rpm-spec-syntax.patch Patch8: vim-6.0af-man-path.patch Patch10: xxd-locale.patch Patch20: vimrc_hebrew.patch # autoload template when creating new rpm spec files Patch21: vim-8.0-mga-vimrc-spec-template-autoload.patch Patch22: vim-8.2-fix-xterms-comments.patch Patch23: vim-8.2-remove-docs.patch Patch24: vim-8.0-outline-mode.patch Patch26: vim-7.4-changelog-mode.patch Patch28: vim-8.0-po-mode.patch Patch30: vim-8.0-add-dhcpd-syntax.patch Patch31: vim70-CVE-2007-2438.patch Patch32: vim-8.0-highligh-global.diff # Fedora patches Patch100: vim-8.0-fortify_warnings-1.patch Patch101: vim-7.4-fstabsyntax.patch Patch3016: vim-8.0-copy-paste.patch # migrate shebangs in script to /usr/bin/python3 and use python2 when necessary Patch3017: vim-python3-tests.patch BuildRequires: python3-devel BuildRequires: gpm-devel BuildRequires: pkgconfig(ruby) BuildRequires: perl-devel BuildRequires: pkgconfig(tinfo) BuildRequires: acl-devel %if %{buildgui} # for sound support BuildRequires: libcanberra-devel BuildRequires: gtk3-devel BuildRequires: pkgconfig(ncurses) BuildRequires: pkgconfig(xt) BuildRequires: tcl BuildRequires: pkgconfig(tcl) %endif BuildRequires: pkgconfig(lua) %global __requires_exclude perl\\(getopts.pl\\) %description VIM (VIsual editor iMproved) is an updated and improved version of the vi editor. Vi was the first real screen-based editor for UNIX, and is still very popular. VIM improves on vi by adding new features: multiple windows, multi-level undo, block highlighting and more. %package common Summary: The common files needed by any version of the VIM editor Group: Editors Requires(pre): coreutils Requires(post): coreutils Requires(preun): coreutils Requires(postun): coreutils # 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 Conflicts: asciidoc < 8.6.8-4 %description common VIM (VIsual editor iMproved) is an updated and improved version of the vi editor. Vi was the first real screen-based editor for UNIX, and is still very popular. VIM improves on vi by adding new features: multiple windows, multi-level undo, block highlighting and more. The vim-common package contains files which every VIM binary will need in order to run. %package minimal Summary: A minimal version of the VIM editor Group: Editors Provides: vim Requires(post): update-alternatives Requires(postun): update-alternatives %description minimal VIM (VIsual editor iMproved) is an updated and improved version of the vi editor. Vi was the first real screen-based editor for UNIX, and is still very popular. VIM improves on vi by adding new features: multiple windows, multi-level undo, block highlighting and more. The vim-minimal package includes a minimal version of VIM, which is installed into /bin/vi for use when only the root partition is present. NOTE: The online help is only available when the vim-common package is installed. %package enhanced Summary: A version of the VIM editor which includes recent enhancements Group: Editors Requires: vim-common >= %{version}-%{release} Provides: vim Requires(post): update-alternatives Requires(postun): update-alternatives %description enhanced VIM (VIsual editor iMproved) is an updated and improved version of the vi editor. Vi was the first real screen-based editor for UNIX, and is still very popular. VIM improves on vi by adding new features: multiple windows, multi-level undo, block highlighting and more. The vim-enhanced package contains a version of VIM with extra, recently introduced features like Python and Perl interpreters. Install the vim-enhanced package if you'd like to use a version of the VIM editor which includes recently added enhancements like interpreters for the Python and Perl scripting languages. You'll also need to install the vim-common package. %if %{buildgui} %package X11 Summary: The VIM version of the vi editor for the X Window System Group: Editors Provides: vim Requires: vim-common >= %{version}-%{release} Requires(post): desktop-file-utils Requires(postun): desktop-file-utils %description X11 VIM (VIsual editor iMproved) is an updated and improved version of the vi editor. Vi was the first real screen-based editor for UNIX, and is still very popular. VIM improves on vi by adding new features: multiple windows, multi-level undo, block highlighting and more. VIM-X11 is a version of the VIM editor which will run within the X Window System. If you install this package, you can run VIM as an X application with a full GUI interface and mouse support by command gvim. Install the vim-X11 package if you'd like to try out a version of vi with graphics and mouse capabilities. You'll also need to install the vim-common package. %endif %define localedir %{buildroot}%{_datadir}/locale/ %prep %setup -q -n %{vimdir} # spec plugin rm -f runtime/doc/pi_spec.txt rm -f runtime/ftpplugin/spec.vim cp -a %{SOURCE56} runtime/syntax/ cp -a %{SOURCE57} runtime/syntax/ cp -a %{SOURCE58} runtime/syntax/ cp -a %{SOURCE59} runtime/syntax/ #mdk patches %patch2 -p1 %patch3 -p0 -b .spec %patch8 -p1 -b .manpath %patch10 -p1 -b .xxdloc %patch20 -p1 -b .warly %patch21 -p1 -b .spec-template-autoload %patch22 -p0 %patch23 -p0 -b .doc %patch24 -p0 %patch26 -p0 %patch28 -p1 %patch30 -p0 %patch32 -p1 # Fedora patches %patch100 -p1 %patch101 -p1 %patch3016 -p1 %patch3017 -p1 perl -pi -e 's|SYS_VIMRC_FILE "\$VIM/vimrc"|SYS_VIMRC_FILE "%_sysconfdir/vim/vimrc"|' src/os_unix.h perl -pi -e 's|SYS_GVIMRC_FILE "\$VIM/gvimrc"|SYS_GVIMRC_FILE "%_sysconfdir/vim/gvimrc"|' src/os_unix.h # disable command echo for i in runtime/{gvimrc_example.vim,vimrc_example.vim,defaults.vim}; do perl -pi -e 's!^set showcmd!set noshowcmd!' $i done perl -pi -e 's|\Qsvn-commit.*.tmp\E|svn-commit*.tmp|' ./runtime/filetype.vim %build # ensure xxd works with big files: export CFLAGS="%{optflags} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2" export CXXFLAGS="%{optflags} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2" export LDFLAGS="%{ldflags} $(python3-config --libs --embed)" %if %{buildgui} # First build: gvim LOCALEDIR=%{localedir} ./configure --prefix=%{_prefix} \ --enable-python3interp=dynamic \ --enable-perlinterp \ --enable-rubyinterp \ --enable-tclinterp \ --with-features=huge \ --enable-acl --with-x=yes --enable-gui=gtk3 --exec-prefix=%{_prefix}/X11R6 \ --enable-gtk3-check \ --enable-multibyte --enable-xim --enable-fontset --mandir=%{_mandir} \ --enable-canberra \ --libdir=%{_libdir} --with-compiledby="%packager" echo "#define MAX_FEAT 1" >> src/config.h echo "#define FEAT_GUI" >> src/config.h # workaround buggy build system: perl -pi -e 's!/usr/include long!/usr/include !' src/auto/config.mk %make_build mv src/vim src/gvim make -C src clean %endif # Second build: vim-enhanced ./configure --prefix=%{_prefix} \ --enable-acl --enable-rubyinterp --enable-tclinterp \ --enable-python3interp=dynamic \ --enable-perlinterp --with-features=huge \ --libdir=%{_libdir} --with-compiledby="%packager" \ --with-x=no --enable-gui=no --exec-prefix=%{_prefix} %make_build mv src/vim src/vim-enhanced make -C src/ clean # Third build: vim-minimal ./configure --prefix=%{_prefix} \ --with-features=tiny --disable-tclinterp --disable-cscope \ --disable-hangulinput --disable-xim --disable-fontset --disable-gui \ --disable-acl --disable-pythoninterp --disable-perlinterp \ --libdir=%{_libdir} --with-compiledby="%packager" \ --with-x=no --enable-gui=no --disable-gpm --exec-prefix=%{_prefix} --with-tlib=tinfo %make_build cp src/vim src/vim-minimal %make_build -C src cp -al runtime/doc doc # apply os_doc.diff pushd doc rm -f *.1 rm -f os_{390,dos,msdos,risc,win32,amiga,mac,os2,beos,mint,qnx,vms}.txt rm -f gui_{w16,w32}.txt rm -f vim2html.pl Makefile *awk popd # britton support ln -s tutor.fr runtime/tutor/tutor.br ln -s menu_fr_fr.iso_8859-15.vim runtime/lang/menu_br %install perl -pi -e 's!LOCALEDIR=\$\(DEST_LANG\)!LOCALEDIR=\$(DESTDIR)\$\(prefix\)/share/locale!g' src/Makefile mkdir -p %{buildroot}{/bin,%{_bindir},%{_datadir}/{vim,locale},%{_mandir}/man1,%{localedir}} # Adding STRIP=/bin/true, because Vim wants to strip the binaries by himself # and put the stripped files into correct dirs. Build system (koji/brew) # does it for us, so there is no need to do it in Vim %make_install VIMRTDIR="" STRIP=/bin/true make -C src installmacros prefix=%{buildroot}%{_prefix} VIMRTDIR="" # fix unreadable files: chmod a+r runtime/{autoload/{tar,netrw}.vim,doc/pi_{netrw,tar}.txt} %if %{buildgui} mkdir -p %{buildroot}%{_bindir} install -m 755 src/gvim %{buildroot}%{_bindir} %endif install -m 755 src/vim-enhanced %{buildroot}%{_bindir} install -m 755 src/vim-minimal %{buildroot}/bin/vim-minimal cd %{buildroot} rm -f ./bin/rvim rm -f ./usr/bin/rview ./usr/bin/rvim ./usr/bin/view for i in ex vimdiff; do ln -sf vim-enhanced ./usr/bin/$i done rm -f ./usr/man/man1/rvim.* rm -f ./usr/share/man/man1/evim.* %if %{buildgui} ln -sf gvim ./usr/bin/gvimdiff ln -sf gvim ./usr/bin/vimx %endif rm -f ./usr/share/vim/*/cmake.vim cd - # installing man pages for i in %{buildroot}%{_mandir}/man1/{vi,rvi}; do cp %{buildroot}%{_mandir}/man1/vim.1 $i.1 done %if %{buildgui} cp %{buildroot}%{_mandir}/man1/vim.1 %{buildroot}%{_mandir}/man1/gvim.1 %endif ln -sf defaults.vim %{buildroot}/usr/share/vim/vimrc cd %{buildroot}/%{_prefix}/share/vim/tools # i need to make a choice :(. rm -f vim132 perl -p -i -e 's|#!/usr/bin/nawk|#!/usr/bin/gawk|' mve.awk perl -p -i -e 's|#!/usr/local/bin/perl|#!/usr/bin/perl|' *.pl perl -p -i -e 's|#!/usr/gnu/bin/perl|#!/usr/bin/perl|' * cd - # Be short-circuit aware : ln -f runtime/macros/README.txt README_macros.txt ln -f runtime/tools/README.txt README_tools.txt perl -p -i -e "s|#!/usr/local/bin/perl|#!/usr/bin/perl|" runtime/doc/*.pl # installing the menu icons & entry %if %{buildgui} install -D -p -m 0644 %{SOURCE60} %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/gvim.svg # gvim and fontset (from Pablo) 2001/03/19 echo 'set guifontset=-*-fixed-medium-r-normal--14-*-*-*-c-*-*-*,-*-*-medium-r-normal--14-*-*-*-c-*-*-*,-*-*-medium-r-normal--14-*-*-*-m-*-*-*,*' > %{buildroot}%{_datadir}/vim/gvimrc %endif # fix the paths in the man pages for i in %{buildroot}/usr/share/man/man1/*.1; do perl -p -i -e "s|%{buildroot}||" $i done # prevent including twice the doc rm -fr %{buildroot}/usr/share/vim/doc ln -sf ../../../%{_defaultdocdir}/%{name}-common/doc %{buildroot}/usr/share/vim/doc %{find_lang} %{name} --with-man --all-name find %{buildroot}%{_datadir}/vim/ -name "tutor.*" | egrep -v 'tutor(|\.vim)$' | sed -e 's!^\(.*tutor.\)\(..\)!%lang(\2) \1\2!g' >> %{name}.lang find %{buildroot}%{_datadir}/vim/lang -name "menu*" | sed -e 's!^\(.*menu_\)\(..\)\(_\)!%lang(\2) \1\2\3!g' \ -e 's!^\(.*menu\)\(_chinese\)!%lang(zh) \1\2!g' \ -e 's!^\(.*menu\)\(_czech_\)!%lang(cs) \1\2!g' \ -e 's!^\(.*menu\)\(_french\)!%lang(fr) \1\2!g' \ -e 's!^\(.*menu\)\(_german\)!%lang(de) \1\2!g' \ -e 's!^\(.*menu\)\(_japanes\)!%lang(ja) \1\2!g' \ -e 's!^\(.*menu\)\(_polish\)!%lang(pl) \1\2!g' \ -e 's!^\(.*menu\)\(_slovak\)!%lang(sk) \1\2!g' \ -e 's!^\(.*menu\)\(_spanis\)!%lang(es) \1\2!g' \ >> %{name}.lang # add softlinks: find %{buildroot}%{_datadir}/vim/lang -type l >> %{name}.lang # clean file list: sed -i "s^%{buildroot}^^" %{name}.lang rm -f %{buildroot}%{_bindir}/vim mkdir -p %{buildroot}%{_sysconfdir}/vim/ MESSAGE='"Place your systemwide modification here.\n"%{_datadir}/vim/ files will be overwritten on update\n' echo -e "$MESSAGE\nsource %_datadir/vim/vimrc" > %{buildroot}/%{_sysconfdir}/vim/vimrc %if %{buildgui} echo -e "$MESSAGE\nsource %_datadir/vim/gvimrc" > %{buildroot}/%{_sysconfdir}/vim/gvimrc %endif # create templates folder mkdir -p %{buildroot}/%{_datadir}/%{name}/vimfiles install -m 0644 %{SOURCE61} %{buildroot}/%{_datadir}/%{name}/vimfiles/ %post minimal update-alternatives --install /bin/vi vi /bin/vim-minimal 10 \ --slave /bin/view view /bin/vim-minimal \ --slave /bin/ex ex /bin/vim-minimal \ --slave /bin/rvi rvi /bin/vim-minimal \ --slave /bin/rview rview /bin/vim-minimal update-alternatives --install /bin/vim vim /bin/vim-minimal 10 \ --slave /bin/rvim rvim /bin/vim-minimal %postun minimal [ $1 = 0 ] || exit 0 update-alternatives --remove vi /bin/vim-minimal update-alternatives --remove vim /bin/vim-minimal %triggerpostun minimal -- vim-minimal < 7.3 update-alternatives --remove uvi /bin/vim-minimal for i in view ex rvi rview rvim; do update-alternatives --remove $i /bin/$i || : done %post enhanced update-alternatives --install /bin/vi vi /usr/bin/vim-enhanced 20 \ --slave /bin/view view /usr/bin/vim-enhanced \ --slave /bin/ex ex /usr/bin/vim-enhanced \ --slave /bin/rvi rvi /usr/bin/vim-enhanced \ --slave /bin/rview rview /usr/bin/vim-enhanced update-alternatives --install /bin/vim vim /usr/bin/vim-enhanced 20 \ --slave /bin/rvim rvim /usr/bin/vim-enhanced %postun enhanced [ $1 = 0 ] || exit 0 update-alternatives --remove vi /usr/bin/vim-enhanced update-alternatives --remove vim /usr/bin/vim-enhanced %triggerpostun enhanced -- vim-enhanced < 7.3 update-alternatives --remove uvi /usr/bin/vim-enhanced %files common -f vim.lang %doc README*.txt #%doc --parents mandriva/README* %doc doc %{_datadir}/vim/doc %dir %{_datadir}/vim/ %{_datadir}/vim/[^tlg]* %{_datadir}/vim/gvimrc_example.vim %{_datadir}/vim/lang/README.txt %{_datadir}/vim/tools %{_datadir}/vim/tutor/README.* %{_datadir}/vim/tutor/tutor %{_datadir}/vim/tutor/tutor.vim %{_mandir}/man1/vim.1* %{_mandir}/man1/ex.1* %{_mandir}/man1/vi.1* %{_mandir}/man1/view.1* %{_mandir}/man1/rvi.1* %{_mandir}/man1/rview.1* %{_mandir}/man1/vimdiff.1* %{_mandir}/man1/vimtutor.1* %{_mandir}/man1/rvim.1* %{_bindir}/vimtutor %{_bindir}/xxd %{_mandir}/man1/xxd.1* %dir %{_sysconfdir}/vim/ %config(noreplace) %{_sysconfdir}/vim/* %files minimal %doc README*.txt /bin/vim-minimal %files enhanced %doc README*.txt %{_bindir}/ex %{_bindir}/vimdiff %{_bindir}/vim-enhanced %if %{buildgui} %files X11 %doc README*.txt %{_bindir}/gvim %{_bindir}/gvimdiff %{_bindir}/vimx %{_mandir}/man1/gvim.1* %{_iconsdir}/hicolor/*/apps/gvim.* %{_iconsdir}/locolor/*/apps/* %{_datadir}/applications/*.desktop %{_datadir}/vim/gvimrc %endif