summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: aac01c993205cd2d4b0346915cd300f66a43e32c (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Maintainer: Eric Woudstra <ericwouds@gmail.com>

_gitname=vboot_reference
_gitroot="https://chromium.googlesource.com/chromiumos/platform/${_gitname}"
_gitbranch="main"
pkgname=("chromeos-vboot-reference-git" "chromeos-vboot-reference-crossystem-git") 
url="https://chromium.googlesource.com/chromiumos/platform/${_gitname}"
license=('GPL')
makedepends=('git' 'libyaml' 'chromeos-flashrom-git' 'python-sphinx')
arch=('aarch64' 'armv6h' 'armv7h' 'i686' 'x86_64')
pkgver=r20221126105520.e952b90
pkgrel=3

pkgver() {
  cd "${srcdir}/${_gitname}"
  (
    set -o pipefail
    git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "r%s.%s" "$(git show -s --format=%cd --date=format:%Y%m%d%H%M%S HEAD)" "$(git rev-parse --short HEAD)"
  )
}

prepare() {
  if [[ -d "${srcdir}/${_gitname}/" ]]; then
    cd "${srcdir}/${_gitname}/"
    git reset --hard
    git pull --depth=1 origin "${_gitbranch}:${_gitbranch}"
    git checkout "${_gitbranch}"
    echo
  else
    cd "${srcdir}/"
    git clone --branch "${_gitbranch}" --depth=1 "${_gitroot}" "${srcdir}/${_gitname}/"
    echo
  fi
}

build() {
  cd "${srcdir}/${_gitname}"
  sed -i 's/TEST_NAMES += ${TLCL_TEST_NAMES}/TEST_NAMES =/' ./Makefile
  export CFLAGS+=" -Wno-error=deprecated-declarations"  # Skip deprecated: Since OpenSSL 3.0
  # install_for_test also builds crossystem
  make TEST_INSTALL_DIR=../build install_for_test
}

package_chromeos-vboot-reference-git() {
  pkgdesc="ChromeOS vbutil tools: futility (vbutil_kernel) cgpt from git."
  depends=('libutil-linux' 'openssl')
  conflicts=("vboot-utils")
  provides=("vboot-utils")

  cd "${srcdir}/build"
  install -m755 -vDt $pkgdir/usr/bin usr/bin/cgpt
  install -m755 -vDt $pkgdir/usr/bin usr/bin/futility
  find etc -type f -exec install -vDm 755 "{}" "${pkgdir}/{}" \;
  cd "${srcdir}/${_gitname}/tests/"
  find devkeys -maxdepth 1 -type f -exec install -vDm 755 "{}" "${pkgdir}/usr/share/vboot/{}" \;
}

package_chromeos-vboot-reference-crossystem-git() {
  pkgdesc="ChromeOS vbutil tools: crossystem from git, in experimental phase."
  depends=('libutil-linux' 'openssl' 'chromeos-flashrom-git' 'chromeos-acpi-dkms-git')

  cd "${srcdir}/build"
  install -m755 -vDt $pkgdir/usr/bin usr/bin/crossystem
}