summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f3fd4a49ffbadd1a8122f5d5bfeca2b58cf5373a (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
# Maintainer: Sefa Eyeoglu <contact@scrumplex.net>

_pkgver=2.1.8
pkgname=espanso
pkgver=2.1.8
pkgrel=1
pkgdesc="Cross-platform Text Expander written in Rust"
arch=(x86_64)
url="https://espanso.org/"
license=("GPL3")
depends=('dbus' 'libnotify' 'libxkbcommon' 'libxtst' 'wxwidgets-gtk3' 'xclip'
         'xdotool')
makedepends=('cargo' 'cargo-make' 'git' 'rust-script')
options=("!lto")  # fails with LTO as of 2022-03
source=("git+https://github.com/federico-terzi/espanso.git#tag=v${_pkgver}")
sha512sums=('SKIP')


prepare() {
  cd "${pkgname}"
  export CARGO_HOME="$srcdir/cargo-home"
  export RUSTUP_TOOLCHAIN=stable
  cargo fetch --target "$CARCH-unknown-linux-gnu"

  # don't change the original service file, as it will be embedded in the binary
  cp "${pkgname}/src/res/linux/systemd.service" "systemd.service"
  sed -i "s|{{{${pkgname}_path}}}|/usr/bin/${pkgname}|g" "systemd.service"

  # Icon name
  sed -i "s/Icon=icon/Icon=${pkgname}/g" "${pkgname}/src/res/linux/${pkgname}.desktop"
}

build() {
  cd "${pkgname}"
  export CARGO_HOME="$srcdir/cargo-home"
  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target
  cargo make --profile release build-binary
}

package() {
  cd "${pkgname}"
  install -Dm755 "target/release/${pkgname}" -t "${pkgdir}/usr/bin/"
  install -Dm644 systemd.service "${pkgdir}/usr/lib/systemd/user/${pkgname}.service"
  install -Dm644 "${pkgname}/src/res/linux/${pkgname}.desktop" -t \
    "${pkgdir}/usr/share/applications/"
  install -Dm644 "${pkgname}/src/res/linux/icon.png" \
    "$pkgdir/usr/share/pixmaps/${pkgname}.png"
  install -Dm644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}/"
}