Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes related to QT5_GENTOO_CONFIG, QT_FEATURE_* macros, qconfig_p.h header #261

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

Arfrever
Copy link
Contributor

Fixes related to QT5_GENTOO_CONFIG, QT_FEATURE_* macros, qconfig_p.h header.

Problem was accidentally found during work on Qt 5.15.6 version bump (#260), but older versions are also affected.

In Qt 5.15.5:

$ grep -Er '(QT_CONFIG|QT_REQUIRE_CONFIG)\((dbus|dbus_linked)\)' *
src/gui/kernel/qguiapplication.cpp:#if QT_CONFIG(dbus)
src/gui/kernel/qguiapplication.cpp:#endif // QT_CONFIG(dbus)
src/platformsupport/services/genericunix/qgenericunixservices.cpp:#if QT_CONFIG(dbus)
src/platformsupport/services/genericunix/qgenericunixservices.cpp:#endif // QT_CONFIG(dbus)
src/platformsupport/services/genericunix/qgenericunixservices.cpp:#if QT_CONFIG(dbus)
src/platformsupport/services/genericunix/qgenericunixservices.cpp:#endif // QT_CONFIG(dbus)
src/platformsupport/services/genericunix/qgenericunixservices.cpp:#if QT_CONFIG(dbus)
src/platformsupport/services/genericunix/qgenericunixservices.cpp:#if QT_CONFIG(dbus)
src/platformsupport/services/genericunix/qgenericunixservices.cpp:#if QT_CONFIG(dbus)

Both src/gui and src/platformsupport are in QT5_TARGET_SUBDIRS in dev-qt/qtgui ebuilds.
Previously some D-Bus-dependent code was disabled even for dev-qt/qtgui[dbus].

src/platformsupport/services/genericunix/qgenericunixservices.cpp:

#if QT_CONFIG(dbus)
// These QtCore includes are needed for xdg-desktop-portal support
#include <QtCore/private/qcore_unix_p.h>

#include <QtCore/QFileInfo>
#include <QtCore/QUrlQuery>

#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusMessage>
#include <QtDBus/QDBusPendingCall>
#include <QtDBus/QDBusPendingCallWatcher>
#include <QtDBus/QDBusPendingReply>
#include <QtDBus/QDBusUnixFileDescriptor>

#include <fcntl.h>

#endif // QT_CONFIG(dbus)
...

Arfrever Frehtes Taifersar Arahesis added 12 commits September 16, 2022 00:00
…NFIG.

Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
…FIG.

Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
…ENTOO_CONFIG.

Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
…QT5_GENTOO_CONFIG.

Undocumented automatic uppercasing will be removed.

Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
This is consistent with dev-qt/qtdbus, dev-qt/qtgui, dev-qt/qtnetwork.

Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
…elements of QT5_GENTOO_CONFIG.

This will allow to support macros with lowercase letters such as QT_FEATURE_dbus.

Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
…RIVATE_CONFIG.

Remove automatic derivation of feature, macro components of elements of QT5_GENTOO_CONFIG.
Remove automatic derivation of feature component of elements of QT5_GENTOO_PRIVATE_CONFIG.

Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
QT_FEATURE_* macros should have values -1 or 1, and are used by QT_CONFIG and QT_REQUIRE_CONFIG macros:
(https://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/global/qglobal.h?h=5.15)
[[[
/*
    The QT_CONFIG macro implements a safe compile time check for features of Qt.
    Features can be in three states:
        0 or undefined: This will lead to a compile error when testing for it
        -1: The feature is not available
        1: The feature is available
*/
#define QT_CONFIG(feature) (1/QT_FEATURE_##feature == 1)
#define QT_REQUIRE_CONFIG(feature) Q_STATIC_ASSERT_X(QT_FEATURE_##feature == 1, "Required feature " #feature " for file " __FILE__ " not available.")
]]]

Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
This does not affect build of qtbase packages themselves, but will allow to fix value returned
by QT_CONFIG(dbus) and QT_CONFIG(dbus_linked) after installation.

Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
This does not affect build of qtbase packages themselves, but will allow to fix value returned
by QT_CONFIG(gui) after installation.

Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
This does not affect build of qtbase packages themselves, but will allow to fix value returned
by QT_CONFIG(widgets) after installation.

Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
… appropriate directory.

configure (in all qtbase packages) generates:
  ${QT5_BUILD_DIR}/src/corelib/global/qconfig.h
  ${QT5_BUILD_DIR}/src/corelib/global/qconfig_p.h
  ${QT5_BUILD_DIR}/src/corelib/global/qconfig.cpp

qt5_qmake in src/corelib directory (run only in dev-qt/qtcore) generates:
  ${QT5_BUILD_DIR}/include/QtCore/qconfig.h with content:
    #include "../../src/corelib/global/qconfig.h"
  ${QT5_BUILD_DIR}/include/QtCore/${Qt_Version}/QtCore/private/qconfig_p.h with content:
    #include "../../../../../src/corelib/global/qconfig_p.h"

qconfig.h and qconfig_p.h define various macros with values possibly dependent on flags passed to configure.
Many of these macros are QT_FEATURE_*, which are usually used through QT_CONFIG macro.

/usr/include/qt5/QtCore/${Qt_Version}/QtCore/private/qconfig_p.h installed by dev-qt/qtcore contains e.g.:
  #define QT_FEATURE_dbus -1
  #define QT_FEATURE_dbus_linked -1
  #define QT_FEATURE_gui -1
  #define QT_FEATURE_widgets -1

${QT5_BUILD_DIR}/src/corelib/global/qconfig_p.h generated by configure for dev-qt/qtgui[dbus]
contains desired values such as:
  #define QT_FEATURE_dbus 1
  #define QT_FEATURE_dbus_linked 1
  #define QT_FEATURE_gui 1
  #define QT_FEATURE_widgets -1

However this header is not used and '#include <QtCore/private/qconfig_p.h>' could not include it from this location.
Previously qtbase packages other than dev-qt/qtcore were using /usr/include/qt5/QtCore/${Qt_Version}/QtCore/private/qconfig_p.h
installed by dev-qt/qtcore.

qt5_base_configure() already copies ${QT5_BUILD_DIR}/src/corelib/global/qconfig.h to include/QtCore directory
to prevent using of /usr/include/qt5/QtCore/qconfig.h at build time.
qt5_base_configure() is hereby fixed to also copy ${QT5_BUILD_DIR}/src/corelib/global/qconfig_p.h to include/QtCore/private directory
to prevent using of /usr/include/qt5/QtCore/${Qt_Version}/QtCore/private/qconfig_p.h at build time.

Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
@thesamesam thesamesam requested review from a17r and Pesa September 17, 2022 03:08
@Arfrever Arfrever force-pushed the master branch 2 times, most recently from eb759b4 to 6a90fd7 Compare September 17, 2022 06:20
Comment on lines -801 to +805
local flag=${x%%:*}
x=${x#${flag}:}
local feature=${x%%:*}
x=${x#${feature}:}
local macro=${x}
macro=$(tr 'a-z-' 'A-Z_' <<< "${macro}")
IFS=: read -r flag feature macro <<<"${x}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break existing 5.15.5 ebuilds, right?

@a17r
Copy link
Member

a17r commented Sep 17, 2022

@a17r a17r mentioned this pull request Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants