# Contributor: Carlo Landmeter # Maintainer: 7heo <7heo@mail.com> pkgname=gitea pkgver=1.2.1 pkgrel=0 pkgdesc="A self-hosted Git service written in Go" url="http://gitea.io/" arch="all !s390x" license="MIT" depends="git" makedepends="go libcap" install="$pkgname.pre-install" pkgusers="gitea" pkggroups="www-data" source="${pkgname}-${pkgver}.tar.gz::https://github.com/go-gitea/$pkgname/archive/v$pkgver.tar.gz $pkgname.initd $pkgname.ini allow-to-set-version.patch " builddir="$srcdir/src/code.gitea.io/$pkgname" prepare() { mkdir -p ${builddir%/*} mv "$srcdir"/$pkgname-$pkgver "$builddir"/ cd "$builddir" default_prepare } build() { cd "$builddir" export GOPATH="$srcdir" export TAGS="tidb sqlite" export VERSION="$pkgver" unset LDFLAGS make build } package() { cd "$builddir" for dir in $pkgname $pkgname/git $pkgname/data $pkgname/db $pkgname/custom; do install -d -m 750 -o gitea -g www-data \ "$pkgdir"/var/lib/$dir done install -d -m 755 -o gitea -g www-data "$pkgdir"/var/log/$pkgname install -D -m 755 $pkgname "$pkgdir"/usr/bin/$pkgname # Allow non root to bind to port 80. setcap cap_net_bind_service=+ep \ "$pkgdir"/usr/bin/$pkgname install -D -m 644 -o gitea -g www-data "$srcdir"/${pkgname}.ini \ "$pkgdir"/etc/$pkgname/app.ini chown gitea:www-data "$pkgdir"/etc/$pkgname install -d -m 755 "$pkgdir"/usr/share/webapps/$pkgname mv options public templates "$pkgdir"/usr/share/webapps/$pkgname/ install -D -m 755 "$srcdir"/$pkgname.initd \ "$pkgdir"/etc/init.d/$pkgname } check() { # basic check to see if the app works "$builddir"/$pkgname help > /dev/null } sha512sums="a8c446361d69fb71d4ee2b6476dd49b84cd88d0eb53b3f6b86a7dbd8c7189a81f65d6178aed96fb6a15dfba5940ec2026c8ff104a249405e3e14a76cd9bb8103 gitea-1.2.1.tar.gz a7c70a144dc0582d6230e59ff717023fddcac001a6a9c895b46a0df1fbd9639453b2f5027d47dad21f442869c145dbc801eda61b6c50a2dd8103f562b8569009 gitea.initd 27a202006d6e8d4146659f6356eaa99437f9f596dd369e9430d64b859bc6a1ad16091eef09232aa385fe1bf8ca94bbdf31b94975068220ad10338cded384f726 gitea.ini e38a701faed6749cbb897536d9ec7e723dc258c01b43daea7e19f3bd56dda4d69cd3be2b0813c24bef902f0b82c734120e36276b4e72899d2d2b3be54dc4574e allow-to-set-version.patch"