summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ac18a67c18dd29bcdcaeec918fc43a0a0a389c85 (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
# Maintainer: Chocobo1 <chocobo1 AT archlinux DOT net>
# Previous maintainer: Baptiste Jonglez <baptiste--aur at jonglez dot org>

pkgname=libubox
pkgver=r535.gb7acc8e
pkgrel=2
pkgdesc="C utility functions for OpenWrt"
arch=('i686' 'x86_64')
url="https://openwrt.org/docs/techref/libubox"
license=('ISC')
depends=('glibc' 'json-c')
makedepends=('git' 'cmake' 'lua51')
options=('staticlibs')
source=("git+https://git.openwrt.org/project/libubox.git")
sha256sums=('SKIP')


pkgver() {
  cd "libubox"

  _rev=$(git rev-list --count --all)
  _hash=$(git rev-parse --short HEAD)
  printf "r%s.g%s" "$_rev" "$_hash"
}

build() {
  cd "libubox"

  CFLAGS="$CFLAGS -ffat-lto-objects" \
  cmake \
    -B "_build" \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX="/usr" \
    -DCMAKE_INSTALL_LIBDIR="lib" \
    -DCMAKE_POLICY_VERSION_MINIMUM="3.5" \
    ./
  cmake --build "_build"
}

package() {
  cd "libubox"

  DESTDIR="$pkgdir" cmake --install "_build"

  if [ -d "$pkgdir/usr/local/lib" ]; then
    mv "$pkgdir"/usr/local/lib/* "$pkgdir/usr/lib"
    rm -r "$pkgdir/usr/local"
  fi
}