Skip to content

Commit

Permalink
qt6-x11
Browse files Browse the repository at this point in the history
  • Loading branch information
barracuda156 committed Aug 19, 2024
1 parent 2ba9137 commit 6d71196
Show file tree
Hide file tree
Showing 5 changed files with 177 additions and 0 deletions.
22 changes: 22 additions & 0 deletions aqua/qt6/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,28 @@ subport ${name}-qtbase {
-DOPENSSL_LIBRARIES=[openssl::install_area]/lib \
-DOPENSSL_LIBS='-L[openssl::install_area]/lib -lssl -lcrypto'
}

variant x11 {
patchfiles-append 0001-Allow-X11-only-build.patch \
0002-Unbreak-X11-GUI.patch \
0003-Fix-finding-OpenGL.patch \
0004-Fix-mkspec-for-Apple.patch

depends_lib-append port:libxkbcommon-x11 \
port:mesa \
port:xinput \
port:xorg-libxcb \
port:xorg-libXfixes \
port:xrender

configure.ldflags-prepend -L${prefix}/lib -lGL

configure.args-delete -no-fontconfig -no-xcb
configure.args-append -qpa xcb \
-fontconfig \
-xcb-xlib
}

default_variants-append +openssl

post-destroot {
Expand Down
33 changes: 33 additions & 0 deletions aqua/qt6/files/0001-Allow-X11-only-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
From bfaffa20800c7ef3c505f12c75c592e2f6ee9c33 Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <[email protected]>
Date: Mon, 19 Aug 2024 07:21:41 +0800
Subject: [PATCH] Allow X11-only build

diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index 3b3dbd1321..da615224b8 100644
--- src/gui/CMakeLists.txt
+++ src/gui/CMakeLists.txt
@@ -16,7 +16,7 @@
elseif(ANDROID)
set(_default_platform "android")
elseif(MACOS)
- set(_default_platform "cocoa")
+ set(_default_platform "xcb")
elseif(TVOS OR IOS)
set(_default_platform "ios")
elseif(WATCHOS)
@@ -735,12 +735,12 @@
WrapFreetype::WrapFreetype
)

-qt_internal_extend_target(Gui CONDITION QT_FEATURE_freetype AND UNIX AND NOT APPLE
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_freetype AND UNIX
SOURCES
text/unix/qgenericunixfontdatabase_p.h
)

