6 Commits

5 changed files with 112 additions and 5 deletions

1
.gitattributes vendored
View File

@@ -21,3 +21,4 @@
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*.changes merge=merge-changes

6
.gitignore vendored
View File

@@ -1 +1,5 @@
.osc
*.obscpio
*.osc
_build.*
.pbuild
lua*-fennel-*-build

6
_multibuild Normal file
View File

@@ -0,0 +1,6 @@
<multibuild>
<package>luajit</package>
<package>lua53</package>
<package>lua54</package>
<package>lua55</package>
</multibuild>

View File

@@ -1,3 +1,19 @@
-------------------------------------------------------------------
Fri Jan 23 21:38:01 UTC 2026 - Matej Cepl <mcepl@cepl.eu>
- Enable lua55 build.
-------------------------------------------------------------------
Sat Jan 10 09:48:18 UTC 2026 - Matej Cepl <mcepl@cepl.eu>
- It's %{lua_version}, not %{flavor}
-------------------------------------------------------------------
Wed Dec 3 18:31:43 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
- Proper multi-variant SPEC with properly set-up alternatives
Fixes: https://src.opensuse.org/pool/lua-fennel/issues/1
-------------------------------------------------------------------
Thu Nov 6 14:37:26 UTC 2025 - Matej Cepl <mcepl@cepl.eu>

View File

@@ -17,7 +17,18 @@
#
Name: lua-fennel
%define flavor @BUILD_FLAVOR@
%define mod_name fennel
%if "%{flavor}" == "luajit"
%define lua_value 52
%else
%define lua_value %(echo "%{flavor}" |sed -e 's:lua::')
%endif
%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif
Version: 1.6.0
Release: 0
Summary: Lisp dialect that compiles to Lua
@@ -25,10 +36,24 @@ License: MIT
# FIXME: use correct group or remove it, see "https://en.opensuse.org/openSUSE:Package_group_guidelines"
Group: Development/Languages/Lua
URL: https://fennel-lang.org/
Source0: https://git.sr.ht/~technomancy/fennel/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
BuildRequires: lua
Source0: https://git.sr.ht/~technomancy/fennel/archive/%{version}.tar.gz#/lua-%{mod_name}-%{version}.tar.gz
BuildRequires: %{flavor}
BuildRequires: lua-macros
BuildArch: noarch
%lua_provides
%if "%{flavor}" == ""
Name: lua-%{mod_name}
ExclusiveArch: do_not_build
%else
Name: %{flavor}-%{mod_name}
%endif
%if %{with libalternatives}
BuildRequires: alts
Requires: alts
%else
Requires(post): update-alternatives
Requires(postun): update-alternatives
%endif
%description
Fennel is a lisp that compiles to Lua. Features include:
@@ -48,19 +73,74 @@ Fennel is a lisp that compiles to Lua. Features include:
%autosetup -p1 -n fennel-%{version}
%build
%make_build %{?_make_output_sync} PREFIX=%{_prefix} LUA="lua%{lua_version}" fennel
%make_build %{?_make_output_sync} PREFIX=%{_prefix} LUA="lua" fennel
sed -i -e 's@#!%{_bindir}/env lua$@#!%{_bindir}/lua@' fennel
%install
%make_install %{?_make_output_sync} PREFIX=%{_prefix} install
mv -v %{buildroot}%{_bindir}/fennel{,-%{lua_version}}
chmod +x %{buildroot}%{_bindir}/fennel-%{lua_version}
sed -i -e 's,# *\!%{_bindir}/.*lua.*$,#!%{_bindir}/%{lua_version},' %{buildroot}%{_bindir}/fennel-%{lua_version}
# prepare manpages
for man in fennel.1 fennel-api.3 fennel-reference.5 fennel-tutorial.7 ; do
base="${man%.*}"
ext="${man#*.}"
mv -v %{buildroot}%{_mandir}/man${ext}/${man} \
%{buildroot}%{_mandir}/man${ext}/${base}.%{lua_version}.${ext}
done
%if %{with libalternatives}
# alternatives - create configuration file
ln -sf %{_bindir}/alts %{buildroot}%{_bindir}/fennel
mkdir -p %{buildroot}%{_datadir}/libalternatives/fennel
cat > %{buildroot}%{_datadir}/libalternatives/fennel/%{lua_value}.conf <<EOF
binary=%{_bindir}/fennel-%{lua_version}
man=fennel.1,fennel-api.3,fennel-reference.5,fennel-tutorial.7
EOF
%else
# update-alternatives
mkdir -p %{buildroot}%{_sysconfdir}/alternatives/
touch %{buildroot}%{_sysconfdir}/alternatives/fennel
ln -sf %{_sysconfdir}/alternatives/fennel %{buildroot}%{_bindir}/fennel
%endif
%check
%make_build %{?_make_output_sync} test
%if %{without libalternatives}
%post
%{_sbindir}/update-alternatives --install %{_bindir}/fennel fennel
%{_bindir}/fennel-%{lua_version} %{lua_value} \
%{_mandir}/man1/fennel.1 fennel \
%{_mandir}/man1/fennel.%{lua_version}.1 \
%{_mandir}/man3/fennel-api.3 fennel \
%{_mandir}/man3/fennel-api.%{lua_version}.3 \
%{_mandir}/man5/fennel-reference.5 fennel \
%{_mandir}/man5/fennel-reference.%{lua_version}.5 \
%{_mandir}/man7/fennel-tutorial.7 fennel \
%{_mandir}/man7/fennel-tutorial.%{lua_version}.7
%postun
if [ "$1" = 0 ] ; then
%{_sbindir}/update-alternatives --remove fennel
%{_bindir}/fennel-%{lua_version}
fi
%endif
%files
%doc README.md api.md changelog.md reference.md tutorial.md
%license LICENSE
%if ! %{with libalternatives}
%ghost %{_sysconfdir}/alternatives/fennel
%else
%dir %{_datadir}/libalternatives
%dir %{_datadir}/libalternatives/fennel
%{_datadir}/libalternatives/fennel/%{lua_value}.conf
%endif
%{_bindir}/fennel
%{_bindir}/fennel-%{lua_version}
%{lua_noarchdir}/fennel.lua
%{_mandir}/man*/fennel*%{?ext_man}