##trace %global debug_package %{nil} %global build_ldflags %{nil} %global _smp_mflags -j1 %global FORGEJO_USR git %global FORGEJO_GRP forgejo Name: forgejo Version: 17.0.0 Release: 100%{?dist} Summary: Beyond coding, we forge License: GPL-3.0-or-later URL: https://codeberg.org/forgejo/forgejo Source0: %{URL}/releases/download/v%{version}/forgejo-src-%{version}.tar.gz Source1: forgejo_app.ini Source2: forgejo.tmpfiles Source3: forgejo.service Source4: forgejo_nginx_proxy.conf Source5: forgejo.sysusers BuildRequires: coreutils BuildRequires: go-rpm-macros BuildRequires: golang >= 1.25.6 BuildRequires: make BuildRequires: nodejs BuildRequires: sqlite-devel BuildRequires: systemd-rpm-macros Requires: git Requires: git-lfs %{?systemd_requires} %{?sysusers_requires_compat} %description Forgejo is a self-hosted lightweight software forge. Easy to install and low maintenance, it just does the job. %prep %setup -q -n forgejo-src-%{version} %build TAGS="bindata timetzdata sqlite sqlite_unlock_notify" make %{_smp_mflags} build sed -e 's/gitea/%{name}/g' \ < contrib/autocompletion/bash_autocomplete \ > %{name}.complete touch -r contrib/autocompletion/bash_autocomplete %{name}.complete %install # create directories install -d -m0750 %{buildroot}/{etc,run,var/log}/%{name} # instal gitea binary and rename to forgejo install -D -m0750 gitea %{buildroot}%{_bindir}/%{name} # activate config install -D -m0640 %{SOURCE1} %{buildroot}%{_sysconfdir}/%{name}/app.ini # install systemd files install -D -m0644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/%{name}.conf install -D -m0644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service # install nginx proxy config install -D -m0644 %{SOURCE4} . install -m644 -p -D %{name}.complete %{buildroot}%{_datadir}/bash-completion/completions/%{name} %files %license LICENSE %doc README.md forgejo_nginx_proxy.conf %{_bindir}/%{name} %config(noreplace) %{_sysconfdir}/%{name}/app.ini %{_localstatedir}/log/%{name} %{_tmpfilesdir}/%{name}.conf %{_unitdir}/%{name}.service %{_datadir}/bash-completion/completions/%{name} %pre %sysusers_create_compat %{S:5} %post if [ ! -f %{_sysconfdir}/%{name}/app.ini ]; then install -D -m0640 %{_sharedstatedir}/%{name}/custom/conf/app.ini.working %{_sysconfdir}/%{name}/app.ini fi # create required directories mkdir -m0750 -p /home/%{FORGEJO_USR}/%{name}/conf mkdir -m0750 -p /home/%{FORGEJO_USR}/%{name}/repos # add config symlink to /home/git/conf/app.ini for easier backup if [ -f %{_sysconfdir}/%{name}/app.ini ] ; then if [ -e /home/%{FORGEJO_USR}/%{name}/conf/app.ini ] ; then rm -f /home/%{FORGEJO_USR}/%{name}/conf/app.ini fi ln -s %{_sysconfdir}/%{name}/app.ini /home/%{FORGEJO_USR}/%{name}/conf/app.ini fi chown -R %{FORGEJO_USR}:%{FORGEJO_GRP} %{_sysconfdir}/%{name} chown -R %{FORGEJO_USR}:%{FORGEJO_GRP} /home/%{FORGEJO_USR} > /dev/null chown %{FORGEJO_USR}:%{FORGEJO_GRP} %{_bindir}/%{name} restorecon -v -F -R /home/%{FORGEJO_USR} > /dev/null restorecon -v -F -R %{_sysconfdir}/%{name} > /dev/null # enable httpd_can_network_connect or nginx -> forgejo is blocked /usr/sbin/setsebool httpd_can_network_connect 1 systemctl daemon-reload %systemd_post forgejo.service %preun %systemd_preun forgejo.service %postun %systemd_postun_with_restart forgejo.service %changelog * Sat Aug 01 2026 Patrick - initial release