# Maintainer (archarm): Kevin Mihelich <kevin@archlinuxarm.org
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>

buildarch=12

pkgname=vboot-utils
pkgver=r1908.4c84e0778
pkgrel=1
arch=('armv7h')
pkgdesc="Chromium OS vboot utilities"
url="https://chromium.googlesource.com/chromiumos/platform/vboot_reference/+/master"
license=('custom:chromiumos')
makedepends=('libyaml' 'git')
provides=('cgpt')
replaces=('cgpt')
_commit=4c84e077858c809ee80a9a6f9b38185cf7dcded7
source=("git+https://chromium.googlesource.com/chromiumos/platform/vboot_reference#commit=${_commit}"
        '0001-Remove-static-futility.patch')
md5sums=('SKIP'
         '4623286d277f73b0a5ae04c30174e520')

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

prepare() {
  cd vboot_reference
  git apply ../0001-Remove-static-futility.patch
  # remove -Werror to prevent build failure
  sed -i 's/-Werror//g' Makefile
}

build() {
  cd vboot_reference
  ARCH=arm make V=1
}

package() {
  cd vboot_reference
  make DESTDIR="${pkgdir}/usr" install
}
