summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ba449705b169e75d3d01ed56891b555716ac621b (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
# Maintainer: mrxx <mrxx at cyberhome dot at>

pkgname=speedtest++
_gitname=SpeedTest
pkgver=1.15.r72.b743996
pkgrel=1
pkgdesc="Unofficial speedtest.net cli using raw TCP for better accuracy. Written in C++."
arch=('any')
url="https://github.com/taganaka/SpeedTest"
license=('MIT')
depends=('curl' 'openssl' 'libxml2')
makedepends=('git' 'cmake')
source=("git+${url}.git")
md5sums=('SKIP')

pkgver() {
  cd "${_gitname}"
  local maj=$(grep -m 1 VERSION_MAJOR CMakeLists.txt |sed 's/[^0-9]*//g')
  local min=$(grep -m 1 VERSION_MINOR CMakeLists.txt |sed 's/[^0-9]*//g')
  printf "%s.%s.r%s.%s" $maj $min "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  mkdir -p build
  cd build
  cmake "$srcdir/${_gitname}" \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DCMAKE_BUILD_TYPE=Release
  make
}

package() {
  cd "$srcdir/build"
  make DESTDIR="$pkgdir" install
  ln -s "/usr/bin/SpeedTest" "$pkgdir/usr/bin/speedtest++"
  install -Dm644 "$srcdir/${_gitname}/README.md" "${pkgdir}/usr/share/doc/${_gitname}/README"
}