aboutsummaryrefslogtreecommitdiffstats
path: root/community/gitea/APKBUILD
blob: 3232abc69c7395e4d8600784643a8a608f8adcf6 (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
74
75
76
77
78
79
80
81
82
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: 7heo <7heo@mail.com>
pkgname=gitea
pkgver=1.1.1
pkgrel=1
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"/ || return 1
        cd "$builddir"
	default_prepare
}

build() {
        cd "$builddir"
	export GOPATH="$srcdir"
	export TAGS="tidb sqlite"
	export VERSION="$pkgver"
	unset LDFLAGS
	make build
}

package() {
	cd "$builddir"

	install -d -m 0755 \
		"$pkgdir"/usr/share/webapps/$pkgname || return 1

	# TODO: Is it really necessary to be world-readable?!
	install -d -m 0755 -o gitea -g www-data \
		"$pkgdir"/var/lib/$pkgname \
		"$pkgdir"/var/lib/$pkgname/conf \
		"$pkgdir"/var/lib/$pkgname/git \
		"$pkgdir"/var/lib/$pkgname/db \
		"$pkgdir"/var/lib/$pkgname/avatars \
		"$pkgdir"/var/lib/$pkgname/attachements \
		"$pkgdir"/var/cache/$pkgname/sessions \
		"$pkgdir"/var/log/$pkgname \
		"$pkgdir"/etc/$pkgname/conf || return 1

	install -D -m 0755 $pkgname \
		"$pkgdir"/usr/bin/$pkgname || return 1
	# Allow to bind to port 80.
	setcap cap_net_bind_service=+ep \
		"$pkgdir"/usr/bin/$pkgname || return 1

	install -D -m 0664 -o gitea -g www-data "$srcdir"/${pkgname}.ini \
		"$pkgdir"/etc/$pkgname/conf/app.ini || return 1

	mv options/* "$pkgdir"/var/lib/$pkgname/conf || return 1
	chown gitea:www-data -R "$pkgdir"/var/lib/$pkgname/conf || return 1

	mv public templates "$pkgdir"/usr/share/webapps/$pkgname/ || return 1

	install -D -m755 "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname || return 1
}

check() {
	# basic check to see if the app works
	"$builddir"/$pkgname help > /dev/null || return 1
}

sha512sums="b7c4102da85e57d49997f4319e13d10c5f30dfbb5ef51a34e3a2b073c7160ae500a748f25133c30633eac3db320c41e76dc642e83e9f7e466445bdc2d0c0beb5  gitea-1.1.1.tar.gz
42d9cc1739ec9b8596b44c8f020685c1e7f5d1099dfabe8d39dce56535fad3c6addb5843e955a581e3f1934421b79fa3c1b81796d7a8275c89db7fbf2b39a1df  gitea.initd
07d31133712675cdef326da95bf6ea24d7312c58b126a160cf28a64a5548dbe72b9d64f99d25aaa052f08c7ae4d8a74425d8307a6f41a58bd74f34c8fdb08d8f  gitea.ini
e38a701faed6749cbb897536d9ec7e723dc258c01b43daea7e19f3bd56dda4d69cd3be2b0813c24bef902f0b82c734120e36276b4e72899d2d2b3be54dc4574e  allow-to-set-version.patch"