2025-09-22 20:18:39 +02:00

58 lines
2.1 KiB
Bash

# Maintainer: Christoph Reiter <reiter.christoph@gmail.com>
_realname=restic
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.18.1
pkgrel=1
pkgdesc="Fast, secure, efficient backup program (mingw-w64)"
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
arch=('any')
url="https://github.com/restic/restic"
msys2_references=(
'anitya: 16643'
'archlinux: restic'
'aur: restic-git'
'gentoo: app-backup/restic'
'purl: pkg:golang/github.com/restic/restic'
)
options=('!strip')
license=("spdx:BSD-2-Clause")
makedepends=("${MINGW_PACKAGE_PREFIX}-go")
source=("${_realname}-${pkgver}.tar.gz::https://github.com/restic/restic/archive/v${pkgver}.tar.gz")
sha512sums=('7a0eb6bec02555b50ec7073cc631c1ec2e11ca2369b3c33d8b1d17086f2fedb14ac0025d004f19114537a0aab034df999bce7199594979bbefedb15116cce4e7')
b2sums=('3a062c09a2fb4e961d2e70fc5fff615af3a9a4aee24c3e31b63e2f11e9f334019dcc0c4271c134dda988b0b9563babdfdb7428c884207a1950d8add1fb44f83f')
build(){
cd "${_realname}-${pkgver}"
export GOOS=windows
export GOROOT=${MINGW_PREFIX}/lib/go
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
export GO_LDFLAGS="-s -w"
export GOFLAGS="-trimpath -mod=readonly -modcacherw -ldflags=-linkmode=external"
case "${CARCH}" in
x86_64)
GOFLAGS+=" -buildmode=pie"
;;
esac
go build -ldflags "-X 'main.version=${pkgver}'" ./cmd/...
}
check(){
cd "${_realname}-${pkgver}"
go test ./cmd/... ./internal/... || true
}
package() {
cd "${_realname}-${pkgver}"
install -Dm755 restic.exe "${pkgdir}${MINGW_PREFIX}/bin/restic.exe"
install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
install -Dm644 -t "${pkgdir}${MINGW_PREFIX}/share/man/man1/" doc/man/*.1
install -Dm644 doc/zsh-completion.zsh "${pkgdir}${MINGW_PREFIX}/share/zsh/site-functions/_restic"
install -Dm644 doc/bash-completion.sh "${pkgdir}${MINGW_PREFIX}/share/bash-completion/completions/restic"
install -Dm644 doc/fish-completion.fish "${pkgdir}${MINGW_PREFIX}/share/fish/vendor_completions.d/restic.fish"
}