tpm2-software / tpm2-tss-engine

OpenSSL Engine for TPM2 devices
https://tpm2-software.github.io
BSD 3-Clause "New" or "Revised" License
151 stars 100 forks source link

tarball: building without pandoc fails after `make clean; configure` #284

Open barsnick opened 2 months ago

barsnick commented 2 months ago

When using the source tarball, and building without pandoc, builds fail after make clean with a subsequent re-configure.

This is what happens when building multiple times in a Yocto workspace, e.g. using this recipe in the meta-security layer: https://git.yoctoproject.org/meta-security/tree/meta-tpm/recipes-tpm2/tpm2-tss-engine/tpm2-tss-engine_1.1.0.bb?h=kirkstone&id=353078bc06c8b471736daab6ed193e30d533d1f1

When re-using the workspace, Yocto will issue a make clean before running autoreconf, ./configure and compiling.

Since the tarball includes the pre-processed man pages under man/man{1,3}/, and make clean erases the man page files (but not the directory), the subsequent ./configure picks up HAVE_MAN_PAGES: https://github.com/tpm2-software/tpm2-tss-engine/blob/766505bf5c943c614fd246d27d1e5cd66543250b/configure.ac#L139 and tries to build them, even when pandoc is not available. This results in a build failure:

  GEN      man/man1/tpm2tss-genkey.1
/bin/sh: line 1: -s: command not found

from this Makefile line: https://github.com/tpm2-software/tpm2-tss-engine/blob/766505bf5c943c614fd246d27d1e5cd66543250b/Makefile.am#L205-L206

The question is whether the pre-processed man pages just should not be deleted if they cannot be built, or whether the HAVE_MAN_PAGES condition should be determined differently.

kalvdans commented 1 month ago

I suggest creating a make distclean target that removes everything not present in the git repo, and leaving make clean to not touch things in the tarball.

barsnick commented 1 month ago

I suggest creating a make distclean target that removes everything not present in the git repo, and leaving make clean to not touch things in the tarball.

Please feel free to do so, and take my change only as a suggestion. I needed to implement a minimal change that looked logically okay and fixed our Yocto (re-)builds.