archrelease: copy trunk to community-x86_64
[ArchLinux/community.git] / mage / trunk / PKGBUILD
blob3803d6e4842061cc8bf5d7133a3f0f28b9f66996
1 # Contributor: Sven Greb <development@svengreb.de>
2 # Contributor: Arctic Ice Studio <development@arcticicestudio.com>
4 pkgname=mage
5 pkgver=1.15.0
6 pkgrel=1
7 pkgdesc="A Make/rake-like build tool using Go"
8 arch=("x86_64")
9 url="https://magefile.org"
10 license=("Apache")
11 makedepends=(go)
12 source=($pkgname-$pkgver.tar.gz::https://github.com/magefile/mage/archive/refs/tags/v$pkgver.tar.gz)
13 sha256sums=('3ce55e39d175d925c015b4dc773cea1fc4d3c64af9edcec6f9b7ab9388b751bf')
15 build() {
16   cd "$pkgname-$pkgver"
18   # mage is build with mage itself, therefore we simluate the execution of the provided `bootstrap.go` installation
19   # file that is recommended by the author.
20   # The file builds mage when mage itself is not installed on the target system yet and included metadata information
21   # for the binary.
23   # References:
24   #   1. https://github.com/magefile/mage/blob/fe9f9420/.goreleaser.yml#L27
25   #   2. https://github.com/magefile/mage/blob/fe9f9420/.goreleaser.yml#L10
26   export CGO_ENABLED=0
27   local BUILD_DATE="$(date --rfc-3339=date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}")"
28   go build \
29     -trimpath \
30     -buildmode=pie \
31     -mod=readonly \
32     -modcacherw \
33     -ldflags "-X \"github.com/magefile/mage/mage.timestamp=${BUILD_DATE}\" \
34               -X \"github.com/magefile/mage/mage.gitTag=v$pkgver\" \
35               -extldflags \"${LDFLAGS}\"" \
36     -o build/"$pkgname" .
39 package() {
40   cd "$pkgname-$pkgver"
41   install -Dm755 build/"$pkgname" -t "$pkgdir/usr/bin/"
42   install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"