File PKGBUILD of Package cosmic-panel-git

# Maintainer: Mark Wagie <mark dot wagie at proton dot me>
pkgname=cosmic-panel-git
pkgver=1.0.0.alpha.7.r21.g1985e80
pkgrel=1
pkgdesc="XDG Shell Wrapper Panel for COSMIC"
arch=('x86_64' 'aarch64')
url="https://github.com/pop-os/cosmic-panel"
license=('GPL-3.0-only')
depends=(
  'libxkbcommon'
  'wayland'
)
makedepends=(
  'cargo'
  'git'
  'just'
  'mold'
)
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
source=('git+https://github.com/pop-os/cosmic-panel.git')
sha256sums=('SKIP')

pkgver() {
  cd "${pkgname%-git}"
  git describe --long --tags --abbrev=7 | sed 's/^epoch-//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  cd "${pkgname%-git}"
  mkdir -p .cargo; cat ../vendor.toml >> .cargo/config.toml
  export RUSTUP_TOOLCHAIN=stable
  cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
  cd "${pkgname%-git}"
  export RUSTUP_TOOLCHAIN=stable

  # use mold instead of lld to speed up build
  RUSTFLAGS+=" -C link-arg=-fuse-ld=mold"

  # use nice to build with lower priority
  nice just build-release --frozen
}

package() {
  cd "${pkgname%-git}"
  just rootdir="$pkgdir" install
}
source=($(printf "%s\n" "${source[@]}" | sed -E "s|git\+https://github.com/pop-os/([^/]+).git|\1.tar|g"))
source=(${source[@]}
        'vendor.toml'
        'vendor.tar.xz')
sha256sums=(${sha256sums[@]}
            'fbb3c7de904315a11afc4ba20f99f8465bdbc79f9dbd5ca0f004236bf8478890'
            'ea1b7fa418256303fd3efc528f0816c0eb83b91532c6fcb499e3fd862ba7aa3e')
openSUSE Build Service is sponsored by