add 'gui' build condition for vim-X11

This commit is contained in:
Malcolm Inglis 2022-01-07 02:54:21 +01:00 committed by Zdenek Dohnal
parent bde766b5c9
commit dbb3fed824

145
vim.spec
View File

@ -1,11 +1,4 @@
%define patchlevel 4006
%if %{?WITH_SELINUX:0}%{!?WITH_SELINUX:1}
%define WITH_SELINUX 1
%endif
%define desktop_file 1
%if %{desktop_file}
%define desktop_file_utils_version 0.2.93
%endif
%bcond_without gui
%if 0%{?fedora}
%bcond_without default_editor
@ -15,6 +8,22 @@
%bcond_with libsodium_crypt
%endif
%define patchlevel 4006
%if %{?WITH_SELINUX:0}%{!?WITH_SELINUX:1}
%define WITH_SELINUX 1
%endif
%if %{with gui}
%define desktop_file 1
%else
%define desktop_file 0
%endif
%if %{desktop_file}
%define desktop_file_utils_version 0.2.93
%endif
%define withnetbeans 1
%define withvimspell 0
@ -29,7 +38,7 @@ Summary: The VIM editor
URL: http://www.vim.org/
Name: vim
Version: %{baseversion}.%{patchlevel}
Release: 1%{?dist}
Release: 2%{?dist}
Epoch: 2
License: Vim and MIT
Source0: ftp://ftp.vim.org/pub/vim/unix/vim-%{baseversion}-%{patchlevel}.tar.bz2
@ -54,6 +63,7 @@ Source100: vim-spell-files.tar.bz2
Patch2000: vim-7.0-fixkeys.patch
Patch2001: vim-7.4-specsyntax.patch
%if %{withhunspell}
Patch2002: vim-7.0-hunspell.patch
BuildRequires: hunspell-devel
@ -74,15 +84,18 @@ Patch3007: vim-8.0-copy-paste.patch
# uses autoconf in spec file
BuildRequires: autoconf
%if %{desktop_file}
# for /usr/bin/desktop-file-install
BuildRequires: desktop-file-utils >= %{desktop_file_utils_version}
Requires: desktop-file-utils
%endif
# gcc is no longer in buildroot by default
BuildRequires: gcc
# for translations
BuildRequires: gettext
# glibc in F35 bootstraped several conversion formats from
# iconv into a separate package. Vim needs those additional
# formats during compilation.
@ -91,22 +104,27 @@ BuildRequires: gettext
%if 0%{?fedora} >= 35
BuildRequires: glibc-gconv-extra
%endif
# for mouse support in console
BuildRequires: gpm-devel
# for setting ACL on created files
BuildRequires: libacl-devel
# selinux support
%if %{WITH_SELINUX}
BuildRequires: libselinux-devel
%endif
# for xchacha20 encryption
%if %{with libsodium_crypt}
BuildRequires: libsodium-devel
%endif
# for lua plugin
%if "%{withlua}" == "1"
BuildRequires: lua-devel
%endif
# uses make
BuildRequires: make
# screen handling library
@ -118,6 +136,7 @@ BuildRequires: perl(ExtUtils::Embed)
BuildRequires: perl(ExtUtils::ParseXS)
# for python plugin
BuildRequires: python3-devel
# for ruby plugin
%if "%{withruby}" == "1"
BuildRequires: ruby
@ -201,10 +220,12 @@ Requires: which
%if "%{withlua}" == "1"
Suggests: lua-libs
%endif
Suggests: perl-devel
Suggests: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Suggests: python3
Suggests: python3-libs
%if "%{withruby}" == "1"
Suggests: ruby
Suggests: ruby-libs
@ -231,6 +252,7 @@ BuildArch: noarch
This package provides some directories which are required by other
packages that add vim files, p.e. additional syntax files or filetypes.
%if %{with gui}
%package X11
Summary: The VIM version of the vi editor for the X Window System - GVim
# devel of libICE, gtk3, libSM, libX11, libXpm and libXt are needed in buildroot
@ -265,17 +287,19 @@ Requires: libattr >= 2.4
Requires: vim-common = %{epoch}:%{version}-%{release}
# suggest python3, python2, lua, ruby and perl packages because of their
# embedded functionality in Vim/GVim
%if "%{withlua}" == "1"
%if "%{withlua}" == "1"
Suggests: lua-libs
%endif
%endif
Suggests: perl-devel
Suggests: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Suggests: python3
Suggests: python3-libs
%if "%{withruby}" == "1"
%if "%{withruby}" == "1"
Suggests: ruby
Suggests: ruby-libs
%endif
%endif
%description X11
VIM (VIsual editor iMproved) is an updated and improved version of the
@ -289,6 +313,7 @@ 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
%package data
Summary: Shared data for Vi and Vim
@ -329,9 +354,11 @@ sed -i -e 's,/usr/bin/python3,%{__python3},' %{PATCH3005}
chmod -x runtime/tools/mve.awk
%patch2000 -p1 -b .fixkeys
%patch2001 -p1
%if %{withhunspell}
%patch2002 -p1
%endif
perl -pi -e "s,bin/nawk,bin/awk,g" runtime/tools/mve.awk
# install spell files
@ -394,6 +421,7 @@ make clean
mv -f os_unix.h.save os_unix.h
%if %{with gui}
# More configure options:
# --enable-xim - enabling X Input Method - international input module for X,
# it is for multibyte languages in Vim with X
@ -410,37 +438,38 @@ mv -f os_unix.h.save os_unix.h
--enable-fips-warning \
--with-compiledby="<bugzilla@redhat.com>" --enable-cscope \
--with-modified-by="<bugzilla@redhat.com>" \
%if "%{withnetbeans}" == "1"
%if "%{withnetbeans}" == "1"
--enable-netbeans \
%else
%else
--disable-netbeans \
%endif
%if %{WITH_SELINUX}
%endif
%if %{WITH_SELINUX}
--enable-selinux \
%else
%else
--disable-selinux \
%endif
%if "%{withruby}" == "1"
%endif
%if "%{withruby}" == "1"
--enable-rubyinterp=dynamic \
%else
%else
--disable-rubyinterp \
%endif
%if "%{withlua}" == "1"
%endif
%if "%{withlua}" == "1"
--enable-luainterp=dynamic \
%else
%else
--disable-luainterp \
%endif
%if %{with libsodium_crypt}
%endif
%if %{with libsodium_crypt}
--enable-libsodium \
%else
%else
--disable-libsodium \
%endif
%endif
--enable-fail-if-missing \
--enable-canberra
%make_build
cp vim gvim
make clean
%endif
%configure CFLAGS="${CFLAGS} -DSYS_VIMRC_FILE='\"/etc/vimrc\"'" \
--prefix=%{_prefix} --with-features=huge \
@ -502,14 +531,16 @@ cd src
# make install creates vim binary and view symlink, they will be wrappers
# so remove them here
rm -f %{buildroot}%{_bindir}/{vim,view}
make installgtutorbin DESTDIR=%{buildroot} BINDIR=%{_bindir}
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/{16x16,32x32,48x48,64x64}/apps
mkdir -p %{buildroot}%{_libexecdir}
install -m755 minimal-vim %{buildroot}%{_libexecdir}/vi
install -m755 enhanced-vim %{buildroot}%{_bindir}/vim
install -m755 gvim %{buildroot}%{_bindir}/gvim
install -m755 %{SOURCE12} %{buildroot}%{_bindir}/view
install -m755 %{SOURCE13} %{buildroot}%{_bindir}/vi
%if %{with gui}
make installgtutorbin DESTDIR=%{buildroot} BINDIR=%{_bindir}
install -m755 gvim %{buildroot}%{_bindir}/gvim
install -p -m644 %{SOURCE3} \
%{buildroot}%{_datadir}/icons/hicolor/16x16/apps/gvim.png
install -p -m644 %{SOURCE4} \
@ -562,6 +593,20 @@ SentUpstream: 2014-05-22
</application>
EOF
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/metainfo/*.appdata.xml
for i in gvim.1 gex.1 gview.1 vimx.1; do
echo ".so man1/vim.1" > %{buildroot}/%{_mandir}/man1/$i
done
echo ".so man1/vimdiff.1" > %{buildroot}/%{_mandir}/man1/gvimdiff.1
echo ".so man1/vimtutor.1" > %{buildroot}/%{_mandir}/man1/gvimtutor.1
%else
# Remove files included in X11 subpackage, but built by default:
rm %{buildroot}/%{_mandir}/man1/evim.*
rm %{buildroot}/%{_datadir}/applications/{vim,gvim}.desktop
rm %{buildroot}/%{_datadir}/icons/{hicolor,locolor}/*/apps/gvim.png
%endif
( cd %{buildroot}
ln -sf %{_libexecdir}/vi .%{_bindir}/rvi
ln -sf %{_libexecdir}/vi .%{_bindir}/rview
@ -576,6 +621,8 @@ EOF
ln -sf vi.1.gz .%{_mandir}/man1/view.1
ln -sf vi.1.gz .%{_mandir}/man1/rview.1
ln -sf vim.1.gz .%{_mandir}/man1/vimdiff.1.gz
%if %{with gui}
ln -sf gvim ./%{_bindir}/gview
ln -sf gvim ./%{_bindir}/gex
ln -sf gvim ./%{_bindir}/evim
@ -591,13 +638,14 @@ EOF
mkdir -p ./%{_sysconfdir}/X11/applnk/Applications
cp %{buildroot}/%{_datadir}/applications/gvim.desktop ./%{_sysconfdir}/X11/applnk/Applications/gvim.desktop
%endif
%endif
# ja_JP.ujis is obsolete, ja_JP.eucJP is recommended.
( cd ./%{_datadir}/%{name}/%{vimdir}/lang; \
ln -sf menu_ja_jp.ujis.vim menu_ja_jp.eucjp.vim )
)
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/metainfo/*.appdata.xml
pushd %{buildroot}/%{_datadir}/%{name}/%{vimdir}/tutor
mkdir conv
iconv -f CP1252 -t UTF8 tutor.ca > conv/tutor.ca
@ -669,11 +717,9 @@ for i in fr.UTF-8 it.UTF-8 pl.UTF-8 da.UTF-8 de.UTF-8 tr.UTF-8; do
rm -rf %{buildroot}/%{_mandir}/$i
done
for i in rvim.1 gvim.1 gex.1 gview.1 vimx.1; do
echo ".so man1/vim.1" > %{buildroot}/%{_mandir}/man1/$i
done
echo ".so man1/vimdiff.1" > %{buildroot}/%{_mandir}/man1/gvimdiff.1
echo ".so man1/vimtutor.1" > %{buildroot}/%{_mandir}/man1/gvimtutor.1
# Install symlink for rvim man page
echo ".so man1/vim.1" > %{buildroot}/%{_mandir}/man1/rvim.1
mkdir -p %{buildroot}/%{_mandir}/man5
echo ".so man1/vim.1" > %{buildroot}/%{_mandir}/man5/vimrc.5
echo ".so man1/vi.1" > %{buildroot}/%{_mandir}/man5/virc.5
@ -711,9 +757,11 @@ touch %{buildroot}/%{_datadir}/%{name}/vimfiles/doc/tags
%{_datadir}/%{name}/%{vimdir}/print
%{_datadir}/%{name}/%{vimdir}/syntax
%{_datadir}/%{name}/%{vimdir}/tutor
%if ! %{withvimspell}
%{_datadir}/%{name}/%{vimdir}/spell
%endif
%lang(af) %{_datadir}/%{name}/%{vimdir}/lang/af
%lang(ca) %{_datadir}/%{name}/%{vimdir}/lang/ca
%lang(cs) %{_datadir}/%{name}/%{vimdir}/lang/cs
@ -756,16 +804,20 @@ touch %{buildroot}/%{_datadir}/%{name}/vimfiles/doc/tags
%lang(zh_CN.UTF-8) %{_datadir}/%{name}/%{vimdir}/lang/zh_CN.UTF-8
%lang(zh_TW.UTF-8) %{_datadir}/%{name}/%{vimdir}/lang/zh_TW.UTF-8
/%{_bindir}/xxd
%{_mandir}/man1/gex.*
%{_mandir}/man1/gview.*
%{_mandir}/man1/gvim*
%{_mandir}/man1/rvim.*
%{_mandir}/man1/vim.*
%{_mandir}/man1/vimdiff.*
%{_mandir}/man1/vimtutor.*
%{_mandir}/man1/vimx.*
%{_mandir}/man1/xxd.*
%{_mandir}/man5/vimrc.*
%if %{with gui}
%{_mandir}/man1/gex.*
%{_mandir}/man1/gview.*
%{_mandir}/man1/gvim*
%{_mandir}/man1/vimx.*
%endif
%lang(fr) %{_mandir}/fr/man1/*
%lang(da) %{_mandir}/da/man1/*
%lang(de) %{_mandir}/de/man1/*
@ -873,14 +925,15 @@ touch %{buildroot}/%{_datadir}/%{name}/vimfiles/doc/tags
%dir %{_datadir}/%{name}/vimfiles/syntax
%dir %{_datadir}/%{name}/vimfiles/tutor
%if %{with gui}
%files X11
%if "%{desktop_file}" == "1"
%if "%{desktop_file}" == "1"
%{_datadir}/metainfo/*.appdata.xml
/%{_datadir}/applications/*
%exclude /%{_datadir}/applications/vim.desktop
%else
%else
/%{_sysconfdir}/X11/applnk/*/gvim.desktop
%endif
%endif
%{_bindir}/gvimtutor
%{_bindir}/gvim
%{_bindir}/gvimdiff
@ -898,6 +951,7 @@ touch %{buildroot}/%{_datadir}/%{name}/vimfiles/doc/tags
%dir %{_datadir}/icons/locolor/*
%dir %{_datadir}/icons/locolor/*/apps
%{_datadir}/icons/locolor/*/apps/*
%endif
%files data
%license LICENSE
@ -915,6 +969,9 @@ touch %{buildroot}/%{_datadir}/%{name}/vimfiles/doc/tags
%endif
%changelog
* Fri Jan 07 2022 Malcolm Inglis <miinglis@amazon.com> - 2:8.2.4006-2
- add 'gui' build condition for vim-X11
* Wed Jan 05 2022 Zdenek Dohnal <zdohnal@redhat.com> - 2:8.2.4006-1
- patchlevel 4006