[go: nahoru, domu]

pkg-config: Script to produce libtpm2.pc

Required in order for crosvm to find and use the correct libtpm2.a.

Based on a similar script in src/platform2/libtpmcrypto and Kokoro's
libtpm2.pc in src/platform/crosvm/kokoro/pkgconfig/libtpm2.pc.

BUG=chromium:911799
TEST=./thirdparty_preinstall.sh 9999 /tmp/pkgconfig; cat /tmp/pkgconfig/libtpm2.pc
TEST=(with CL:1515975) emerge-nami tpm2
TEST=(with CL:1515975) USE=crosvm-tpm emerge-nami crosvm

Change-Id: I574799c94ae488bbc54548a0abdd3ec23204fdac
Reviewed-on: https://chromium-review.googlesource.com/1516261
Commit-Ready: David Tolnay <dtolnay@chromium.org>
Tested-by: David Tolnay <dtolnay@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
diff --git a/libtpm2.pc.in b/libtpm2.pc.in
new file mode 100644
index 0000000..03671dc
--- /dev/null
+++ b/libtpm2.pc.in
@@ -0,0 +1,7 @@
+bslot=@BSLOT@
+
+Name: tpm2
+Description: TPM simulator extracted from the TCG TPM 2.0 library specification
+Version: ${bslot}
+Requires.private: libcrypto
+Libs: -ltpm2
diff --git a/thirdparty_preinstall.sh b/thirdparty_preinstall.sh
new file mode 100755
index 0000000..2dee1ff
--- /dev/null
+++ b/thirdparty_preinstall.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+set -ex
+
+v=$1
+out=$2
+
+mkdir -p "${out}"
+sed -e "s/@BSLOT@/${v}/g" libtpm2.pc.in > "${out}/libtpm2.pc"