lua-luarocks/lua-luarocks.spec

96 lines
3.4 KiB
RPMSpec

#
# spec file for package lua-luarocks
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2012 Togan Muftuoglu toganm@opensuse.org
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define flavor @BUILD_FLAVOR@
%define mod_name luarocks
%define lua_value %(echo "%{flavor}" |sed -e 's:lua::')
Name: %{flavor}-%{mod_name}
Version: 2.4.2
Release: 0
Summary: A deployment and management system for Lua modules
License: MIT
Group: Development/Languages/Other
Url: https://luarocks.org
Source: https://github.com/luarocks/luarocks/archive/v%{version}.tar.gz#/%{mod_name}-%{version}.tar.gz
BuildRequires: %{flavor}-devel
BuildRequires: curl
BuildRequires: openssl
Requires: %{flavor}
BuildArch: noarch
%description
LuaRocks allows you to install Lua modules as self-contained packages
called "rocks", which also contain version dependency
information. This information is used both during installation, so
that when one rock is requested all rocks it depends on are installed
as well, and at run time, so that when a module is required, the
correct version is loaded. LuaRocks supports both local and remote
repositories, and multiple local rocks trees.
%prep
%setup -q -n %{mod_name}-%{version}
%build
# Not an autotools based system
./configure \
--prefix=%{_prefix} \
--lua-version=%{lua_version} \
--with-downloader=curl \
--with-md5-checker=openssl \
--versioned-rocks-dir
make %{?_smp_mflags} build
%install
%make_install
# Add C module lib directory to fix "built" rocks not working
# See https://github.com/keplerproject/luarocks/issues/416
%if %{_lib}==lib64
echo -e -n "\nlib_modules_path=\"/%{_lib}/lua/\"..lua_version" >> %{buildroot}%{_sysconfdir}/luarocks/config-%{lua_version}.lua
%endif
# update-alternatives
mkdir -p %{buildroot}%{_sysconfdir}/alternatives/
touch %{buildroot}%{_sysconfdir}/alternatives/luarocks
ln -sf %{_sysconfdir}/alternatives/luarocks %{buildroot}%{_bindir}/luarocks
touch %{buildroot}%{_sysconfdir}/alternatives/luarocks-admin
ln -sf %{_sysconfdir}/alternatives/luarocks %{buildroot}%{_bindir}/luarocks-admin
%post
%{_sbindir}/update-alternatives --install %{_bindir}/luarocks luarocks %{_bindir}/luarocks-%{lua_version} %{lua_value} \
--slave %{_bindir}/luarocks-admin luarocks-admin %{bindir}/luarocks-%{lua_version}
%postun
if [ "$1" = 0 ] ; then
%{_sbindir}/update-alternatives --remove luarocks %{_bindir}/luarocks-%{lua_version}
fi
%files
%doc COPYING README.md
%dir %{_sysconfdir}/luarocks
%config(noreplace) %{_sysconfdir}/luarocks/config-%{lua_version}.lua
%ghost %{_sysconfdir}/alternatives/luarocks
%ghost %{_sysconfdir}/alternatives/luarocks-admin
%{_bindir}/luarocks
%{_bindir}/luarocks-admin
%{_bindir}/luarocks-%{lua_version}
%{_bindir}/luarocks-admin-%{lua_version}
%{lua_noarchdir}/luarocks
%changelog