Fedora 29 rpm build file

#1

patch Makifile

| grep -v /vendor/
| sed s!_${PWD}!code.gitea.io/gitea!g | grep -v /vendor/

---------------------------rpm spec------------------------------

%global _missing_build_ids_terminate_build 0
#%global debug_package %{nil}

Name: gitea
Version: 1.8.0
Release: 1%{?dist}
Summary: A painless self-hosted Git service.

License: MIT
URL: https://github.com/go-gitea/%{name}
Source0: %{name}-%{version}.tar.gz
Source1: %{name}.service
Patch1: %{name}-%{version}-Makefile.patch

BuildRequires: autoconf
BuildRequires: automake
BuildRequires: golang >= 1.6
BuildRequires: go-bindata

Requires: glib2 >= 2.5
Requires: git >= 1.7

%description
Gitea is a community managed fork of Gogs, lightweight
code hosting solution written in Go and published
under the MIT license.

%prep
%setup -qn %{name}-%{version}
%patch1

%build
mkdir -p ./_build/src/
mv vendor/* ./_build/src/
ln -s $(pwd) ./_build/src/code.gitea.io/%{name}
rm -rf vendor

export GOPATH=$(pwd)/_build:%{gopath}

%{__make} %{?_smp_mflags} TAGS=“bindata” generate
make build

%install
%{__install} -D -m 0644 -p %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
%{__install} -D -m 0755 %{name} -t %{buildroot}%{_bindir}

mkdir -p %{buildroot}%{_sharedstatedir}/%{name}
mkdir -p %{buildroot}%{_sysconfdir}/%{name}
mkdir -p %{buildroot}%{_localstatedir}/log/%{name}

%pre
if [ “$1” = “1” ] ; then
getent group git >/dev/null || groupadd -f -g 874 -r git
if ! getent passwd git >/dev/null ; then
if ! getent passwd 874 >/dev/null ; then
useradd -r -u 874 -g git -M -s /usr/bin/git-shell -c “gitea server” git
else
useradd -r -g git -M -s /usr/bin/git-shell -c “gitea server” git
fi
fi
fi

%preun
systemctl stop gitea.service > /dev/null 2>&1

%files
%doc docs
%doc custom/conf/app.ini.sample
%doc contrib/mysql.sql
%{_bindir}/%{name}
%{_unitdir}/%{name}.service
%dir %{_sysconfdir}/%{name}
%defattr(-,git,git,-)
%dir %{_sharedstatedir}/%{name}
%dir %{_localstatedir}/log/%{name}

%changelog
XXXXXXXXXXXXXXXXXXXX

#2

patch file

— Makefile 2019-04-21 01:23:24.000000000 +0800
+++ Makefile.new 2019-05-07 17:32:49.551327260 +0800
@@ -38,7 +38,7 @@

LDFLAGS := -X “main.Version=(GITEA_VERSION)" -X "main.Tags=(TAGS)”

-PACKAGES ?= (filter-out code.gitea.io/gitea/integrations/migration-test,(filter-out code.gitea.io/gitea/integrations,(shell (GO) list ./… | grep -v /vendor/)))
+PACKAGES ?= (filter-out code.gitea.io/gitea/integrations/migration-test,(filter-out code.gitea.io/gitea/integrations,(shell (GO) list ./…| sed s!_{PWD}!code.gitea.io/gitea!g | grep -v /vendor/ ))) SOURCES ?= (shell find . -name “*.go” -type f)