makedepends=(cmocka doxygen libtpms json-c shadow)

description="Implementation of the TCG Trusted Platform Module 2.0 Software Stack (TSS2)"
url="https://github.com/tpm2-software/tpm2-tss"

packager="Great-OS Team"
maintainer="Great-OS Team"

name="tpm2-tss"
version="4.1.3"
release=1

source=(https://github.com/tpm2-software/tpm2-tss/releases/download/$version/tpm2-tss-$version.tar.gz
        https://raw.githubusercontent.com/tpm2-software/tpm2-tss/e237e4d33cbf280292a480edd8ad061dcd3a37a2/lib/tss2-tcti-libtpms.map)

prepare() {

  cd "$name-$version"

  cp "../tss2-tcti-libtpms.map" lib
}

build() {
  cd "$name-$version"

  ./configure --prefix=/usr \
              --sysconfdir=/etc \
              --localstatedir=/var \
              --with-runstatedir=/run \
              --with-sysusersdir=/usr/lib/sysusers.d \
              --with-tmpfilesdir=/usr/lib/tmpfiles.d \
              --with-udevrulesprefix=60- \
              --enable-unit $( ((CHECKFUNC)) && echo --enable-integration)

  make
  make DESTDIR="$PKG" install

  install -Dm644 LICENSE -t "$PKG/usr/share/licenses/$name-$version"
}
