summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6fa94317e5952df99fc29883210bbeefa0df466d (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
# Maintainer: Vladislav Babenko <vlad1.96@mail.ru>

pkgname="yd-go-git"
_pkgname=${pkgname%-git}
pkgrel=9
pkgver="master.31083d9.r0.g31083d9"
pkgdesc="Panel indicator for Yandex-disk CLI daemon (linux)"
arch=('x86_64')
url="https://github.com/slytomcat/${_pkgname}/"
license=('GPL-3.0-only')
# Licences: https://spdx.org/licenses/
depends=('yandex-disk')
makedepends=('go' 'git' 'gendesk')
conflicts=('yd-go' 'yd-go-bin' 'yd-go-git-bin' 'yd-go-bin-git')
source=("git+https://github.com/slytomcat/yd-go.git")
sha256sums=('SKIP')

options=(!debug)

prepare() {
	echo "Creating desktop file..."
		gendesk -f -n --pkgname ${_pkgname} \
		--genericname "Yandex Disk panel" \
		--custom "GenericName[ru]=Панель Яндекс Диска" \
		--pkgdesc "${pkgdesc}" \
		--categories="Network; FileTools; Monitor" \
		--icon "/usr/share/pixmaps/${_pkgname}.png" \
		--exec "/usr/bin/${_pkgname}"
		# Desktop entry spec.:https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html 
		# Categories spec.: https://specifications.freedesktop.org/menu-spec/menu-spec-1.1.html#category-registry

	mkdir -p "${srcdir}/${_pkgname}/build"
}

pkgver() {
  cd "${_pkgname}"
  git describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
	echo "Build yd-go..."
		cd "${srcdir}/${_pkgname}"
		export CGO_LDFLAGS="${LDFLAGS}"
		export CGO_CFLAGS="${CFLAGS}"
		export CGO_CPPFLAGS="${CPPFLAGS}"
		export CGO_CXXFLAGS="${CXXFLAGS}"
		export CGO_ENABLED=0 
		go build \
			-buildvcs=false \
			-trimpath \
			-ldflags "-s -w -X main.version=v.${pkgver}" \
			-o build .
	
	#UPX not working with strip (set by defalut) option in PKGBUILD https://bbs.archlinux.org/viewtopic.php?id=235637
	#If you need UPX, set !strip in options()
	#echo "Compress yd-go..."
		#upx --best ${srcdir}/${_pkgname}/build/${_pkgname}
}

package() {
    echo "Install yd-go..."
	install -Dm755 "${srcdir}/${_pkgname}/build/${_pkgname}" "${pkgdir}/usr/bin/${_pkgname}"
	install -Dm644 "${srcdir}/${_pkgname}.desktop" "${pkgdir}/usr/share/applications/${_pkgname}.desktop"
	install -Dm644 "${srcdir}/${_pkgname}/icons/img/yd128.png" "${pkgdir}/usr/share/pixmaps/${_pkgname}.png"
}