summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3e2e73edf50e40e7dec83cc9cea0b9f74e00c2f3 (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
# Maintainer: Carl Smedstad <carsme@archlinux.org>

pkgname=srgn
pkgver=0.13.4
pkgrel=1
pkgdesc="A code surgeon for precise text and code transplantation"
url="https://github.com/alexpovel/srgn"
arch=(x86_64)
license=('MIT OR Apache-2.0')
depends=(
  gcc-libs
  glibc
)
makedepends=(cargo)
options=(!lto)
source=("$pkgname-$pkgver.tar.gz::$url/archive/srgn-v$pkgver.tar.gz")
sha256sums=('778766769b9c7845b6f24cb25c940f675c8634b3ba58bf1c552c717a12fe0ead')

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

build() {
  cd $pkgname-srgn-v$pkgver
  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target
  cargo build --frozen --release --all-features
}

check() {
  cd $pkgname-srgn-v$pkgver
  export RUSTUP_TOOLCHAIN=stable
  # Skip failing tests - unsure why they fail.
  cargo test --frozen --all-features -- \
    --skip tests::test_cli::case_13 \
    --skip tests::test_cli::case_14 \
    --skip tests::test_cli_failure_modes::case_08 \
    --skip tests::test_cli_failure_modes::case_15 \
    --skip tests::test_cli_failure_modes::case_19 \
    --skip tests::test_readme_code_blocks
}

package() {
  cd $pkgname-srgn-v$pkgver
  install -vDm755 -t "$pkgdir/usr/bin" target/release/srgn
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE-MIT
  install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" ./*.md
  cp -va -t "$pkgdir/usr/share/doc/$pkgname" docs

  ./target/release/srgn --completions bash \
    | install -vDm644 /dev/stdin "$pkgdir/usr/share/bash-completion/completions/srgn"
  ./target/release/srgn --completions fish \
    | install -vDm644 /dev/stdin "$pkgdir/usr/share/fish/vendor_completions.d/srg.fish"
  ./target/release/srgn --completions zsh \
    | install -vDm644 /dev/stdin "$pkgdir/usr/share/zsh/site-functions/_srgn"
}