crosvm/rutabaga_gfx/ffi/build.sh
Gurchetan Singh 075c7bf647 rutabaga_gfx/ffi: fix meson build
The library installed by Meson actually contains no symbols right now.
We have to:

1) Have Cargo place the libraries in the Meson build dir
2) Move the libraries from ${MESON_BUILD_DIR}/debug (where Cargo
   places them) to ${MESON_BUILD_DIR} sp Meson custom target script
   can reference them
3) Have meson install the libraries and generate pkg-config

BUG=b:344998548
TEST=link against FFI via gfxstream guest

Change-Id: I6536674fdb6ee3493433bf48ed233d6ca947e9aa
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5631146
Reviewed-by: Kaiyi Li <kaiyili@google.com>
Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2024-06-18 19:17:20 +00:00

31 lines
868 B
Bash

#!/bin/bash
# Copyright 2024 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
FEATURES="$1"
TARGET_DIR="$2"
SHARED_LIB="$3"
VERSION="$4"
BUILDTYPE="$5"
CARGO_RELEASE="$6"
SHARED_LIB_FULL="$SHARED_LIB"".$VERSION"
SHARED_LIB_MAJOR="$SHARED_LIB"".0"
# The following returns true if $CARGO_RELASE is the empty string
if [[ -z "$CARGO_RELEASE" ]]
then
CARGO_TARGET_DIR="$TARGET_DIR" cargo build --features="$FEATURES" --target-dir="$TARGET_DIR"
else
CARGO_TARGET_DIR="$TARGET_DIR" cargo build --features="$FEATURES" --target-dir="$TARGET_DIR" --release
fi
rm "$SHARED_LIB" 2>/dev/null
rm "$SHARED_LIB_FULL" 2>/dev/null
rm "$SHARED_LIB_MAJOR" 2>/dev/null
cp "$BUILDTYPE"/"$SHARED_LIB" "$SHARED_LIB_FULL"
ln -s "$SHARED_LIB_FULL" "$SHARED_LIB"
ln -s "$SHARED_LIB_FULL" "$SHARED_LIB_MAJOR"