# TODO
# - -rt subpackage? -lang subpackage?
+# - <meta>-xxx keybindings (alt+something) incompatibility
+# https://github.com/neovim/neovim/issues/5576
#
# Conditional build:
-%bcond_with lua # LUA
+%bcond_with prefer_lua # Prefer Lua over LuaJit
+
+%ifarch x32
+%define with_prefer_lua 1
+%endif
Summary: Vim-fork focused on extensibility and agility
Name: neovim
-Version: 0.1.5
-Release: 0.4
+Version: 0.3.8
+Release: 1
License: Apache v2.0
Group: Applications/Editors/Vim
+# Source0Download: https://github.com/neovim/neovim/releases
Source0: https://github.com/neovim/neovim/archive/v%{version}/%{name}-%{version}.tar.gz
+# Source0-md5: 6b0eda6c3c6261c82f8a61f9c2d85fcd
URL: https://neovim.io/
-Source1: %{name}.desktop
Source2: %{name}.svg
+Patch0: desktop.patch
+Patch1: https://github.com/neovim/neovim/pull/12142.patch
+# Patch1-md5: 40bf36c33b4c49270243b39b916e164c
BuildRequires: cmake >= 2.8.7
-BuildRequires: fdupes
BuildRequires: gcc >= 6:4.4
-BuildRequires: hicolor-icon-theme
+BuildRequires: gettext-devel
BuildRequires: jemalloc-devel
BuildRequires: libstdc++-devel
BuildRequires: libtermkey-devel
BuildRequires: libuv-devel
-BuildRequires: libvterm-devel
+BuildRequires: libvterm-devel < 0.1.3
+BuildRequires: lua-bitop >= 1.0.2
+BuildRequires: lua-lpeg
+BuildRequires: lua-mpack >= 1.0.2
BuildRequires: msgpack-devel >= 1.1.0
BuildRequires: pkgconfig
BuildRequires: rpmbuild(macros) >= 1.596
BuildRequires: unibilium-devel
-%if %{with lua}
-BuildRequires: lua-lpeg
-BuildRequires: lua-mpack >= 1.0.2
-BuildRequires: lua51-BitOp
+%if %{with prefer_lua}
+BuildRequires: lua51
+BuildRequires: lua51-devel
+%else
BuildRequires: luajit-devel
%endif
Requires: desktop-file-utils
Requires: hicolor-icon-theme
Suggests: python-neovim
Suggests: python3-neovim
+Suggests: ruby-neovim
Suggests: xsel
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+# gcc 4.0 and better turn on _FORTIFY_SOURCE=2 automatically. This currently
+# does not work with Neovim due to some uses of dynamically-sized structures.
+# See https://github.com/neovim/neovim/issues/223 for details.
+%define filterout_c -Wp,-D_FORTIFY_SOURCE=2
+
%description
Neovim is a refactor - and sometimes redactor - in the tradition of
Vim, which itself derives from Stevie. It is not a rewrite, but a
%prep
%setup -q
-
-%if 0
-# Remove __DATE__ and __TIME__.
-BUILD_TIME=$(LC_ALL=C date -ur %{_sourcedir}/%{name}.changes +'%{H}:%{M}')
-BUILD_DATE=$(LC_ALL=C date -ur %{_sourcedir}/%{name}.changes +'%{b} %{d} %{Y}')
-sed -i "s/__TIME__/\"$BUILD_TIME\"/" $(grep -rl '__TIME__')
-sed -i "s/__DATE__/\"$BUILD_DATE\"/" $(grep -rl '__DATE__')
-%endif
+%patch0 -p1
+%patch1 -p1
%build
install -d .deps build
-DUSE_BUNDLED_LIBVTERM=OFF \
-DUSE_BUNDLED_LIBUV=OFF \
-DUSE_BUNDLED_MSGPACK=OFF \
- -DUSE_BUNDLED_LUAJIT=ON \
- -DUSE_BUNDLED_LUAROCKS=ON \
- -DUSE_BUNDLED_LUV=ON \
+ -DUSE_BUNDLED_LUAJIT=OFF \
+ -DUSE_BUNDLED_LUAROCKS=OFF \
+ -DUSE_BUNDLED_LUV=OFF \
../third-party
%{__make}
cd ../build
%cmake \
- -DLUA_PRG=/usr/bin/luajit \
+ -DPREFER_LUA=%{!?with_prefer_lua:OFF}%{?with_prefer_lua:ON} \
+ -DLUA_PRG=/usr/bin/lua5.1 \
-DENABLE_JEMALLOC=ON \
-DLUAJIT_USE_BUNDLED=OFF \
-DLIBUV_USE_BUNDLED=OFF \
%{__make} -C build install \
DESTDIR=$RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_iconsdir}/hicolor/scalable/apps}
-cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_desktopdir}/neovim.desktop
-cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_iconsdir}/hicolor/scalable/apps/neovim.svg
+install -d $RPM_BUILD_ROOT{/etc/xdg/nvim,%{_iconsdir}/hicolor/scalable/apps}
+touch $RPM_BUILD_ROOT/etc/xdg/nvim/init.vim
+cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_iconsdir}/hicolor/scalable/apps/nvim.svg
+
+%{__rm} -r $RPM_BUILD_ROOT%{_localedir}/cs.cp1250
+%{__rm} -r $RPM_BUILD_ROOT%{_localedir}/ja.euc-jp
+%{__rm} -r $RPM_BUILD_ROOT%{_localedir}/ko.UTF-8
+%{__rm} -r $RPM_BUILD_ROOT%{_localedir}/no
+%{__rm} -r $RPM_BUILD_ROOT%{_localedir}/pl.UTF-8
+%{__rm} -r $RPM_BUILD_ROOT%{_localedir}/sk.cp1250
+%{__rm} -r $RPM_BUILD_ROOT%{_localedir}/zh_CN.UTF-8
+%{__rm} -r $RPM_BUILD_ROOT%{_localedir}/zh_TW.UTF-8
%find_lang nvim
%files -f nvim.lang
%defattr(644,root,root,755)
%doc BACKERS.md CONTRIBUTING.md LICENSE README.md
+%dir /etc/xdg/nvim
+%config(noreplace) %verify(not md5 mtime size) /etc/xdg/nvim/init.vim
%attr(755,root,root) %{_bindir}/nvim
-%{_datadir}/nvim
-%{_desktopdir}/%{name}.desktop
-%{_iconsdir}/hicolor/*/apps/%{name}.svg
%{_mandir}/man1/nvim.1*
+%{_datadir}/nvim
+%{_desktopdir}/nvim.desktop
+%{_pixmapsdir}/nvim.png
+%{_iconsdir}/hicolor/*/apps/nvim.svg