summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: fb95d297759c301539757feb429fd9a9d906f469 (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
pkgname=cchat-gtk-git
_pkgname=cchat-gtk
pkgver=r123.776b58b
pkgrel=1
pkgdesc='Gtk frontend for cchat.'
arch=('any')
url='https://github.com/diamondburned/cchat-gtk'
license=('GPL3')
depends=('gtk3' 'libhandy0' 'gspell')
optdepends=('discordlogin-git: Discord login support')
provides=('cchat')
conflicts=('cchat')
# Maintainer: Nicholas George <vencorr@zoho.com>
makedepends=('git' 'go')
source=('git+https://github.com/diamondburned/cchat-gtk'
	'cchat-gtk.desktop')
sha256sums=('SKIP'
	'429790014af6dc2575dbcaf100008f9abdaf366553cc8665730e4c521018799f')

pkgver() {
	cd "$_pkgname"
	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
	# add config flags as per https://wiki.archlinux.org/index.php/Go_package_guidelines
	export CGO_CPPFLAGS="${CPPFLAGS}"
	export CGO_CFLAGS="${CFLAGS}"
	export CGO_CXXFLAGS="${CXXFLAGS}"
	export CGO_LDFLAGS="${LDFLAGS}"
	export GOFLAGS="-buildmode=pie -trimpath -modcacherw"

	# check if user has already set their GoLang path
	if [[ -z "${GOPATH}" ]]; then
		export GOPATH="${srcdir}/go"
	fi
	cd "$_pkgname"
	go build -trimpath
}

package() {
	cd "$_pkgname"
	install -Dm755 "$_pkgname" "$pkgdir/usr/bin/$_pkgname"
	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$_pkgname/LICENSE"
	install -Dm644 "$srcdir/$_pkgname.desktop" "$pkgdir/usr/share/applications/$_pkgname.desktop"
	install -Dm644 icons/cchat_256.png "$pkgdir/usr/share/icons/hicolor/256x256/apps/cchat-gtk.png"
}