From d284d8b6dbdb8855e2e9aeb25af42dc689d9392e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Tue, 6 Apr 2021 08:14:42 +0700 Subject: [PATCH] build-helper/qmake: respect {C,CXX,LD}FLAGS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As of it's now, package built with build-helper/qmake natively won't pick our CFLAGS CXXFLAGS and LDFLAGS. The result could be seen in no debug symbol in djview. Furthermore, cross build won't pick our hardening flags. Let's force qmake pick our flags by using the same method as build-style/qmake. --- common/build-helper/qmake.sh | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/common/build-helper/qmake.sh b/common/build-helper/qmake.sh index 9603cf5baae..d2a38703b30 100644 --- a/common/build-helper/qmake.sh +++ b/common/build-helper/qmake.sh @@ -65,14 +65,36 @@ _EOF # create the qmake-wrapper here because it only # makes sense together with the qmake build-helper # and not to interfere with e.g. the qmake build-style + # + # XXX: Intentionally quote {C,CXX,LD}FLAGS here but not in native. + # - Cross Build: + # + base flags will be picked up from QMAKE_{C,CXX,LD}FLAGS + # + hardening flags will be picked up from environment variables + # - Native Build: + # + hardening flags will be picked up first (Makefile, qt.conf?) + # + base flags will be picked up from QMAKE_{C,CXX,LD}FLAGS + # Maybe there're better workaround, I don't know. cat > "${XBPS_WRAPPERDIR}/qmake" <<_EOF #!/bin/sh -exec /usr/lib/qt5/bin/qmake "\$@" -qtconf "${XBPS_WRAPPERDIR}/qt.conf" +exec /usr/lib/qt5/bin/qmake "\$@" -qtconf "${XBPS_WRAPPERDIR}/qt.conf" \\ + QMAKE_CFLAGS+="\${CFLAGS}" \\ + QMAKE_CXXFLAGS+="\${CXXFLAGS}" \\ + QMAKE_LFLAGS+="\${LDFLAGS}" _EOF else cat > "${XBPS_WRAPPERDIR}/qmake" <<_EOF #!/bin/sh -exec /usr/lib/qt5/bin/qmake "\$@" CONFIG+=no_qt_rpath +exec /usr/lib/qt5/bin/qmake \ + "\$@" \ + 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}" \ + CONFIG+=no_qt_rpath _EOF fi chmod 755 ${XBPS_WRAPPERDIR}/qmake