Accepting request 478641 from home:kukuk:branches:editors

- Build default vim without X11 support, use update-alternatives
  to prefer gvim if installed for X11 support.

OBS-URL: https://build.opensuse.org/request/show/478641
OBS-URL: https://build.opensuse.org/package/show/editors/vim?expand=0&rev=424
This commit is contained in:
Ismail Dönmez 2017-03-11 10:02:37 +00:00 committed by Git OBS Bridge
parent 433c3c0831
commit 2d14c13832
2 changed files with 40 additions and 9 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Sat Mar 11 10:55:35 CET 2017 - kukuk@suse.de
- Build default vim without X11 support, use update-alternatives
to prefer gvim if installed for X11 support.
-------------------------------------------------------------------
Mon Mar 6 08:40:25 UTC 2017 - idonmez@suse.com

View File

@ -50,6 +50,8 @@ BuildRequires: update-desktop-files
BuildRoot: %{_tmppath}/%{name}-%{version}-build
PreReq: fileutils
PreReq: sh-utils
Requires(post): update-alternatives
Requires(preun): update-alternatives
%{?libperl_requires}
Provides: vi
Provides: vim-base = %{version}-%{release}
@ -124,6 +126,8 @@ Obsoletes: gvim-enhanced < %{version}-%{release}
Provides: gvim_client
Provides: vi
Provides: vim_client
Requires(post): update-alternatives
Requires(preun): update-alternatives
%description -n gvim
Package gvim contains the largest set of features of vim, which is
@ -189,10 +193,10 @@ autoconf
popd
# build vim
%configure ${COMMON_OPTIONS} --disable-gui --disable-gpm
%configure ${COMMON_OPTIONS} --disable-gui --disable-gpm --with-x=no
sed -i -e 's|define HAVE_DATE_TIME 1|undef HAVE_DATE_TIME|' src/auto/config.h
make %{?_smp_mflags}
cp src/vim vim
cp src/vim vim-nox11
# build gvim
make distclean
@ -224,14 +228,17 @@ for f in egvim egview eview evim gex gvi gview gvimdiff rgview rgvim ; do
done
# install vim
install -D -m 0755 vim %{buildroot}/bin/vim
install -D -m 0755 vim-nox11 %{buildroot}%{_bindir}/vim-nox11
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
ln -s -f %{_sysconfdir}/alternatives/vim %{buildroot}%{_bindir}/vim
# compat symlinks
ln -s -f /bin/vim %{buildroot}/bin/vi
ln -s -f /bin/vim %{buildroot}%{_bindir}/vim
ln -s -f /bin/vim %{buildroot}%{_bindir}/vi
ln -s -f vim %{buildroot}%{_bindir}/edit
ln -s -f /bin/vim %{buildroot}/bin/ex
mkdir %{buildroot}/bin
ln -s -f %{_bindir}/vim %{buildroot}/bin/vi
ln -s -f %{_bindir}/vim %{buildroot}/bin/vim
ln -s -f vim %{buildroot}%{_bindir}/vi
ln -s -f vim %{buildroot}%{_bindir}/edit
ln -s -f %{_bindir}/vim %{buildroot}/bin/ex
# man pages
ln -s -f vim.1.gz %{buildroot}%{_mandir}/man1/vi.1.gz
@ -325,15 +332,32 @@ trap "printf '\e[r'" EXIT
# Look for "TEST FAILURE" in the build log
LC_ALL=en_US.UTF-8 make test
%post
%{_sbindir}/update-alternatives --install %{_bindir}/vim vim %{_bindir}/vim-nox11 10
%preun
if [ "$1" = 0 ] ; then
%{_sbindir}/update-alternatives --remove vim %{_bindir}/vim-nox11
fi
%post -n gvim
%{_sbindir}/update-alternatives --install %{_bindir}/vim vim %{_bindir}/gvim 20
%icon_theme_cache_post
%preun -n gvim
if [ "$1" = 0 ] ; then
%{_sbindir}/update-alternatives --remove vim %{_bindir}/gvim
fi
%postun -n gvim
%icon_theme_cache_postun
%files
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/vimrc
%ghost %{_sysconfdir}/alternatives/vim
%{_bindir}/vim-nox11
%{_bindir}/vim
# symlinks
/bin/vi
/bin/vim
@ -343,7 +367,6 @@ LC_ALL=en_US.UTF-8 make test
%{_bindir}/rview
%{_bindir}/rvim
%{_bindir}/vi
%{_bindir}/vim
%{_bindir}/view
%{_bindir}/vimdiff
# additional binaries
@ -470,6 +493,8 @@ LC_ALL=en_US.UTF-8 make test
%defattr(-,root,root,-)
%doc runtime/doc/gui_x11.txt
%ghost %config(missingok) %{_sysconfdir}/gvimrc
%ghost %{_sysconfdir}/alternatives/vim
%{_bindir}/vim
%{_bindir}/egview
%{_bindir}/egvim
%{_bindir}/eview