From 19e57b9532f9be830fab7fad685957afc8f5ab78 Mon Sep 17 00:00:00 2001 From: Stephen Barber Date: Mon, 29 Jan 2018 13:25:29 -0800 Subject: [PATCH] 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 Tested-by: Stephen Barber Reviewed-by: Dylan Reid Reviewed-by: Mike Frysinger --- qcow_utils/libqcow_utils.pc.in | 8 ++++++++ qcow_utils/platform2_preinstall.sh | 16 ++++++++++++++++ qcow_utils/src/qcow_utils.h | 8 ++++++++ 3 files changed, 32 insertions(+) create mode 100644 qcow_utils/libqcow_utils.pc.in create mode 100755 qcow_utils/platform2_preinstall.sh diff --git a/qcow_utils/libqcow_utils.pc.in b/qcow_utils/libqcow_utils.pc.in new file mode 100644 index 0000000000..a5f0f5fe6b --- /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 0000000000..5029010336 --- /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 1bddeec1d4..e7db91192a 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