blob: 203ddf4203406ae057c3a0793c15e0fe1674c4fa [file] [log] [blame]
Patrick Georgi53ea1d42019-11-22 16:55:58 +01001#!/bin/sh
Martin Rothbe08c1d2024-02-16 09:12:33 -07002# SPDX-License-Identifier: GPL-2.0-only
Patrick Georgi53ea1d42019-11-22 16:55:58 +01003
Patrick Georgi7eab8ef2023-11-20 18:03:34 +01004cflags=$1
5libs=$2
6bin=$3
7
Patrick Georgi0eab62b2023-11-20 19:49:29 +01008PKG5="Qt5Core Qt5Gui Qt5Widgets"
9PKG6="Qt6Core Qt6Gui Qt6Widgets"
Patrick Georgi53ea1d42019-11-22 16:55:58 +010010
Patrick Georgi1215cc72022-10-28 01:00:26 +020011if [ -z "$(command -v ${HOSTPKG_CONFIG})" ]; then
Patrick Georgi53ea1d42019-11-22 16:55:58 +010012 echo >&2 "*"
Patrick Georgi1215cc72022-10-28 01:00:26 +020013 echo >&2 "* 'make xconfig' requires '${HOSTPKG_CONFIG}'. Please install it."
Patrick Georgi53ea1d42019-11-22 16:55:58 +010014 echo >&2 "*"
15 exit 1
16fi
17
Patrick Georgi0eab62b2023-11-20 19:49:29 +010018if ${HOSTPKG_CONFIG} --exists $PKG6; then
19 ${HOSTPKG_CONFIG} --cflags ${PKG6} > ${cflags}
20 # Qt6 requires C++17.
21 echo -std=c++17 >> ${cflags}
22 ${HOSTPKG_CONFIG} --libs ${PKG6} > ${libs}
23 ${HOSTPKG_CONFIG} --variable=libexecdir Qt6Core > ${bin}
24 exit 0
25fi
26
27if ${HOSTPKG_CONFIG} --exists $PKG5; then
28 ${HOSTPKG_CONFIG} --cflags ${PKG5} > ${cflags}
29 ${HOSTPKG_CONFIG} --libs ${PKG5} > ${libs}
Patrick Georgi7eab8ef2023-11-20 18:03:34 +010030 ${HOSTPKG_CONFIG} --variable=host_bins Qt5Core > ${bin}
Patrick Georgi53ea1d42019-11-22 16:55:58 +010031 exit 0
32fi
33
34echo >&2 "*"
Patrick Georgi0eab62b2023-11-20 19:49:29 +010035echo >&2 "* Could not find Qt6 or Qt5 via ${HOSTPKG_CONFIG}."
36echo >&2 "* Please install Qt6 or Qt5 and make sure it's in PKG_CONFIG_PATH"
37echo >&2 "* You need $PKG6 for Qt6"
38echo >&2 "* You need $PKG5 for Qt5"
Patrick Georgi53ea1d42019-11-22 16:55:58 +010039echo >&2 "*"
40exit 1