Support building for EPEL 9

This commit is contained in:
Maxwell G 2024-03-02 17:53:39 +00:00
commit 4b6a9ef71e
Signed by: gotmax23
GPG key ID: F79E4E25E8C661F8
4 changed files with 44 additions and 2 deletions

2
.gitignore vendored
View file

@ -8,3 +8,5 @@ __pycache__/
/FRAG.md
/GIT_MSG
/fedora*
# Build directory used to rename files for EPEL 9 usage
/epel9/

View file

@ -7,6 +7,20 @@ PREFIX := /usr
RPMMACRODIR := $(PREFIX)/lib/rpm/macros.d
RPMLUADIR := $(PREFIX)/lib/rpm/lua
# Install the macros
install:
install -Dpm 0644 rpm/macros.d/macros.* -t $(DESTDIR)$(RPMMACRODIR)/
install -Dpm 0644 rpm/lua/fedora/srpm/*.lua -t $(DESTDIR)$(RPMLUADIR)/fedora/srpm/
# Rename macros so they can be packaged for EPEL 9 without conflicting with EL
# 9's redhat-rpm-config package.
epel9-build:
./tools/epel9_build.sh
epel9-install:
$(MAKE) -C epel9 -f ../Makefile install
epel9: epel9-build epel9-install
clean:
rm -rf epel9/

View file

@ -44,8 +44,16 @@ Requires: redhat-rpm-config
%autosetup -n %{name}-v%{version}
%build
%if %{defined el9}
%make_build epel9-build
%endif
%install
%make_install RPMMACRODIR=%{_rpmmacrodir} RPMLUADIR=%{_rpmluadir}
%make_build \
DESTDIR=%{buildroot} \
RPMMACRODIR=%{_rpmmacrodir} RPMLUADIR=%{_rpmluadir} %{?el9:epel9-}install
%check
@ -59,8 +67,13 @@ export MACRO_LUA_DIR="%{buildroot}%{_rpmluadir}"
%files
%license LICENSES/GPL-1.0-or-later.txt
%doc README.md NEWS.md
%{_rpmmacrodir}/macros.forge
%if %{undefined el9}
%{_rpmluadir}/fedora/srpm/forge.lua
%{_rpmmacrodir}/macros.forge
%else
%{_rpmluadir}/fedora/srpm/forge_epel.lua
%{_rpmmacrodir}/macros.zzz-forge_epel
%endif
%{_rpmluadir}/fedora/srpm/_forge_util.lua

13
tools/epel9_build.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash -x
# Copyright (C) 2024 Maxwell G <maxwell@gtmx.me>
# SPDX-License-Identifier: GPL-1.0-or-later
set -euo pipefail
mkdir -p epel9/rpm/macros.d epel9/rpm/lua/fedora/srpm
cp -p rpm/macros.d/macros.forge epel9/rpm/macros.d/macros.zzz-forge_epel
cp -p rpm/lua/fedora/srpm/forge.lua epel9/rpm/lua/fedora/srpm/forge_epel.lua
sed -Ei '/require "fedora.srpm.forge"/s/forge"$/forge_epel"/' \
epel9/rpm/macros.d/macros.zzz-forge_epel
# This can stay as is. The file does not exist in EL 9.
cp -p rpm/lua/fedora/srpm/_forge_util.lua epel9/rpm/lua/fedora/srpm