85 lines
2.3 KiB
Bash
85 lines
2.3 KiB
Bash
# Maintainer: Vladislav Nepogodin <nepogodin.vlad@gmail.com>
|
|
|
|
pkgbase=chwd
|
|
pkgname=('chwd' 'chwd-db')
|
|
pkgver=1.2.1
|
|
pkgrel=2
|
|
pkgdesc="CachyOS Hardware Detection Tool"
|
|
arch=(x86_64)
|
|
url="https://github.com/cachyos/chwd"
|
|
license=(GPL3)
|
|
depends=('gcc-libs' 'pciutils' 'lua')
|
|
makedepends=('git' 'cargo' 'mold' 'clang' 'llvm')
|
|
groups=('cachyos')
|
|
_commit_hash=138bcc312764b53115acb18a3a7278e788310a3e
|
|
source=("git+${url}.git#commit=${_commit_hash}"
|
|
"git+${url/-cachyos}-db.git")
|
|
sha256sums=('SKIP'
|
|
'SKIP')
|
|
|
|
prepare() {
|
|
cd "$srcdir/$pkgname"
|
|
cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
|
|
|
|
cd scripts/chwd-kernel
|
|
cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
|
|
}
|
|
|
|
build() {
|
|
cd "$srcdir/$pkgname"
|
|
|
|
# Compile with clang
|
|
export AR=llvm-ar
|
|
export CC=clang
|
|
export CXX=clang++
|
|
export NM=llvm-nm
|
|
export RANLIB=llvm-ranlib
|
|
|
|
export RUSTFLAGS="-Cembed-bitcode -C opt-level=3 -Ccodegen-units=1 -Clinker=clang -C link-arg=-flto -Clink-arg=-fuse-ld=/usr/bin/mold"
|
|
|
|
cd scripts/chwd-kernel
|
|
cargo build --release --frozen
|
|
|
|
cd ../../
|
|
|
|
cargo build --release --frozen
|
|
}
|
|
|
|
package_chwd() {
|
|
depends=('gcc-libs' 'pciutils' 'lua' 'chwd-db' 'pacman')
|
|
provides=('mhwd-cachyos')
|
|
conflicts=('mhwd-cachyos')
|
|
replaces=('mhwd-cachyos')
|
|
|
|
cd "$srcdir/$pkgname"
|
|
|
|
install -Dm644 "LICENSE" "$pkgdir/usr/share/licenses/chwd/LICENSE"
|
|
|
|
install -Dm755 "target/release/chwd" "$pkgdir/usr/bin/chwd"
|
|
ln -s "/usr/bin/chwd" "$pkgdir/usr/bin/mhwd"
|
|
install -Dm755 scripts/chwd "$pkgdir"/var/lib/chwd/scripts/chwd
|
|
|
|
install -Dm644 target/release/build/chwd-*/out/chwd.bash "$pkgdir/usr/share/bash-completion/completions/chwd"
|
|
install -Dm644 target/release/build/chwd-*/out/chwd.fish "$pkgdir/usr/share/fish/vendor_completions.d/chwd.fish"
|
|
install -Dm644 target/release/build/chwd-*/out/_chwd "$pkgdir/usr/share/zsh/site-functions/_chwd"
|
|
|
|
install -d -m755 "$pkgdir"/var/lib/chwd/{db,local}/pci
|
|
|
|
cd scripts/chwd-kernel
|
|
install -Dm755 "target/release/chwd-kernel" "$pkgdir/usr/bin/chwd-kernel"
|
|
}
|
|
|
|
package_chwd-db() {
|
|
pkgdesc="Profiles we use at CachyOS :)"
|
|
provides=('mhwd-db-cachyos')
|
|
conflicts=('mhwd-db-cachyos')
|
|
replaces=('mhwd-db-cachyos')
|
|
|
|
cd $pkgname
|
|
|
|
mkdir -p "$pkgdir"/var/lib/chwd/db
|
|
cp -r pci "$pkgdir"/var/lib/chwd/db/
|
|
}
|
|
|
|
# vim:set sw=2 sts=2 et:
|