aboutsummaryrefslogtreecommitdiffstats
path: root/community/gitea/APKBUILD
blob: 7ffbf704d01a7a0f8f3c8e1e9546f96336360c10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=gitea
pkgver=1.8.3
pkgrel=0
pkgdesc="A self-hosted Git service written in Go"
url="https://gitea.io"
arch="all !aarch64" # https://github.com/go-gitea/gitea/issues/5324
license="MIT"
[ "$CARCH" = x86 ] && options="!check" # git-lfs is currently not available
depends="git"
makedepends="go libcap"
checkdepends="bash git-lfs gnupg openssh openssh-keygen sqlite"
install="$pkgname.pre-install"
pkgusers="gitea"
pkggroups="www-data"
subpackages="$pkgname-openrc"
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() {
	export GOPATH="$srcdir"
	export TAGS="tidb sqlite sqlite_unlock_notify"
	export GITEA_VERSION="$pkgver"
	unset LDFLAGS
	make build
}

check() {
	make test
	timeout -s ABRT 20m make test-sqlite
}

package() {
	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
}

sha512sums="f6019fbfc056e4c7176222ccaca1cf638bd1f52323de54fcddc618129aeb778674f6e305de60e7d17b69505ad65439445ee6b5e368afdf0a6fbace7407acb495  gitea-1.8.3.tar.gz
2497e6f2a18e3ceb65352cd220eab2c1c0893d0e731600462a60397de2b70d7c1de7db2af2769b25fe708b0822c811bb20dc797b59b9dd93efb376bea1c35796  gitea.initd
27a202006d6e8d4146659f6356eaa99437f9f596dd369e9430d64b859bc6a1ad16091eef09232aa385fe1bf8ca94bbdf31b94975068220ad10338cded384f726  gitea.ini
4eee3ab54c6e44327a1f7e68a5de320204dd46852a7eee7d6652397f03f9af72fb28455dcaec9b6498439360c6c9699ce5a7c17b9e9b0b568c6840bf1e4d13e6  allow-to-set-version.patch"