-qt_internal_extend_target(Gui CONDITION QT_FEATURE_fontconfig AND QT_FEATURE_freetype AND UNIX AND NOT APPLE
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_fontconfig AND QT_FEATURE_freetype AND UNIX
SOURCES
text/unix/qfontconfigdatabase.cpp text/unix/qfontconfigdatabase_p.h
text/unix/qfontenginemultifontconfig.cpp text/unix/qfontenginemultifontconfig_p.h
49 changes: 49 additions & 0 deletions aqua/qt6/files/0002-Unbreak-X11-GUI.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
From f54fc8f9dc684ce044821f2bef59cfabbc588473 Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <[email protected]>
Date: Mon, 19 Aug 2024 09:09:23 +0800
Subject: [PATCH] Unbreak X11 GUI

--- src/gui/configure.cmake
+++ src/gui/configure.cmake
@@ -25,7 +25,7 @@


#### Libraries
-qt_set01(X11_SUPPORTED LINUX OR HPUX OR FREEBSD OR NETBSD OR OPENBSD OR SOLARIS OR HURD) # special case
+qt_set01(X11_SUPPORTED LINUX OR HPUX OR FREEBSD OR NETBSD OR OPENBSD OR SOLARIS OR HURD OR APPLE) # special case
qt_find_package(ATSPI2 PROVIDED_TARGETS PkgConfig::ATSPI2 MODULE_NAME gui QMAKE_LIB atspi)
qt_find_package(DirectFB PROVIDED_TARGETS PkgConfig::DirectFB MODULE_NAME gui QMAKE_LIB directfb)
qt_find_package(Libdrm PROVIDED_TARGETS Libdrm::Libdrm MODULE_NAME gui QMAKE_LIB drm)
@@ -660,7 +660,6 @@
)
qt_feature("fontconfig" PUBLIC PRIVATE
LABEL "Fontconfig"
- AUTODETECT NOT APPLE
CONDITION NOT WIN32 AND QT_FEATURE_system_freetype AND Fontconfig_FOUND
)
qt_feature_definition("fontconfig" "QT_NO_FONTCONFIG" NEGATE VALUE "1")
@@ -675,7 +674,7 @@
qt_feature_definition("harfbuzz" "QT_NO_HARFBUZZ" NEGATE VALUE "1")
qt_feature("system-harfbuzz" PRIVATE
LABEL " Using system HarfBuzz"
- AUTODETECT NOT APPLE AND NOT WIN32
+ AUTODETECT NOT WIN32
CONDITION QT_FEATURE_harfbuzz AND WrapSystemHarfbuzz_FOUND
ENABLE INPUT_harfbuzz STREQUAL 'system'
DISABLE INPUT_harfbuzz STREQUAL 'qt'
@@ -909,7 +908,6 @@
qt_feature("xcb" PUBLIC
SECTION "Platform plugins"
LABEL "XCB"
- AUTODETECT NOT APPLE
CONDITION QT_FEATURE_thread AND TARGET XCB::XCB AND TEST_xcb_syslibs AND QT_FEATURE_xkbcommon_x11
)
qt_feature("xcb-glx-plugin" PUBLIC
@@ -965,7 +963,6 @@
)
qt_feature("xlib" PRIVATE
LABEL "XLib"
- AUTODETECT NOT APPLE OR QT_FEATURE_xcb
CONDITION X11_FOUND
)
qt_feature("texthtmlparser" PUBLIC
51 changes: 51 additions & 0 deletions aqua/qt6/files/0003-Fix-finding-OpenGL.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
From e1867d1db4282cc8d74db30c6f56b706ac528115 Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <[email protected]>
Date: Mon, 19 Aug 2024 09:51:00 +0800
Subject: [PATCH] Fix finding OpenGL

diff --git cmake/FindWrapOpenGL.cmake cmake/FindWrapOpenGL.cmake
index 7295a159ca..8aaaec8212 100644
--- cmake/FindWrapOpenGL.cmake
+++ cmake/FindWrapOpenGL.cmake
@@ -13,40 +13,7 @@
set(WrapOpenGL_FOUND ON)

add_library(WrapOpenGL::WrapOpenGL INTERFACE IMPORTED)
- if(APPLE)
- # CMake 3.27 and older:
- # On Darwin platforms FindOpenGL sets IMPORTED_LOCATION to the absolute path of the library
- # within the framework. This ends up as an absolute path link flag, which we don't want,
- # because that makes our .prl files un-relocatable.
- # Extract the framework path instead, and use that in INTERFACE_LINK_LIBRARIES,
- # which CMake ends up transforming into a relocatable -framework flag.
- # See https://gitlab.kitware.com/cmake/cmake/-/issues/20871 for details.
- #
- # CMake 3.28 and above:
- # IMPORTED_LOCATION is the absolute path the the OpenGL.framework folder.
- get_target_property(__opengl_fw_lib_path OpenGL::GL IMPORTED_LOCATION)
- if(__opengl_fw_lib_path AND NOT __opengl_fw_lib_path MATCHES "/([^/]+)\\.framework$")
- get_filename_component(__opengl_fw_path "${__opengl_fw_lib_path}" DIRECTORY)
- endif()
-
- if(NOT __opengl_fw_path)
- # Just a safety measure in case if no OpenGL::GL target exists.
- set(__opengl_fw_path "-framework OpenGL")
- endif()
-
- find_library(WrapOpenGL_AGL NAMES AGL)
- if(WrapOpenGL_AGL)
- set(__opengl_agl_fw_path "${WrapOpenGL_AGL}")
- endif()
- if(NOT __opengl_agl_fw_path)
- set(__opengl_agl_fw_path "-framework AGL")
- endif()
-
- target_link_libraries(WrapOpenGL::WrapOpenGL INTERFACE ${__opengl_fw_path})
- target_link_libraries(WrapOpenGL::WrapOpenGL INTERFACE ${__opengl_agl_fw_path})
- else()
- target_link_libraries(WrapOpenGL::WrapOpenGL INTERFACE OpenGL::GL)
- endif()
+ target_link_libraries(WrapOpenGL::WrapOpenGL INTERFACE OpenGL::GL)
endif()

include(FindPackageHandleStandardArgs)
22 changes: 22 additions & 0 deletions aqua/qt6/files/0004-Fix-mkspec-for-Apple.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
From dd3791f94e30036ac2b8936cea0c0b7485d4d886 Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <[email protected]>
Date: Mon, 19 Aug 2024 10:25:57 +0800
Subject: [PATCH] Fix mkspec for Apple

diff --git cmake/QtMkspecHelpers.cmake cmake/QtMkspecHelpers.cmake
index a9612966b5..5afc4396f6 100644
--- cmake/QtBuild.cmake
+++ cmake/QtBuild.cmake
@@ -306,7 +306,11 @@
elseif(IOS)
set(QT_DEFAULT_MKSPEC macx-ios-clang)
elseif(APPLE)
- set(QT_DEFAULT_MKSPEC macx-clang)
+ if(CLANG)
+ set(QT_DEFAULT_MKSPEC macx-clang)
+ elseif(GCC)
+ set(QT_DEFAULT_MKSPEC macx-g++)
+ endif()
elseif(WASM)
set(QT_DEFAULT_MKSPEC wasm-emscripten)
elseif(QNX)

0 comments on commit 6d71196

Please sign in to comment.