Files
bun-bin/PKGBUILD
Noel Jacob ff0c5452fe 1.0.31
2024-03-15 04:57:17 +00:00

62 lines
2.4 KiB
Bash

# Maintainer: Noel Jacob <noeljacob91 at gmail dot com>
# Contributor: thdxr (original PKGBUILD)
# Contributor: 37h4n (aarch64 support added by Ethan Reece <aur at ethanreece dot com>)
# Contributor: sh!zeeg (shizeeque@gmail.com) support for non-avx2 CPUs, shell completions.
pkgname=bun-bin
pkgver=1.0.31
pkgrel=1
pkgdesc="All-in-one JavaScript runtime built for speed, with bundler, transpiler, test runner, and package manager. Includes bunx, shell completions and support for baseline CPUs"
arch=('x86_64' 'aarch64')
url="https://github.com/oven-sh/bun"
license=('MIT')
provides=('bun')
conflicts=('bun')
sha256sums_x86_64=('67c78e162a1d984fd5ad8cbc81e8c96e5064707b29a4e6a68386a47e233fa041'
'002c2696d92b5c8cf956c11072baa58eaf9f6ade995c031ea635c6a1ee342ad1'
)
sha256sums_aarch64=('4c00f8d5395532eb76163968f0518905ff11ecc20c967b6ce514d12ea170bd3e'
'002c2696d92b5c8cf956c11072baa58eaf9f6ade995c031ea635c6a1ee342ad1'
)
_baseline=''
_baseline_sha256sums='022af62ed0dfe9d79060943906fc068faffd40fd69769f91bb9c603df33db11c'
if [[ $CARCH == 'x86_64' && $(cat /proc/cpuinfo | grep avx2) = '' ]]; then
_baseline='-baseline'
sha256sums_x86_64=${_baseline_sha256sums}
fi
source_x86_64=(
"bun-x64-${pkgver}.zip::https://github.com/oven-sh/bun/releases/download/bun-v${pkgver}/bun-linux-x64${_baseline}.zip"
"LICENSE"
)
source_aarch64=(
"bun-aarch64-${pkgver}.zip::https://github.com/oven-sh/bun/releases/download/bun-v${pkgver}/bun-linux-aarch64.zip"
"LICENSE"
)
build() {
if [ "${CARCH}" == "aarch64" ]; then
cd "bun-linux-aarch64"
else
cd "bun-linux-x64${_baseline}"
fi
install -dm755 "completions"
SHELL=zsh "./bun" completions >"completions/bun.zsh"
SHELL=bash "./bun" completions >"completions/bun.bash"
SHELL=fish "./bun" completions >"completions/bun.fish"
}
package() {
if [ "${CARCH}" == "aarch64" ]; then
cd "bun-linux-aarch64"
install -Dm755 "./bun" "${pkgdir}/usr/bin/bun"
else
cd "bun-linux-x64${_baseline}"
install -Dm755 "./bun" "${pkgdir}/usr/bin/bun"
fi
# simlink as bunx as in the official install.sh
ln -s bun "${pkgdir}/usr/bin/bunx"
install -Dm644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
install -Dm644 completions/bun.zsh "${pkgdir}/usr/share/zsh/site-functions/_bun"
install -Dm644 completions/bun.bash "${pkgdir}/usr/share/bash-completion/completions/bun"
install -Dm644 completions/bun.fish "${pkgdir}/usr/share/fish/vendor_completions.d/bun.fish"
}