2019-11-02 22:04:25 +00:00
|
|
|
#
|
|
|
|
# spec file for package lua-moonscript
|
|
|
|
#
|
2020-07-06 19:07:28 +00:00
|
|
|
# Copyright (c) 2020 SUSE LLC
|
2019-11-02 22:04:25 +00:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2020-07-06 19:07:28 +00:00
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
2019-11-02 22:04:25 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
%define flavor @BUILD_FLAVOR@
|
|
|
|
%if "%{flavor}" == "test"
|
|
|
|
%define flavor lua51
|
|
|
|
%bcond_without test
|
|
|
|
%else
|
|
|
|
%bcond_with test
|
|
|
|
%endif
|
|
|
|
%define mod_name moonscript
|
|
|
|
%define upversion 0.5.0
|
|
|
|
Version: 0.5.0
|
|
|
|
Release: 0
|
|
|
|
Summary: A programmer friendly language that compiles to Lua
|
|
|
|
License: MIT
|
|
|
|
Group: Development/Libraries/Other
|
2020-07-06 19:07:28 +00:00
|
|
|
URL: http://moonscript.org/
|
2019-11-02 22:04:25 +00:00
|
|
|
Source: https://github.com/leafo/moonscript/archive/v%{upversion}.tar.gz#/%{mod_name}-%{upversion}.tar.gz
|
2020-07-06 19:07:28 +00:00
|
|
|
BuildRequires: %{flavor}-alt-getopt
|
|
|
|
BuildRequires: %{flavor}-argparse >= 0.5
|
2019-11-02 22:04:25 +00:00
|
|
|
BuildRequires: %{flavor}-devel
|
2020-07-06 19:07:28 +00:00
|
|
|
BuildRequires: %{flavor}-loadkit
|
2019-11-02 22:04:25 +00:00
|
|
|
BuildRequires: %{flavor}-lpeg >= 0.10
|
|
|
|
BuildRequires: %{flavor}-luafilesystem >= 1.5
|
|
|
|
Requires: %{flavor}
|
2020-04-02 10:10:12 +00:00
|
|
|
Requires: %{flavor}-alt-getopt
|
2020-04-04 18:50:47 +00:00
|
|
|
Requires: %{flavor}-argparse
|
2020-07-06 19:07:28 +00:00
|
|
|
Requires: %{flavor}-loadkit
|
|
|
|
Requires: %{flavor}-lpeg
|
|
|
|
Requires: %{flavor}-luafilesystem
|
2020-07-09 19:50:21 +00:00
|
|
|
Requires(post): update-alternatives
|
|
|
|
Requires(postun): update-alternatives
|
|
|
|
# optionally BuildRequires: %%{flavor}-lnotify
|
|
|
|
BuildArch: noarch
|
2019-11-02 22:04:25 +00:00
|
|
|
%if "%{flavor}" == "lua53"
|
|
|
|
Provides: lua-moonscript = %{version}
|
|
|
|
Obsoletes: lua-moonscript < %{version}
|
|
|
|
%endif
|
|
|
|
%if "%{flavor}" == ""
|
|
|
|
Name: lua-moonscript
|
|
|
|
ExclusiveArch: do_not_build
|
|
|
|
%else
|
|
|
|
%if %{with test}
|
2020-04-07 10:05:24 +00:00
|
|
|
Name: %{flavor}-moonscript-test
|
2019-11-02 22:04:25 +00:00
|
|
|
BuildRequires: %{flavor}-busted
|
2020-04-07 10:05:24 +00:00
|
|
|
%else
|
|
|
|
Name: %{flavor}-moonscript
|
|
|
|
%endif
|
2019-11-02 22:04:25 +00:00
|
|
|
%endif
|
|
|
|
|
|
|
|
%description
|
|
|
|
A programmer friendly language that compiles to Lua.
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -q -n %{mod_name}-%{upversion}
|
2020-07-09 19:50:21 +00:00
|
|
|
sed -i 's|^#!%{_bindir}/env lua|#!%{_bindir}/lua%{lua_version}|' bin/moon{,c}
|
2019-11-02 22:04:25 +00:00
|
|
|
|
|
|
|
%build
|
|
|
|
/bin/true
|
|
|
|
|
|
|
|
%install
|
|
|
|
%if ! %{with test}
|
|
|
|
install -m 0755 -p -d %{buildroot}%{lua_noarchdir}
|
|
|
|
cp -r -p moonscript %{buildroot}%{lua_noarchdir}
|
|
|
|
cp -r -p moon %{buildroot}%{lua_noarchdir}
|
|
|
|
install -D -m 0755 -p -t %{buildroot}%{_bindir} bin/moon{,c}
|
2020-04-07 16:56:04 +00:00
|
|
|
|
|
|
|
# Alternatives
|
|
|
|
# create a dummy target for /etc/alternatives/vim
|
|
|
|
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
|
|
|
|
mv %{buildroot}%{_bindir}/moon{,-%{lua_version}}
|
|
|
|
mv %{buildroot}%{_bindir}/moonc{,-%{lua_version}}
|
|
|
|
ln -s -f %{_sysconfdir}/alternatives/moonc %{buildroot}%{_bindir}/moonc
|
|
|
|
ln -s -f %{_sysconfdir}/alternatives/moon %{buildroot}%{_bindir}/moon
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%if ! %{with test}
|
|
|
|
%post
|
|
|
|
update-alternatives --force \
|
|
|
|
--install %{_bindir}/moon moon %{_bindir}/moon-%{lua_version} 15 \
|
|
|
|
--slave %{_bindir}/moonc moonc %{_bindir}/moonc-%{lua_version}
|
|
|
|
|
|
|
|
%postun
|
2020-04-07 17:38:36 +00:00
|
|
|
if [ ! -f %{_bindir}/moon-%{lua_version} ] ; then
|
2020-04-07 16:56:04 +00:00
|
|
|
update-alternatives --remove moon %{_bindir}/moon-%{lua_version}
|
|
|
|
fi
|
2019-11-02 22:04:25 +00:00
|
|
|
%endif
|
|
|
|
|
|
|
|
%check
|
|
|
|
%if %{with test}
|
|
|
|
busted
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%if ! %{with test}
|
|
|
|
%files
|
|
|
|
%doc CHANGELOG.md README.md docs
|
2020-04-07 17:15:28 +00:00
|
|
|
%{_bindir}/moon
|
|
|
|
%{_bindir}/moon-%{lua_version}
|
|
|
|
%{_bindir}/moonc
|
|
|
|
%{_bindir}/moonc-%{lua_version}
|
2019-11-02 22:04:25 +00:00
|
|
|
%{lua_noarchdir}/moon*
|
2020-07-09 19:50:21 +00:00
|
|
|
%ghost %{_sysconfdir}/alternatives/moon
|
|
|
|
%ghost %{_sysconfdir}/alternatives/moonc
|
2019-11-02 22:04:25 +00:00
|
|
|
%endif
|
|
|
|
|
|
|
|
%changelog
|