forgejo/forgejo.spec
Jason Rothstein e1f11e569e
Correct minimum golang version
Signed-off-by: Jason Rothstein <fdragon@fdragon.org>
2025-04-29 21:07:55 -05:00

101 lines
2.4 KiB
RPMSpec

ExclusiveArch: %{go_arches}
%if 0%{?el8}
%global debug_package %{nil}
%endif
%if 0%{?el9}
%global debug_package %{nil}
%endif
%if 0%{?fc41}
%global debug_package %{nil}
%endif
%if 0%{?fc42}
%global debug_package %{nil}
%endif
Name: forgejo
Version: 11.0.0
Release: 2%{?dist}
Summary: Beyond coding. We forge.
License: GPL-3.0-or-later
URL: https://forgejo.org/
Source0: https://codeberg.org/%{name}/%{name}/releases/download/v%{version}/%{name}-src-%{version}.tar.gz
BuildRequires: git
BuildRequires: golang >= 1.24
BuildRequires: pam-devel
Requires(pre): /usr/bin/getent
Requires(pre): /usr/sbin/useradd
Requires: git
%description
%prep
%setup -q -n %{name}-src-%{version}
%build
sed -i -e 's/-s -w //g' Makefile
LDFLAGS=""
export LDFLAGS
make \
TAGS="bindata timetzdata pam sqlite sqlite_unlock_notify" \
FORGEJO_VERSION="%{version}-%{release}" \
build
sed -i \
-e 's|^User=.*$|User=forgejo|g' \
-e 's|^Group=.*$|Group=forgejo|g' \
-e 's|^WorkingDirectory=.*$|WorkingDirectory=/var/lib/forgejo|g' \
-e 's|^ExecStart=.*$|ExecStart=%{_bindir}/forgejo web /etc/forgejo/app.ini|g' \
-e 's|^Environment=.*$|Environment=USER=forgejo HOME=/var/lib/forgejo FORGEJO_WORK_DIR=/var/lib/forgejo|g' \
contrib/systemd/forgejo.service
%install
rm -rf %{buildroot}
%{__install} -d %{buildroot}%{_bindir}
%{__install} -d %{buildroot}%{_sysconfdir}/forgejo
%{__install} -d %{buildroot}/usr/lib/systemd/system
%{__install} -d %{buildroot}/var/lib/forgejo
%{__install} -d %{buildroot}/var/log/forgejo
%{__install} -p -m 0755 gitea %{buildroot}%{_bindir}/%{name}
%{__install} -p -m 0644 contrib/systemd/forgejo.service %{buildroot}/usr/lib/systemd/system/forgejo.service
%pre
getent passwd forgejo > /dev/null 2>&1 || useradd -r -d /var/lib/forgejo -s /bin/bash forgejo
%post
if [ -x /usr/bin/systemctl ]
then
systemctl condrestart forgejo
elif [ -x /usr/sbin/service ]
then
service forgejo condrestart
fi
%files
%license LICENSE
%doc CODEOWNERS
%doc CONTRIBUTING.md
%doc DCO
%doc README.md
%doc RELEASE-NOTES.md
%attr(0700, forgejo, forgejo) %dir /var/lib/forgejo
%attr(0700, forgejo, forgejo) %dir /var/log/forgejo
%{_bindir}/%{name}
%attr(0644, root, root) /usr/lib/systemd/system/forgejo.service
%attr(-, forgejo, forgejo) %config(noreplace) %{_sysconfdir}/forgejo
%changelog
* Sun Apr 27 2025 Jason Rothstein
- 11.0.0
- goland >= 1.24
- debug packages won't be built