summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0b58a35d601d6001c56a465ce6a177e970d48336 (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
# Maintainer: Jonas Hvid <mail@johv.dk>
pkgname=muwrap-git
pkgver=r21.414e7e9
pkgrel=2
pkgdesc="Text word wrapping utility for the command line"
arch=('x86_64')
url="https://github.com/c2d7fa/muwrap"
license=('MIT')
depends=('glibc')
makedepends=('git' 'nim' 'grep' 'findutils' 'patchelf')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
source=('muwrap::git+https://github.com/c2d7fa/muwrap.git')
md5sums=('SKIP')

pkgver() {
  cd "$srcdir/${pkgname%-git}"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  cd "$srcdir/${pkgname%-git}"
  nim compile -d:release --opt:size --passL:-s main.nim
  # Remove unused dynamically libraries added by Nim:
  ldd -u main | grep -Po '/usr/lib/\K\S+' | xargs -I% patchelf --remove-needed % main
}

check() {
  cd "$srcdir/${pkgname%-git}"
  nim compile --run test.nim
}

package() {
  cd "$srcdir/${pkgname%-git}"
  mkdir -p "$pkgdir/usr/bin"
  cp main "$pkgdir/usr/bin/muwrap"
  mkdir -p "$pkgdir/usr/share/licenses/$pkgname"
  cp LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}