File lua-luarocks.spec of Package luarocks
#
# spec file for package lua-luarocks
#
# Copyright (c) 2015 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/
#
Name: luarocks
Version: 2.3.0
Release: 0
Summary: A deployment and management system for Lua modules
License: MIT
Group: Development/Languages/Other
Url: https://luarocks.org
Source: http://keplerproject.github.io/luarocks/releases/luarocks-%{version}.tar.gz
BuildRequires: curl
BuildRequires: pkgconfig(lua)
Requires: lua
BuildRoot: %{_tmppath}/%{name}-%{version}-build
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 luarocks-%{version}
ls
# Remove DOS line endings
#for file in COPYING_7z; do
# sed "s|\r||g" $file > $file.new && \
# touch -r $file $file.new && \
# mv $file.new $file
#done
%build
#./configure --prefix=%{_prefix} --lua-version=%{lua_version} --sysconfdir=%{_sysconfdir}/luarocks --with-lua-lib=%{lua_noarchdir} --with-downloader=curl --versioned-rocks-dir
./configure --prefix=%{_prefix} --lua-version=%{lua_version} --sysconfdir=%{_sysconfdir}/luarocks --with-lua-lib=%{_libdir}/lua/%{lua_version} --with-downloader=curl --versioned-rocks-dir
#./configure --prefix=%{_prefix}
#{?_smp_mflags} -- luarocks makefile is not thread-safe
#make -j1
make build
%install
make DESTDIR=%{buildroot} install
##%make_install
##%ifarch x86_64
#echo "lib_modules_path=\"/lib64/lua/\"..lua_version" >> %{buildroot}/%{_sysconfdir}/luarocks/config-%{lua_version}.lua
##%else
#echo "lib_modules_path=\"/lib/lua/\"..lua_version" >> %{buildroot}/%{_sysconfdir}/luarocks/config-%{lua_version}.lua
##%endif
%check
# TODO - find how to run this without having to pre-download entire rocks tree
# ./test/run_tests.sh
%triggerin -- luarocks
#if [ "$1" -ge "1" ]; then
if [ "$1" -eq "1" ]; then
# string = $(tail -n 1 /etc/luarocks/config-%{lua_version}.lua)
if [[ $(tail -n 1 /etc/luarocks/config-%{lua_version}.lua) != *"lib_modules_path"* ]]; then
if [ "$(uname -m)" = "x86_64" ]; then
echo "lib_modules_path=\"/lib64/lua/\"..lua_version" >> /etc/luarocks/config-%{lua_version}.lua
else
echo "lib_modules_path=\"/lib/lua/\"..lua_version" >> /etc/luarocks/config-%{lua_version}.lua
fi
fi
fi
%files
%defattr(-,root,root)
%doc COPYING* README.md
%dir %{_sysconfdir}/luarocks
%config(noreplace) %{_sysconfdir}/luarocks/config-%{lua_version}.lua
%{_bindir}/luarocks
%{_bindir}/luarocks-admin
%{_bindir}/luarocks-%{lua_version}
%{_bindir}/luarocks-admin-%{lua_version}
%{lua_noarchdir}/luarocks
%changelog