File lua-moonscript.spec of Package lua-moonscript

#
# spec file for package lua-moonscript
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 lua53
%if "%{flavor}" == "test"
%define flavor lua53
%bcond_without test
%else
%bcond_with test
%endif
%define mod_name moonscript
%define upversion 0.5.0

%define lua_version 5.3
%define lualibdir %{_libdir}/lua/%{lua_version}
%define luapkgdir %{_datadir}/lua/%{lua_version}
%define lua_noarchdir %luapkgdir 

Version:        0.5.0
Release:        lp150.1.1
Summary:        A programmer friendly language that compiles to Lua
License:        MIT
Group:          Development/Libraries/Other
Url:            http://moonscript.org/
Source:         https://github.com/leafo/moonscript/archive/v%{upversion}.tar.gz#/%{mod_name}-%{upversion}.tar.gz
#BuildRequires: -post-build-checks -rpmlint-Factory -rpmlint-mini  -rpmlint
# optionally BuildRequires:  %%{flavor}-lnotify
BuildArch:      noarch
Requires:       %{flavor}
Requires:       %{flavor}-devel
%if "%{flavor}" == "lua53"
Provides:       lua-moonscript = %{version}
Obsoletes:      lua-moonscript < %{version}
%endif
%if "%{flavor}" == ""
Name:           lua-moonscript
ExclusiveArch:  do_not_build
%else
Name:           %{flavor}-moonscript
%endif
%if %{with test}
BuildRequires:  %{flavor}-busted
%endif

%description
A programmer friendly language that compiles to Lua.

%prep
%setup -q -n %{mod_name}-%{upversion}
sed -i 's|^#!/usr/bin/env lua|#!/usr/bin/lua%{lua_version}|' bin/moon{,c}
cd %lua_noarchdir


%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}
%endif

%check
%if %{with test}
busted
%endif

%if ! %{with test}
%files
%doc CHANGELOG.md README.md docs
%{_bindir}/moon*
%{lua_noarchdir}/moon*
%endif

%changelog
* Sat Nov  2 2019 Matej Cepl <mcepl@suse.com>
- Initial effort to package moonscript 0.5.0
openSUSE Build Service is sponsored by