summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6c63ba6589861206db633320a1cb58939a88adb4 (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
# Maintainer: Carl Smedstad <carl.smedstad at protonmail dot com>
# Contributor: Hauke Ingwersen <hauing@pm.me>
# Contributor: Sefa Eyeoglu <contact@scrumplex.net>

pkgname=espanso-wayland
_name=espanso
pkgver=2.2.1
pkgrel=3
pkgdesc="Cross-platform Text Expander written in Rust (built for Wayland)"
arch=(x86_64)
url="https://github.com/espanso/espanso"
license=(GPL-3.0-only)
depends=(
  bzip2
  dbus
  gcc-libs
  glibc
  libxkbcommon
  openssl
  wl-clipboard
  wxwidgets-common
  wxwidgets-gtk3
)
makedepends=(cargo)
provides=(espanso)
conflicts=(espenso)
options=(!lto)
install=espanso-wayland.install

source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
sha256sums=('795663cb64c28322b667998f95910134b042be2baaace5506790f7e44ae3be91')

_archive="$_name-$pkgver"

prepare() {
  cd "$_archive"

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

  # Don't change the original service file, as it will be embedded in the
  # binary
  sed 's|{{{espanso_path}}}|/usr/bin/espanso|g' espanso/src/res/linux/systemd.service \
    > espanso.service

  # Icon name
  sed 's/Icon=icon/Icon=espanso/g' espanso/src/res/linux/espanso.desktop \
    > espanso.desktop
}

build() {
  cd "$_archive"

  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target
  cargo build --frozen --release \
    --features wayland \
    --manifest-path espanso/Cargo.toml \
    --package espanso
}

check() {
  cd "$_archive"

  # Skip failing tests - unsure why they fail
  export RUSTUP_TOOLCHAIN=stable
  cargo test --frozen --all-features -- \
    --skip tests::ipc_multiple_clients \
    --skip tests::test_migration
}

package() {
  cd "$_archive"

  install -Dm755 -t "$pkgdir/usr/bin" target/release/espanso
  install -Dm644 -t "$pkgdir/usr/lib/systemd/user" espanso.service
  install -Dm644 -t "$pkgdir/usr/share/applications" espanso.desktop
  install -Dm644 -t "$pkgdir/usr/share/doc/espanso" ./*.md
  install -Dm644 espanso/src/res/linux/icon.png \
    "$pkgdir/usr/share/pixmaps/espanso.png"
}