mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2026-11-25 13:11:36 +00:00
- Install to a prefix, relocate it and build a minimal consumer that uses find_package(FairMQ) and FairMQ::FairMQ - Fail if documented package variables are missing or if installed files still refer to the original prefix Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
62 lines
2.4 KiB
Bash
Executable File
62 lines
2.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
################################################################################
|
|
# Copyright (C) 2026 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
|
|
# #
|
|
# This software is distributed under the terms of the #
|
|
# GNU Lesser General Public Licence (LGPL) version 3, #
|
|
# copied verbatim in the file "LICENSE" #
|
|
################################################################################
|
|
|
|
# Checks an installed FairMQ:
|
|
# 1. install to a temporary prefix that differs from CMAKE_INSTALL_PREFIX
|
|
# 2. check that no installed file refers to the configure-time prefix
|
|
# (scripts must be configured for the prefix given at install time)
|
|
# 3. move the installation to a second prefix and build and run a small
|
|
# downstream project against it (the CMake package must be relocatable)
|
|
#
|
|
# Usage: check-install.sh <fairmq-build-dir> [extra cmake configure args...]
|
|
#
|
|
# Dependencies of FairMQ (FairLogger, Boost, ...) must be found via the
|
|
# environment variable CMAKE_PREFIX_PATH or extra cmake args. If the FairMQ
|
|
# build used the bundled FairCMakeModules, the consumer uses it too.
|
|
|
|
set -euo pipefail
|
|
|
|
if [ $# -lt 1 ]; then
|
|
echo "Usage: $0 <fairmq-build-dir> [extra cmake configure args...]" >&2
|
|
exit 2
|
|
fi
|
|
|
|
here=$(cd "$(dirname "$0")" && pwd)
|
|
build=$(cd "$1" && pwd)
|
|
shift
|
|
|
|
work=$(mktemp -d)
|
|
trap 'rm -rf "$work"' EXIT
|
|
first="$work/prefix-one"
|
|
second="$work/prefix-two"
|
|
|
|
echo "--- install to $first"
|
|
cmake --install "$build" --prefix "$first" > "$work/install.log"
|
|
|
|
echo "--- check for references to the configure-time prefix"
|
|
configured=$(sed -n 's/^CMAKE_INSTALL_PREFIX:PATH=//p' "$build/CMakeCache.txt")
|
|
if [ -n "$configured" ] && [ "$configured" != "$first" ] && grep -rIl -F "$configured/" "$first"; then
|
|
echo "ERROR: installed files above refer to the configure-time prefix $configured" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "--- relocate to $second"
|
|
mv "$first" "$second"
|
|
|
|
echo "--- build downstream project"
|
|
prefixes="$second"
|
|
if [ -d "$build/extern/FairCMakeModules_install" ]; then
|
|
prefixes="$prefixes;$build/extern/FairCMakeModules_install"
|
|
fi
|
|
cmake -S "$here" -B "$work/consumer" -DCMAKE_PREFIX_PATH="$prefixes" "$@"
|
|
cmake --build "$work/consumer"
|
|
LD_LIBRARY_PATH="$second/lib:$second/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" "$work/consumer/consumer"
|
|
echo "OK"
|