summary refs log tree commit diff
diff options
context:
space:
mode:
authorStephen Barber <smbarber@chromium.org>2018-01-29 13:25:29 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-02-01 21:29:32 -0800
commit19e57b9532f9be830fab7fad685957afc8f5ab78 (patch)
tree96cf3a94168279b35ada162b49a08ce812bb7e90
parent6ecbbfd72312a07c1b9cd686aa2594f072448d40 (diff)
downloadcrosvm-19e57b9532f9be830fab7fad685957afc8f5ab78.tar
crosvm-19e57b9532f9be830fab7fad685957afc8f5ab78.tar.gz
crosvm-19e57b9532f9be830fab7fad685957afc8f5ab78.tar.bz2
crosvm-19e57b9532f9be830fab7fad685957afc8f5ab78.tar.lz
crosvm-19e57b9532f9be830fab7fad685957afc8f5ab78.tar.xz
crosvm-19e57b9532f9be830fab7fad685957afc8f5ab78.tar.zst
crosvm-19e57b9532f9be830fab7fad685957afc8f5ab78.zip
qcow_utils: add pkgconfig script
Add a pkgconfig file and script to fix it up at build time.

Also fix extern "C" for the qcow_utils header.

BUG=chromium:806119
TEST=emerge-eve-kvm crosvm

Change-Id: Ib69d9e88b42d2f2c8661798c37537a4236e0506e
Reviewed-on: https://chromium-review.googlesource.com/891572
Commit-Ready: Stephen Barber <smbarber@chromium.org>
Tested-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
-rw-r--r--qcow_utils/libqcow_utils.pc.in8
-rwxr-xr-xqcow_utils/platform2_preinstall.sh16
-rw-r--r--qcow_utils/src/qcow_utils.h8
3 files changed, 32 insertions, 0 deletions
diff --git a/qcow_utils/libqcow_utils.pc.in b/qcow_utils/libqcow_utils.pc.in
new file mode 100644
index 0000000..a5f0f5f
--- /dev/null
+++ b/qcow_utils/libqcow_utils.pc.in
@@ -0,0 +1,8 @@
+bslot=@BSLOT@
+include_dir=@INCLUDE_DIR@
+
+Name: libqcow_utils
+Description: QCOW2 shared library.
+Version: ${bslot}
+CFlags: -I${include_dir}
+Libs: -lqcow_utils
diff --git a/qcow_utils/platform2_preinstall.sh b/qcow_utils/platform2_preinstall.sh
new file mode 100755
index 0000000..5029010
--- /dev/null
+++ b/qcow_utils/platform2_preinstall.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# Copyright 2018 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 -e
+
+v=$1
+include_dir=$2
+target_dir=$3
+
+sed \
+  -e "s/@BSLOT@/${v}/g" \
+  -e "s:@INCLUDE_DIR@:${include_dir}:g" \
+  "qcow_utils/libqcow_utils.pc.in" > "${target_dir}/libqcow_utils.pc"
diff --git a/qcow_utils/src/qcow_utils.h b/qcow_utils/src/qcow_utils.h
index 1bddeec..e7db911 100644
--- a/qcow_utils/src/qcow_utils.h
+++ b/qcow_utils/src/qcow_utils.h
@@ -6,5 +6,13 @@
 
 // Exported interface to basic qcow functionality to be used from C.
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 // Create a basic, empty qcow2 file that can grow to `virtual_size` at `path`.
 int create_qcow_with_size(const char *path, uint64_t virtual_size);
+
+#ifdef __cplusplus
+};
+#endif