summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9c360dda2adc9065a8cac99d01234ad921a2d494 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Maintainer: Mark Wagie <mark dot wagie at proton dot me>
pkgname=r-quick-share
_pkgname=rquickshare
pkgver=0.11.4
pkgrel=1
pkgdesc="Rust implementation of NearbyShare/QuickShare from Android for Linux."
arch=('x86_64')
url="https://github.com/Martichou/rquickshare"
license=('GPL-3.0-or-later')
depends=(
  'gtk3'
  'libayatana-appindicator'
  'webkit2gtk-4.1'
)
makedepends=(
  'cargo'
  'pnpm'
  'protobuf'
)
source=("${_pkgname}-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz")
sha256sums=('fcd4a4fe4080bfbf21cbaac4b9fc4eca07cb0cf7e6cd08daf06a81cabc5a0e57')

prepare() {
  cd "${_pkgname}-$pkgver"
  export PNPM_HOME="$srcdir/pnpm-home"
  export RUSTUP_TOOLCHAIN=stable

  pushd core_lib
  cargo fetch --target "$(rustc -vV | sed -n 's/host: //p')"
  popd

  pushd app/main/src-tauri
  cargo fetch --target "$(rustc -vV | sed -n 's/host: //p')"

  # Don't bundle AppImage
  sed -i 's/"targets": "all"/"targets": "deb"/g' tauri.conf.json
  popd

  pushd app/main
  pnpm install
  popd
}

build() {
  cd "${_pkgname}-$pkgver"
  export PNPM_HOME="$srcdir/pnpm-home"
  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target

  pnpm store prune

  pushd app/main
  pnpm build
  popd
}

check() {
  cd "${_pkgname}-$pkgver"
  export PNPM_HOME="$srcdir/pnpm-home"
  export RUSTUP_TOOLCHAIN=stable

  pushd core_lib
#  cargo test --all-features
  popd

  pushd app/main
#  pnpm check
  popd
}

package() {
  cd "${_pkgname}-$pkgver/app/main/src-tauri"
  install -Dm755 "target/release/${_pkgname}" -t "$pkgdir/usr/bin/"

  for i in 32x32 128x128 128x128@2x; do
    install -Dm644 icons/${i}.png \
      "$pkgdir/usr/share/icons/hicolor/${i}/apps/${_pkgname}.png"
  done
  install -Dm644 icons/icon.png \
    "$pkgdir/usr/share/icons/hicolor/512x512/apps/${_pkgname}.png"

  install -Dm644 "target/release/bundle/deb/RQuickShare_${pkgver}_amd64/data/usr/share/applications/RQuickShare.desktop" -t \
    "$pkgdir/usr/share/applications/"
}