summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 30f048f88f69b32cdd052c63bdf8a79d20a91bb0 (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
# Maintainer: atomicfs <https://aur.archlinux.org/account/atomicfs>

pkgname=mdbook-rss-git
_pkgname=mdbook-rss
pkgver=8.dc948c6
pkgrel=3
pkgdesc="A preprocessor for mdbook to generate an RSS feed from your chapters"
url="https://gitlab.com/albalitz/mdbook-rss"
arch=('x86_64')
license=('MPL-2.0')
makedepends=(
  'cargo'
  'git'
)
depends=(
  'mdbook'
)
source=(
  "git+${url}.git"
  'mdbook-rss.patch'
)
sha256sums=(
  'SKIP'
  'b644bfb8e6b1efb5f0f2bb314b629d7c2079503b2677a9130ee1a116134077a2'
)
provides=("${_pkgname}")
conflicts=("${_pkgname}")

# https://wiki.archlinux.org/index.php/VCS_package_guidelines#The_pkgver()_function
pkgver() {
  cd "${srcdir}/${_pkgname}"
  version=$(printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)")
  echo "${version:1}"
}

prepare() {
  cd "${srcdir}/${_pkgname}"
  export RUSTUP_TOOLCHAIN=stable
  cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
  patch --forward --strip=1 --input="${srcdir}/mdbook-rss.patch"
}

check() {
  cd "${srcdir}/${_pkgname}"
  export RUSTUP_TOOLCHAIN=stable
  #cargo test --frozen --all-features
  cargo test --all-features
}

build() {
  cd "${srcdir}/${_pkgname}"
  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target
  #cargo build --frozen --release --all-features
  cargo build --release --all-features
}

package() {
  cd "${srcdir}/${_pkgname}"
  install -Dm 755 "target/release/${_pkgname}" "${pkgdir}/usr/bin/${pkgname}"
}