From e19b55e9101b77146a9b71d3299097f6b23b0ea6 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Wed, 27 Sep 2023 17:04:45 +0200 Subject: ["CC/pkgconfig", "system_library"] Add -rpath When a shared library is picked up from the host system via pkg-config that is located at a non-standard location, binaries linked against this library by a standard linker either need LD_LIBRARY_PATH set appropriately, or -rpath set at link time. However, not all custom installations set -rpath in the link flags in their pkg-config file. Therefore, in order to get working binaries (and not have to set custom paths in tests), add a -rpath for every -L option found in the ldflags provided by pkg-config. --- CC/pkgconfig/add_rpath | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 CC/pkgconfig/add_rpath (limited to 'CC/pkgconfig/add_rpath') diff --git a/CC/pkgconfig/add_rpath b/CC/pkgconfig/add_rpath new file mode 100755 index 0000000..d020f2b --- /dev/null +++ b/CC/pkgconfig/add_rpath @@ -0,0 +1,24 @@ +#!/bin/sh +# Copyright 2023 Huawei Cloud Computing Technology Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +for x in "$@" +do + echo -n '' "$x" + case $x in + -L*) echo -n '' -Xlinker -rpath -Xlinker "$(expr "$x" : "..\(.*\)")" + ;; + esac +done +echo -- cgit v1.2.3