From 45a4ac512d2f800c2bdb3260e0160dc6e2dd1ed2 Mon Sep 17 00:00:00 2001
From: Alexandre Janniaux <ajanni@videolabs.io>
Date: Thu, 1 Sep 2022 18:10:42 +0200
Subject: [PATCH] contrib: qt: add install_wrapper.sh

The script is used by enforcing it through the INSTALL_FILE= make
variable and override the copy of .pc files so as to fix the lib=
variable and ensure the .pc file is linked to $(PREFIX)/lib/pkgconfig/
unlike the installed Qt plugins and qml plugins.
---
 contrib/src/qt/install_wrapper.sh | 33 +++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100755 contrib/src/qt/install_wrapper.sh

diff --git a/contrib/src/qt/install_wrapper.sh b/contrib/src/qt/install_wrapper.sh
new file mode 100755
index 000000000000..2e506d9e4dd3
--- /dev/null
+++ b/contrib/src/qt/install_wrapper.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env sh
+# Copyright (C) 2022 Videolabs
+# This file is distributed under the same license as the vlc package.
+set -e
+
+SCRIPT_DIR="$(cd "$(dirname  "$0" )" && pwd -P)"
+SOURCE="$1"
+DEST="$2"
+
+install -m 644 -p $SOURCE $DEST
+
+# Filter pkg-config files only
+if [ "${SOURCE##*.}" != 'pc' ]; then
+    exit 0
+fi
+
+"${SCRIPT_DIR}/../pkg-static.sh" "${DEST}"
+
+# Filter pkg-config files that are not installed in the main pkg-config folder
+if [ "$(dirname $2)" -ef "${VLC_PREFIX}/lib/pkgconfig" ]; then
+    exit 0
+fi
+
+pkgconfigdir="$(cd "$(dirname "${DEST}")" && pwd -P)"
+
+# Filter packages installed in a pkgconfig/ folder
+if [ "$(basename "${pkgconfigdir}")" -eq "pkgconfig" ]; then
+    exit 0
+fi
+
+sed -i.orig "s,libdir=.*,libdir=${pkgconfigdir}," "${DEST}"
+mkdir -p "${VLC_PREFIX}/lib/pkgconfig"
+ln -sf "${DEST}" "${VLC_PREFIX}/lib/pkgconfig/"
-- 
GitLab