diff options
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 145 |
1 files changed, 122 insertions, 23 deletions
@@ -1,39 +1,138 @@ -# Maintainer: Sefa Eyeoglu <contact@scrumplex.net> +# Maintainer: Carl Smedstad <carl.smedstad at protonmail dot com> +# Contributor: Sefa Eyeoglu <contact@scrumplex.net> -_pkgver=2.1.6-beta -pkgname=espanso -pkgver=2.1.6 -pkgrel=1 +pkgbase=espanso +pkgname=( + espanso-x11 + espanso-wayland +) +pkgver=2.2.1 +pkgrel=4 pkgdesc="Cross-platform Text Expander written in Rust" arch=(x86_64) -url="https://espanso.org/" -license=("GPL3") -depends=("xdotool" "xclip" "libxtst" "libnotify" "wxgtk2") -makedepends=("rust" "git" "cmake" "cargo-make" "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') +url="https://github.com/espanso/espanso" +license=(GPL-3.0-only) +makedepends=( + bzip2 + cargo + dbus + gcc-libs + glibc + libx11 + libxcb + libxkbcommon + libxtst + openssl + wl-clipboard + wxwidgets-common + wxwidgets-gtk3 + xclip + xdotool +) +source=("$pkgbase-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz") +sha256sums=('795663cb64c28322b667998f95910134b042be2baaace5506790f7e44ae3be91') +options=(!lto) + +_archive="$pkgbase-$pkgver" prepare() { - cd "espanso" + 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 - # don't change the original service file, as it will be embedded in the binary - cp "espanso/src/res/linux/systemd.service" "systemd.service" - sed -i "s|{{{espanso_path}}}|/usr/bin/espanso|g" "systemd.service" + # Icon name + sed 's/Icon=icon/Icon=espanso/g' espanso/src/res/linux/espanso.desktop \ + > espanso.desktop } build() { - cd "espanso" + cd "$_archive" + + export RUSTUP_TOOLCHAIN=stable + + export CARGO_TARGET_DIR=target-x11 + cargo build --frozen --release \ + --manifest-path espanso/Cargo.toml \ + --package espanso + + export CARGO_TARGET_DIR=target-wayland + 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_espanso-x11() { + pkgdesc+=" (built for X11)" + depends=( + bzip2 + dbus + gcc-libs + glibc + libx11 + libxcb + libxkbcommon + libxtst + openssl + wxwidgets-common + wxwidgets-gtk3 + xclip + xdotool + ) + provides=(espanso) + conflicts=(espanso) + replaces=(espanso) + + cd "$_archive" - cargo make --profile release build-binary + install -Dm755 -t "$pkgdir/usr/bin" target-x11/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" } -package() { - cd "espanso" +package_espanso-wayland() { + pkgdesc="$pkgdesc (built for Wayland)" + depends=( + bzip2 + dbus + gcc-libs + glibc + libxkbcommon + openssl + wl-clipboard + wxwidgets-common + wxwidgets-gtk3 + ) + provides=(espanso) + conflicts=(espanso) + install=espanso-wayland.install - install -Dm755 "target/release/espanso" "${pkgdir}/usr/bin/espanso" - install -Dm644 "systemd.service" "${pkgdir}/usr/lib/systemd/user/espanso.service" + cd "$_archive" - install -Dm644 "README.md" "${pkgdir}/usr/share/doc/espanso/README.md" + install -Dm755 -t "$pkgdir/usr/bin" target-wayland/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" } |