File PKGBUILD of Package cosmic-comp-git

# Maintainer: soloturn <soloturn@gmail.com>
# Co-Maintainer: Mark Wagie <mark dot wagie at proton dot me>
pkgname=cosmic-comp-git
pkgver=1.0.0.beta.1.1.r32.g3465ce7
pkgrel=2
pkgdesc="Compositor for the COSMIC desktop environment"
arch=('x86_64' 'aarch64')
url="https://github.com/pop-os/cosmic-comp"
license=('GPL-3.0-only')
depends=(
  'fontconfig'
  'libdisplay-info'
  'libseat.so'
  'libinput'
  'libxcb'
  'libxkbcommon'
  'mesa'
  'pixman'
  'systemd'
  'wayland'
)
makedepends=(
  'cargo'
  'git'
  'mold'
)
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
source=('git+https://github.com/pop-os/cosmic-comp.git'
        'fix-wine-wayland-flickering.patch'
        'vendor.toml'
        'vendor.tar.xz'
        'update_to_libdisplay-info_3.patch')
sha256sums=('SKIP'
            '58a7d4b5c6c728428e0e6534e9c4f0de0ee6ddbd3c3073c4fce4850e30b09644'
            'c01e6417a480d892fdd74e9aa32dde42b9995d4f0a91a70587cc55f8eef572f2'
            '27046c87e225f3015870c0f0aaa1461dc634a4dcb0476f2ca49133962e80c72d'
            'a5ebecc919a1e0a60585a9f579aef39e35377d36c4585fd8a8c563d3c6d13cd0')

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

prepare() {
  cd "${pkgname%-git}"

  # https://github.com/pop-os/cosmic-comp/issues/1661
  # my workaround is revert b7fd4bc db9380e
  patch -Np1 -i ../fix-wine-wayland-flickering.patch

  # Update dependencies to libdisplay-info/libdisplay-info-sys to v0.3.0
  patch -Np1 -i "$srcdir/update_to_libdisplay-info_3.patch"

  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
  ARGS+=" --frozen" nice make
}

package() {
  cd "${pkgname%-git}"
  make DESTDIR="$pkgdir" install
}
openSUSE Build Service is sponsored by