summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3782dde83c2e0ab122330f7405ae00480245f909 (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.9
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=('605e49f91569e2dbf163c09d12fcd1f36a73d5510829236cf0c2052140826467')

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"
}