summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e9472236ec8d4b1071072c4a3e6bdc7683e2e709 (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
# Maintainer: Daniel Bermond <dbermond@archlinux.org>

pkgname=earthly
pkgver=0.8.15
pkgrel=1
pkgdesc='A build automation tool that executes in containers'
arch=('x86_64')
url='https://earthly.dev/'
license=('MPL-2.0')
depends=('docker')
makedepends=('git' 'go')
BUILDENV+=('!check')
source=("git+https://github.com/earthly/earthly.git#tag=v${pkgver}")
sha256sums=('b6f634564c82660ab15015766ed119a6c19d20a68f6346ee491f8edda3e29cb9')

prepare() {
    mkdir -p earthly/build
}

build() {
    local _ldflags='-linkmode=external'
    _ldflags+=" -X main.DefaultBuildkitdImage=docker.io/earthly/buildkitd:v${pkgver}"
    _ldflags+=" -X main.Version=v${pkgver}"
    _ldflags+=" -X main.GitSha=$(git -C earthly rev-parse HEAD)"
    local _tags='dfrunmount,dfrunsecurity,dfsecrets,dfssh,dfrunnetwork,dfheredoc,forceposix'
    export CGO_CPPFLAGS="$CPPFLAGS"
    export CGO_CFLAGS="$CFLAGS"
    export CGO_CXXFLAGS="$CXXFLAGS"
    export CGO_LDFLAGS="$LDFLAGS"
    export GOFLAGS='-buildmode=pie -trimpath -mod=readonly -modcacherw'
    cd earthly
    go build -tags "$_tags" -ldflags "$_ldflags" -o build ./cmd/...
}

check() {
    cd earthly
    go test ./...
}

package() {
    install -D -m755 earthly/build/earthly -t "${pkgdir}/usr/bin"
}