blob: 33002b3219bf8e4262f8f9f41967cfb55da8e791 (
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
|
# Contributor: howeyc <chris@howey.me>
# Contributor: Marcell Meszaros < marcell.meszaros AT runbox.eu >
# Contributor: aksr <aksr at t-com dot me>
pkgname='ivy-calc-git'
_basename="${pkgname%-git}" # name of the non-VCS package
_reponame='ivy' # name of the project's VCS repository
_binname='ivyc' # name of the executable; default is 'ivy' but that conflicts with ivy from Apache
pkgver=0.2.8.r1.gd463f69
pkgrel=1
pkgdesc='An APL-like calculator.'
arch=('i686' 'x86_64')
url="https://github.com/robpike/${_reponame}"
license=('BSD')
depends=('glibc')
makedepends=(
'git'
'go>=1.5'
)
provides=(
"${_basename}=${pkgver%.r*}"
"${_binname}=${pkgver%.r*}"
)
conflicts=(
"${_basename}"
"${_binname}"
'ivy-git<1' # former AUR package (did not have git tag based version, only r{REVISION}.g{COMMITHASH})
)
replaces=('ivy-git<1') # former AUR package (did not have git tag based version, only r{REVISION}.g{COMMITHASH})
source=("${_basename}::git+${url}.git")
b2sums=('SKIP')
pkgver() {
cd "${_basename}"
# Generate git tag based version. Count only proper (v)#.#* [#=number] tags.
local _gitversion=$(git describe --long --tags --match '[v0-9][0-9.][0-9.]*' | sed -e 's|^v||' | tr '[:upper:]' '[:lower:]')
# Format git-based version for pkgver
# Expected format: e.g. 0.2.8.r1.gd463f69
echo "${_gitversion}" | sed \
-e 's|^\([0-9][0-9.]*\)-\([a-zA-Z]\+\)|\1\2|' \
-e 's|\([0-9]\+-g\)|r\1|' \
-e 's|-|.|g'
}
build() {
cd "${_basename}"
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
go build \
-o "${_binname}" \
-trimpath \
-buildmode='pie' \
-mod='readonly' \
-modcacherw \
-ldflags "-linkmode external -extldflags \"${LDFLAGS}\"" \
.
}
package() {
cd "${_basename}"
install -Dm 755 "${_binname}" -t "${pkgdir}/usr/bin"
install -Dm 644 'LICENSE' -t "${pkgdir}/usr/share/licenses/${pkgname}"
sed '11,375!d' 'doc.go' > 'README'
install -Dm 644 'README' -t "${pkgdir}/usr/share/doc/${pkgname}"
}
|