APKBUILD 2.84 KB
Newer Older
Carlo Landmeter's avatar
Carlo Landmeter committed
1 2 3
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: 7heo <7heo@mail.com>
pkgname=gitea
4 5
pkgver=1.1.0
pkgrel=0
Carlo Landmeter's avatar
Carlo Landmeter committed
6 7 8 9 10
pkgdesc="A self-hosted Git service written in Go"
url="http://gitea.io/"
arch="all"
license="MIT"
depends="git"
11
makedepends="go libcap"
Carlo Landmeter's avatar
Carlo Landmeter committed
12 13 14 15 16 17
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.confd
18
	$pkgname.ini
19 20
	allow-to-set-version.patch
	"
Carlo Landmeter's avatar
Carlo Landmeter committed
21 22 23 24 25
builddir="$srcdir/src/code.gitea.io/$pkgname"

prepare() {
        mkdir -p ${builddir%/*}
        mv "$srcdir"/$pkgname-$pkgver "$builddir"/ || return 1
26 27
        cd "$builddir"
	default_prepare
Carlo Landmeter's avatar
Carlo Landmeter committed
28 29 30 31 32
}

build() {
        cd "$builddir"
	export GOPATH="$srcdir"
33 34
	export TAGS="tidb sqlite"
	export VERSION="$pkgver"
35
	unset LDFLAGS
36
	make build
Carlo Landmeter's avatar
Carlo Landmeter committed
37 38 39 40 41 42 43 44 45 46 47
}

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 \
48
		"$pkgdir"/var/lib/$pkgname/conf \
Carlo Landmeter's avatar
Carlo Landmeter committed
49 50 51 52 53 54 55 56
		"$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

57
	install -D -m 0755 $pkgname \
Carlo Landmeter's avatar
Carlo Landmeter committed
58 59 60 61 62 63 64 65
		"$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

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

Carlo Landmeter's avatar
Carlo Landmeter committed
69 70 71 72 73 74 75 76
	mv public templates "$pkgdir"/usr/share/webapps/$pkgname/ || return 1

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

77 78 79 80 81 82
check() {
	# basic check to see if the app works
	"$builddir"/$pkgname help > /dev/null 2>&1 || return 1
}

sha512sums="206b3b3b2af13634573bb956f7a7db11a45dba36b73a48fb2561018b445b9f7d215d77af6ed1b985d8098d835502544347974223d3892a75abfdce7f5769cbba  gitea-1.1.0.tar.gz
Carlo Landmeter's avatar
Carlo Landmeter committed
83
5cd3144d040139ff27fb5acef9b09406f7acbdda2779638ba20fcf8a7739697351502a26a30020a42c84b9146fdc96b9943b85099819a86facf0d53a4f000078  gitea.initd
84
ea4a771652871a6aefd5f236c6cd96bf0b17abb46a016e60fe1ae96b88df972e014be438f52dc9c0f8a35e50f5897d48b8a413a6aeaf54adf8ed1e1005e472c1  gitea.confd
85
07d31133712675cdef326da95bf6ea24d7312c58b126a160cf28a64a5548dbe72b9d64f99d25aaa052f08c7ae4d8a74425d8307a6f41a58bd74f34c8fdb08d8f  gitea.ini
86
e38a701faed6749cbb897536d9ec7e723dc258c01b43daea7e19f3bd56dda4d69cd3be2b0813c24bef902f0b82c734120e36276b4e72899d2d2b3be54dc4574e  allow-to-set-version.patch"