summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a83a5d11dbdb06ebf8cb968b3f7aa5dd4a45d4d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Maintainer: Shorin <2433516202@qq.com>
_pkgname=cliphist-tui
_oldpkgname=shorinclip
pkgname=cliphist-tui-git
pkgver=r49.g745410d
pkgrel=3
pkgdesc="A wayland clipboard TUI based on fzf and cliphist. Use chafa for image preview."
arch=('x86_64')
url="https://github.com/SHORiN-KiWATA/cliphist-tui"
license=('MIT')

depends=(
    'fzf' 'cliphist' 'wl-clipboard' 'ffmpegthumbnailer' 'chafa' 'bash'
    'curl' 'file' 'glib2' 'xdg-utils' 'libnotify'  
)

makedepends=('git' 'cargo')   

provides=("$_pkgname" "$_oldpkgname" "${_oldpkgname}-git") 
conflicts=("$_pkgname" "$_oldpkgname" "${_oldpkgname}-git") 
replaces=("$_oldpkgname" "${_oldpkgname}-git")

source=("$_pkgname::git+${url}.git")
sha256sums=('SKIP')

pkgver() {
    cd "$_pkgname"
    printf "r%s.g%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
    cd "$_pkgname"
    export RUSTUP_TOOLCHAIN=stable
    cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
    cd "$_pkgname"
    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target
    # 编译 Release 版本
    cargo build --frozen --release --all-features
}

package() {
    cd "$_pkgname"
    
    # 1. 安装编译好的 Rust 二进制文件 (路径变为了 target/release/xxx)
    install -Dm755 "target/release/$_pkgname" "$pkgdir/usr/bin/$_pkgname"
    
    # 2. 建立向后兼容的软链接
    ln -sf "/usr/bin/$_pkgname" "$pkgdir/usr/bin/$_oldpkgname"
}