qtbase: fix pkgconfig files and enable debug variants

fixes #1316
This commit is contained in:
Tony Theodore 2016-07-17 00:29:41 +10:00
parent f88bbe7ffd
commit fef76ed094
2 changed files with 71 additions and 7 deletions

View File

@ -224,3 +224,68 @@ index bd6f2d8..4b63461 100644
--
2.7.4
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tony Theodore <tonyt@logyst.com>
Date: Sat, 16 Jul 2016 20:31:07 +1000
Subject: [PATCH] Fix pkgconfig file and library naming
See: https://codereview.qt-project.org/#/c/165394/
https://bugreports.qt.io/browse/QTBUG-30898
Currently, *.pc files are generated with debug suffix `d` in `-release`
mode and without the suffix in `-debug` or `-debug-and-release`. This
can be worked around by `CONIFG-=debug_and_release`, however, a more
predictable and consistent naming approach would be preferable.
This change mimics the *.prl file and lib conventions:
-release: creates normal *.pc files and lib names
-release -force-debug-info: normal as above
-debug: creates *d.pc and *d lib names
-debug-and-release: creates both
-default: creates both (default link: debug)
and should be unsurprising to users of `pkg-config`. At very least,
it's deterministic and easily incorporated into build systems.
Task-number: 30898
Change-Id: If75336ec7d21a7ec0cb6d245fe87c64afcb5a644
diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf
index 1111111..2222222 100644
--- a/mkspecs/features/qt_module.prf
+++ b/mkspecs/features/qt_module.prf
@@ -244,6 +244,10 @@ load(qt_installs)
load(qt_targets)
+# Set TARGET towards the end but before pkgconfig setup to keep naming
+# conventions consistent with *prl files
+TARGET = $$qt5LibraryTarget($$TARGET$$QT_LIBINFIX)
+
# this builds on top of qt_common
!internal_module:!lib_bundle:if(unix|mingw) {
CONFIG += create_pc
@@ -254,12 +258,12 @@ load(qt_targets)
QMAKE_PKGCONFIG_LIBDIR = $$[QT_INSTALL_LIBS/raw]
QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS/raw]
QMAKE_PKGCONFIG_CFLAGS = -I${includedir}/$$MODULE_INCNAME
- QMAKE_PKGCONFIG_NAME = $$replace(TARGET, ^Qt, "Qt$$QT_MAJOR_VERSION ")
- QMAKE_PKGCONFIG_FILE = $$replace(TARGET, ^Qt, Qt$$QT_MAJOR_VERSION)
+ QMAKE_PKGCONFIG_NAME = $$replace(TARGET, ^Qt$$QT_MAJOR_VERSION, "Qt$$QT_MAJOR_VERSION ")
+ QMAKE_PKGCONFIG_FILE = $$TARGET
for(i, MODULE_DEPENDS): \
- QMAKE_PKGCONFIG_REQUIRES += $$replace(QT.$${i}.name, ^Qt, Qt$$eval(QT.$${i}.MAJOR_VERSION))
+ QMAKE_PKGCONFIG_REQUIRES += $$replace(QT.$${i}.name, ^Qt, Qt$$eval(QT.$${i}.MAJOR_VERSION))$$qtPlatformTargetSuffix()
isEmpty(QMAKE_PKGCONFIG_DESCRIPTION): \
- QMAKE_PKGCONFIG_DESCRIPTION = $$replace(TARGET, ^Qt, "Qt ") module
+ QMAKE_PKGCONFIG_DESCRIPTION = $$replace(TARGET, ^Qt$$QT_MAJOR_VERSION, "Qt ") module
pclib_replace.match = $$lib_replace.match
!isEmpty(lib_replace.replace): \
pclib_replace.replace = $$QMAKE_PKGCONFIG_LIBDIR
@@ -293,5 +297,3 @@ win32 {
# On other platforms, Qt's own compilation goes needs to compile the Qt 5.0 API
DEFINES *= QT_DISABLE_DEPRECATED_BEFORE=0x050000
}
-
-TARGET = $$qt5LibraryTarget($$TARGET$$QT_LIBINFIX) # Do this towards the end

View File

@ -58,19 +58,18 @@ define $(PKG)_BUILD
-system-pcre \
-openssl-linked \
-dbus-linked \
-v
-v \
$($(PKG)_CONFIGURE_OPTS)
# invoke qmake with removed debug options as a workaround for
# https://bugreports.qt-project.org/browse/QTBUG-30898
$(MAKE) -C '$(1)' -j '$(JOBS)' QMAKE="$(1)/bin/qmake CONFIG-='debug debug_and_release'"
$(MAKE) -C '$(1)' -j '$(JOBS)'
rm -rf '$(PREFIX)/$(TARGET)/qt5'
$(MAKE) -C '$(1)' -j 1 install
ln -sf '$(PREFIX)/$(TARGET)/qt5/bin/qmake' '$(PREFIX)/bin/$(TARGET)'-qmake-qt5
mkdir '$(1)/test-qt'
cd '$(1)/test-qt' && '$(PREFIX)/$(TARGET)/qt5/bin/qmake' '$(PWD)/src/qt-test.pro'
$(MAKE) -C '$(1)/test-qt' -j '$(JOBS)'
$(INSTALL) -m755 '$(1)/test-qt/release/test-qt5.exe' '$(PREFIX)/$(TARGET)/bin/'
$(MAKE) -C '$(1)/test-qt' -j '$(JOBS)' $(BUILD_TYPE)
$(INSTALL) -m755 '$(1)/test-qt/$(BUILD_TYPE)/test-qt5.exe' '$(PREFIX)/$(TARGET)/bin/'
# build test the manual way
mkdir '$(1)/test-$(PKG)-pkgconfig'
@ -87,7 +86,7 @@ define $(PKG)_BUILD
'$(1)/test-$(PKG)-pkgconfig/qrc_qt-test.cpp' \
-o '$(PREFIX)/$(TARGET)/bin/test-$(PKG)-pkgconfig.exe' \
-I'$(1)/test-$(PKG)-pkgconfig' \
`'$(TARGET)-pkg-config' Qt5Widgets --cflags --libs`
`'$(TARGET)-pkg-config' Qt5Widgets$(BUILD_TYPE_SUFFIX) --cflags --libs`
# setup cmake toolchain
echo 'set(CMAKE_SYSTEM_PREFIX_PATH "$(PREFIX)/$(TARGET)/qt5" ${CMAKE_SYSTEM_PREFIX_PATH})' > '$(CMAKE_TOOLCHAIN_DIR)/$(PKG).cmake'