summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 496ee11a709cc4daf4f4c2299fb78f2bf726cba7 (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
# Maintainer: Tournesol <bonjour@tournesol.me>
_pkgname=mpls
pkgname=$_pkgname-git
pkgver=0.12.1.r1.g723098a
pkgrel=1
pkgdesc="A markdown language server with live preview in browser"
arch=('x86_64' 'aarch64')
url="https://github.com/mhersson/mpls"
license=('Apache-2.0')
depends=('glibc')
makedepends=('git' 'go')
provides=("${_pkgname}")
conflicts=("${_pkgname}")
source=("$_pkgname::git+https://github.com/mhersson/$_pkgname.git")
sha256sums=('SKIP')

pkgver() {
  cd "${_pkgname}"
  # cutting off 'v' prefix that presents in the git tag
  git describe --long --abbrev=7 --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
	cd "${_pkgname}"
	# Go package flags for hardening : https://wiki.archlinux.org/title/Go_package_guidelines#Flags_and_build_options
	export CGO_LDFLAGS="${LDFLAGS}"
	export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
	make build
}

check() {
	cd "${_pkgname}"
	make test
}

package() {
	cd "${_pkgname}"

	install -Dm755 $_pkgname "$pkgdir/usr/bin/$_pkgname"
	install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"
}