%define debug_package %{nil} %define gopath https://github.com/go-gitea/gitea Name: gitea Version: 1.23.7 Release: 1%{?dist} Summary: Git with a cup of tea, painless self-hosted git service License: MIT Group: Development/Other URL: https://gitea.io/ Source0: https://github.com/go-gitea/gitea/releases/download/v%{version}/gitea-src-%{version}.tar.gz Source1: gitea.service Source2: gitea.service.d.conf Source3: app.ini Requires: git-core BuildRequires: golang BuildRequires: make BuildRequires: pam-devel BuildRequires: pkgconfig(sqlite3) BuildRequires: nodejs BuildRequires: systemd-devel %description The goal of this project is to make the easiest, fastest, and most painless way of setting up a self-hosted Git service. It is similar to GitHub, Bitbucket and Gitlab. Gitea is a fork of Gogs. %prep %autosetup -p1 -n %{name}-src-%{version} %build TEMP_LDFLAGS="%{build_ldflags}" export LDFLAGS="" %make_build %{?_smp_mflags} V=1 \ VERSION=%{version} \ TAGS="bindata sqlite sqlite_unlock_notify pam" \ LDFLAGS="" \ EXTRA_LDFLAGS="-linkmode external -extldflags '$TEMP_LDFLAGS'" %install mkdir -p %{buildroot}/srv/%{name} mkdir -p %{buildroot}%{_localstatedir}/log/%{name} install -Dm 0755 %{name} %{buildroot}%{_bindir}/%{name} install -Dm 0640 %SOURCE1 %{buildroot}%{_unitdir}/%{name}.service mkdir -p %{buildroot}%{_sysconfdir}/systemd/system/gitea.service.d install -Dm 0640 %SOURCE2 %{buildroot}%{_sysconfdir}/systemd/system/gitea.service.d/port.conf install -Dm 0660 %SOURCE3 %{buildroot}%{_sysconfdir}/%{name}/conf/app.ini # install docs mkdir -p %{buildroot}%{_docdir}/%{name} install -Dm 0644 "custom/conf/app.example.ini" \ %{buildroot}%{_docdir}/%{name}/default-app.ini mkdir -p %{buildroot}%{_sysusersdir} cat >%{buildroot}%{_sysusersdir}/%{name}.conf <<'EOF' g %{name} - - u %{name} - "gitea server" /srv/gitea /sbin/nologin EOF %pre # Create the group if it doesn't exist already getent group %{name} >/dev/null || groupadd -r %{name} # Create the user if it doesn't exist already getent passwd %{name} >/dev/null || \ useradd -r -g %{name} -d /srv/%{name} -s /sbin/nologin \ -c "gitea server" %{name} exit 0 %files %attr(6755,root,%{name}) %{_bindir}/%{name} %dir %attr(0700,%{name},%{name}) /srv/%{name} %dir %attr(0700,%{name},%{name}) %{_localstatedir}/log/%{name} %dir %{_sysconfdir}/%{name} %dir %{_sysconfdir}/%{name}/conf %config(noreplace) %attr(0660,root,%{name}) %{_sysconfdir}/%{name}/conf/app.ini %config(noreplace) %attr(0660,root,%{name}) %{_sysconfdir}/systemd/system/gitea.service.d/port.conf %{_unitdir}/%{name}.service %{_docdir}/%{name}/default-app.ini %doc *.md %{_sysusersdir}/*.conf