# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Ian Yang <doit.ian@gmail.com>

pkgname=google-glog
pkgver=0.7.0
pkgrel=1
pkgdesc="Logging library for C++"
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
license=('custom:BSD3')
url='https://github.com/google/glog'
depends=('gflags')
makedepends=('cmake')
source=("glog-$pkgver.tar.gz::https://github.com/google/glog/archive/v$pkgver.tar.gz")
sha512sums=('7222bb432c2b645238018233b2d18f254156617ef2921d18d17364866a7a3a05533fff1d63fd5033e1e5d3746a11806d007e7a36efaff667a0d3006dee45c278')

build() {
  case "${CARCH}" in
    powerpc|riscv64) _cmake_args+=(-DCMAKE_CXX_FLAGS="-latomic") ;;
  esac

  cmake -B build -S glog-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr ${_cmake_args[@]}
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build

  # Lazy way of dealing with conflicting man and info pages...
#  rm -rf "$pkgdir"/usr/share

  install -Dm644 glog-$pkgver/COPYING -t "$pkgdir"/usr/share/licenses/$pkgname
}
