2015-08-20 21:29:37 +02:00
|
|
|
#
|
2022-09-18 13:33:35 +02:00
|
|
|
# This helper is for templates using Qt5/Qt6 qmake.
|
2015-08-20 21:29:37 +02:00
|
|
|
#
|
|
|
|
do_configure() {
|
2017-03-21 19:35:01 +01:00
|
|
|
local qmake
|
2019-07-02 00:52:53 +02:00
|
|
|
local qmake_args
|
2024-04-07 11:02:37 +02:00
|
|
|
local qt=${QT:-}
|
|
|
|
local builddir="${wrksrc}/${build_wrksrc}"
|
|
|
|
cd ${builddir}
|
|
|
|
if [ "${QT}" ]; then
|
|
|
|
qt=${QT}
|
|
|
|
if [ ! -x "/usr/lib/${qt}/bin/qmake" ]; then
|
|
|
|
msg_error "${QT} is requested, but not found\n"
|
|
|
|
fi
|
|
|
|
elif [ -x "/usr/lib/qt5/bin/qmake" ]; then
|
2023-02-20 00:06:51 +01:00
|
|
|
qt="qt5"
|
|
|
|
elif [ -x "/usr/lib/qt6/bin/qmake" ]; then
|
|
|
|
qt="qt6"
|
2024-04-07 11:02:37 +02:00
|
|
|
else
|
2021-01-12 20:04:49 +01:00
|
|
|
msg_error "${pkgver}: Could not find qmake - missing in hostmakedepends?\n"
|
2017-03-21 19:35:01 +01:00
|
|
|
fi
|
2024-04-07 11:02:37 +02:00
|
|
|
qmake="/usr/lib/${qt}/bin/qmake"
|
2023-02-20 00:06:51 +01:00
|
|
|
if [ "$CROSS_BUILD" ]; then
|
2019-11-11 20:22:43 +01:00
|
|
|
case $XBPS_TARGET_MACHINE in
|
|
|
|
i686*) _qt_arch=i386;;
|
|
|
|
x86_64*) _qt_arch=x86_64;;
|
|
|
|
aarch64*) _qt_arch=arm64;;
|
|
|
|
arm*) _qt_arch=arm;;
|
|
|
|
mips*) _qt_arch=mips;;
|
2020-12-15 21:42:22 +01:00
|
|
|
ppc64*) _qt_arch=power64;;
|
|
|
|
ppc*) _qt_arch=power;;
|
2019-11-11 20:22:43 +01:00
|
|
|
esac
|
2024-04-07 11:02:37 +02:00
|
|
|
mkdir -p "${builddir}/.target-spec/linux-g++"
|
|
|
|
cat > "${builddir}/.target-spec/linux-g++/qmake.conf" <<_EOF
|
2019-11-11 20:22:43 +01:00
|
|
|
MAKEFILE_GENERATOR = UNIX
|
2021-02-07 12:05:17 +01:00
|
|
|
CONFIG += incremental no_qt_rpath
|
2019-11-11 20:22:43 +01:00
|
|
|
QMAKE_INCREMENTAL_STYLE = sublib
|
|
|
|
|
2023-02-20 00:06:51 +01:00
|
|
|
include(/usr/lib/${qt}/mkspecs/common/linux.conf)
|
|
|
|
include(/usr/lib/${qt}/mkspecs/common/gcc-base-unix.conf)
|
|
|
|
include(/usr/lib/${qt}/mkspecs/common/g++-unix.conf)
|
2019-11-11 20:22:43 +01:00
|
|
|
|
2023-02-20 00:06:51 +01:00
|
|
|
QMAKE_TARGET_CONFIG = ${XBPS_CROSS_BASE}/usr/lib/${qt}/mkspecs/qconfig.pri
|
|
|
|
QMAKE_TARGET_MODULE = ${XBPS_CROSS_BASE}/usr/lib/${qt}/mkspecs/qmodule.pri
|
|
|
|
QMAKEMODULES = ${XBPS_CROSS_BASE}/usr/lib/${qt}/mkspecs/modules
|
2019-11-11 20:22:43 +01:00
|
|
|
QMAKE_CC = ${CC}
|
|
|
|
QMAKE_CXX = ${CXX}
|
|
|
|
QMAKE_LINK = ${CXX}
|
|
|
|
QMAKE_LINK_C = ${CC}
|
|
|
|
QMAKE_LINK_SHLIB = ${CXX}
|
|
|
|
|
|
|
|
QMAKE_AR = ${XBPS_CROSS_TRIPLET}-gcc-ar cqs
|
|
|
|
QMAKE_OBJCOPY = ${OBJCOPY}
|
|
|
|
QMAKE_NM = ${NM} -P
|
|
|
|
QMAKE_STRIP = ${STRIP}
|
|
|
|
|
|
|
|
QMAKE_CFLAGS = ${CFLAGS}
|
|
|
|
QMAKE_CXXFLAGS = ${CXXFLAGS}
|
|
|
|
QMAKE_LFLAGS = ${LDFLAGS}
|
|
|
|
load(qt_config)
|
|
|
|
_EOF
|
2024-04-07 11:02:37 +02:00
|
|
|
echo "#include \"${XBPS_CROSS_BASE}/usr/lib/${qt}/mkspecs/linux-g++/qplatformdefs.h\"" > "${builddir}/.target-spec/linux-g++/qplatformdefs.h"
|
2019-11-11 20:22:43 +01:00
|
|
|
|
2024-04-07 11:02:37 +02:00
|
|
|
mkdir -p "${builddir}/.host-spec/linux-g++"
|
|
|
|
cat > "${builddir}/.host-spec/linux-g++/qmake.conf" <<_EOF
|
2019-11-11 20:22:43 +01:00
|
|
|
MAKEFILE_GENERATOR = UNIX
|
2021-02-07 12:05:17 +01:00
|
|
|
CONFIG += incremental no_qt_rpath
|
2019-11-11 20:22:43 +01:00
|
|
|
QMAKE_INCREMENTAL_STYLE = sublib
|
|
|
|
|
2023-02-20 00:06:51 +01:00
|
|
|
include(/usr/lib/${qt}/mkspecs/common/linux.conf)
|
|
|
|
include(/usr/lib/${qt}/mkspecs/common/gcc-base-unix.conf)
|
|
|
|
include(/usr/lib/${qt}/mkspecs/common/g++-unix.conf)
|
2019-11-11 20:22:43 +01:00
|
|
|
|
2023-02-20 00:06:51 +01:00
|
|
|
QMAKE_TARGET_CONFIG = ${XBPS_CROSS_BASE}/usr/lib/${qt}/mkspecs/qconfig.pri
|
|
|
|
QMAKE_TARGET_MODULE = ${XBPS_CROSS_BASE}/usr/lib/${qt}/mkspecs/qmodule.pri
|
2019-11-11 20:22:43 +01:00
|
|
|
QMAKE_CC = ${CC_host}
|
|
|
|
QMAKE_CXX = ${CXX_host}
|
|
|
|
QMAKE_LINK = ${CXX_host}
|
|
|
|
QMAKE_LINK_C = ${CC_host}
|
|
|
|
QMAKE_LINK_SHLIB = ${CXX_host}
|
|
|
|
|
|
|
|
QMAKE_AR = gcc-ar cqs
|
|
|
|
QMAKE_OBJCOPY = ${OBJCOPY_host}
|
|
|
|
QMAKE_NM = ${NM_host} -P
|
|
|
|
QMAKE_STRIP = ${STRIP_host}
|
|
|
|
|
|
|
|
QMAKE_CFLAGS = ${CFLAGS_host}
|
|
|
|
QMAKE_CXXFLAGS = ${CXXFLAGS_host}
|
|
|
|
QMAKE_LFLAGS = ${LDFLAGS_host}
|
|
|
|
load(qt_config)
|
|
|
|
_EOF
|
2024-04-07 11:02:37 +02:00
|
|
|
echo '#include "/usr/lib/${qt}/mkspecs/linux-g++/qplatformdefs.h"' > "${builddir}/.host-spec/linux-g++/qplatformdefs.h"
|
|
|
|
cat > "${builddir}/qt.conf" <<_EOF
|
2019-07-02 00:52:53 +02:00
|
|
|
[Paths]
|
|
|
|
Sysroot=${XBPS_CROSS_BASE}
|
2019-11-11 20:22:43 +01:00
|
|
|
Prefix=/usr
|
2023-02-20 00:06:51 +01:00
|
|
|
ArchData=${XBPS_CROSS_BASE}/usr/lib/${qt}
|
|
|
|
Data=${XBPS_CROSS_BASE}/usr/share/${qt}
|
|
|
|
Documentation=${XBPS_CROSS_BASE}/usr/share/doc/${qt}
|
|
|
|
Headers=${XBPS_CROSS_BASE}/usr/include/${qt}
|
2019-07-02 00:52:53 +02:00
|
|
|
Libraries=${XBPS_CROSS_BASE}/usr/lib
|
2023-02-20 00:06:51 +01:00
|
|
|
LibraryExecutables=/usr/lib/${qt}/libexec
|
|
|
|
Binaries=/usr/lib/${qt}/bin
|
2019-07-02 00:52:53 +02:00
|
|
|
Tests=${XBPS_CROSS_BASE}/usr/tests
|
2023-02-20 00:06:51 +01:00
|
|
|
Plugins=/usr/lib/${qt}/plugins
|
|
|
|
Imports=${XBPS_CROSS_BASE}/usr/lib/${qt}/imports
|
|
|
|
Qml2Imports=${XBPS_CROSS_BASE}/usr/lib/${qt}/qml
|
|
|
|
Translations=${XBPS_CROSS_BASE}/usr/share/${qt}/translations
|
2019-07-02 00:52:53 +02:00
|
|
|
Settings=${XBPS_CROSS_BASE}/etc/xdg
|
2023-02-20 00:06:51 +01:00
|
|
|
Examples=${XBPS_CROSS_BASE}/usr/share/${qt}/examples
|
2019-07-02 00:52:53 +02:00
|
|
|
HostPrefix=/usr
|
2023-02-20 00:06:51 +01:00
|
|
|
HostData=/usr/lib/${qt}
|
|
|
|
HostBinaries=/usr/lib/${qt}/bin
|
2019-07-02 00:52:53 +02:00
|
|
|
HostLibraries=/usr/lib
|
2023-02-20 00:06:51 +01:00
|
|
|
HostLibraryExecutables=/usr/lib/${qt}/libexec
|
2024-04-07 11:02:37 +02:00
|
|
|
Spec=${builddir}/.host-spec/linux-g++
|
|
|
|
TargetSpec=${builddir}/.target-spec/linux-g++
|
2019-07-02 00:52:53 +02:00
|
|
|
_EOF
|
2024-04-07 11:02:37 +02:00
|
|
|
qmake_args="-qtconf ${builddir}/qt.conf PKG_CONFIG_EXECUTABLE=${XBPS_WRAPPERDIR}/${PKG_CONFIG}"
|
2019-11-11 20:22:43 +01:00
|
|
|
${qmake} ${qmake_args} \
|
|
|
|
PREFIX=/usr \
|
|
|
|
QT_INSTALL_PREFIX=/usr \
|
|
|
|
LIB=/usr/lib \
|
|
|
|
QT_TARGET_ARCH=$_qt_arch \
|
|
|
|
${configure_args}
|
|
|
|
else
|
|
|
|
${qmake} ${qmake_args} \
|
|
|
|
PREFIX=/usr \
|
|
|
|
QT_INSTALL_PREFIX=/usr \
|
|
|
|
LIB=/usr/lib \
|
|
|
|
QMAKE_CC=$CC QMAKE_CXX=$CXX \
|
|
|
|
QMAKE_LINK=$CXX QMAKE_LINK_C=$CC \
|
|
|
|
QMAKE_CFLAGS="${CFLAGS}" \
|
|
|
|
QMAKE_CXXFLAGS="${CXXFLAGS}" \
|
|
|
|
QMAKE_LFLAGS="${LDFLAGS}" \
|
2021-02-08 12:19:29 +01:00
|
|
|
CONFIG+=no_qt_rpath \
|
2019-11-11 20:22:43 +01:00
|
|
|
${configure_args}
|
2019-07-02 00:52:53 +02:00
|
|
|
fi
|
2015-08-20 21:29:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
do_build() {
|
2024-04-07 11:02:37 +02:00
|
|
|
cd "${wrksrc}/${build_wrksrc}"
|
2015-08-20 21:29:37 +02:00
|
|
|
: ${make_cmd:=make}
|
|
|
|
|
2016-10-05 14:03:16 +02:00
|
|
|
${make_cmd} ${makejobs} ${make_build_args} ${make_build_target} \
|
|
|
|
CC="$CC" CXX="$CXX" LINK="$CXX"
|
2015-08-20 21:29:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
do_install() {
|
2024-04-07 11:02:37 +02:00
|
|
|
cd "${wrksrc}/${build_wrksrc}"
|
2015-08-20 21:29:37 +02:00
|
|
|
: ${make_cmd:=make}
|
|
|
|
: ${make_install_target:=install}
|
|
|
|
|
|
|
|
${make_cmd} STRIP=true PREFIX=/usr DESTDIR=${DESTDIR} \
|
2015-08-22 19:32:38 +02:00
|
|
|
INSTALL_ROOT=${DESTDIR} ${make_install_args} ${make_install_target}
|
2015-08-20 21:29:37 +02:00
|
|
|
}
|