pkgname=glow pkgver=2.0.0 pkgrel=1 pkgdesc="Command-line markdown renderer" arch=('x86_64') url="https://github.com/charmbracelet/glow" license=('MIT') depends=('glibc') makedepends=('go') options=('!lto') source=(https://github.com/charmbracelet/glow/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz) sha256sums=(55872e36c006e7e715b86283baf14add1f85b0a0304e867dd0d80e8d7afe49a8) prepare() { cd ${pkgname}-${pkgver} mkdir -p build export GOPROXY=https://goproxy.cn # download dependencies export GOPATH=${srcdir} go mod download } build() { cd ${pkgname}-${pkgver} export GOPROXY=https://goproxy.cn export GOPATH="${srcdir}" export CGO_CPPFLAGS="${CPPFLAGS}" export CGO_CFLAGS="${CFLAGS}" export CGO_CXXFLAGS="${CXXFLAGS}" export CGO_LDFLAGS="${LDFLAGS}" export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw" go build -v -ldflags "-X main.Version=${pkgver}" -o build . build/glow completion bash > completion.bash build/glow completion fish > completion.fish build/glow completion zsh > completion.zsh } package() { cd ${pkgname}-${pkgver} install -Dm 755 build/${pkgname} ${pkgdir}/usr/bin/${pkgname} install -Dm 644 completion.bash ${pkgdir}/usr/share/bash-completion/completions/${pkgname} install -Dm 644 completion.fish ${pkgdir}/usr/share/fish/vendor_completions.d/${pkgname}.fish install -Dm 644 completion.zsh ${pkgdir}/usr/share/zsh/site-functions/_${pkgname} }