depends: Build qt and qrencode packages for OpenBSD hosts

This commit is contained in:
Hennadii Stepanov
2026-06-01 00:11:44 +01:00
parent fbe628756c
commit a54ec373a6
9 changed files with 101 additions and 5 deletions

View File

@@ -53,6 +53,10 @@ To build dependencies for the current arch+OS:
pkg_add bash cmake curl gmake gtar
Skip the following packages if you don't intend to use the GUI and will build with [`NO_QT=1`](#dependency-options):
pkg_add bison ninja
To build dependencies for the current arch+OS:
gmake

View File

@@ -5,6 +5,7 @@ $(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=f8db94d307e9c54961b39a1cc799a67d46681480696ed72ecf78d4473770f09b
$(package)_build_subdir=build
$(package)_patches += cmake_minimum.patch
$(package)_patches += openbsd_versioning.patch
define $(package)_set_vars
$(package)_config_opts := -DCMAKE_BUILD_TYPE=None -DBUILD_SHARED_LIBS=TRUE
@@ -14,7 +15,8 @@ define $(package)_set_vars
endef
define $(package)_preprocess_cmds
patch -p1 < $($(package)_patch_dir)/cmake_minimum.patch
patch -p1 < $($(package)_patch_dir)/cmake_minimum.patch && \
patch -p1 < $($(package)_patch_dir)/openbsd_versioning.patch
endef
define $(package)_config_cmds

View File

@@ -6,11 +6,13 @@ libevent_packages = libevent
qrencode_linux_packages = qrencode
qrencode_freebsd_packages = qrencode
qrencode_openbsd_packages = qrencode
qrencode_darwin_packages = qrencode
qrencode_mingw32_packages = qrencode
qt_linux_packages:=qt expat libxcb xcb_proto libXau xproto freetype fontconfig libxkbcommon libxcb_util libxcb_util_cursor libxcb_util_render libxcb_util_keysyms libxcb_util_image libxcb_util_wm
qt_freebsd_packages:=$(qt_linux_packages)
qt_openbsd_packages:=$(qt_linux_packages)
qt_darwin_packages=qt
qt_mingw32_packages=qt
ifneq ($(host),$(build))

View File

@@ -9,6 +9,7 @@ $(package)_dependencies := native_$(package)
endif
$(package)_linux_dependencies := freetype fontconfig libxcb libxkbcommon libxcb_util libxcb_util_cursor libxcb_util_render libxcb_util_keysyms libxcb_util_image libxcb_util_wm
$(package)_freebsd_dependencies := $($(package)_linux_dependencies)
$(package)_openbsd_dependencies := $($(package)_linux_dependencies)
$(package)_patches_path := $(qt_details_patches_path)
$(package)_patches := cocoa_compat.patch
$(package)_patches += dont_hardcode_pwd.patch
@@ -26,6 +27,8 @@ $(package)_patches += fix-gcc16-sfinae-qbitarray.patch
$(package)_patches += fix-gcc16-sfinae-qanystringview.patch
$(package)_patches += fix-macos26-qyield.patch
$(package)_patches += fix-qbytearray-include.patch
$(package)_patches += fix_openbsd_network_kernel.patch
$(package)_patches += fix_openbsd_plugin_qelfparser.patch
$(package)_qttranslations_file_name=$(qt_details_qttranslations_file_name)
$(package)_qttranslations_sha256_hash=$(qt_details_qttranslations_sha256_hash)
@@ -158,6 +161,7 @@ $(package)_config_opts_linux += -ltcg
endif
$(package)_config_opts_freebsd := $$($(package)_config_opts_linux)
$(package)_config_opts_freebsd += -no-feature-inotify
$(package)_config_opts_openbsd := $$($(package)_config_opts_linux)
$(package)_config_opts_mingw32 := -no-dbus
$(package)_config_opts_mingw32 += -no-feature-freetype
@@ -208,7 +212,7 @@ $(package)_cmake_opts += -DCMAKE_DISABLE_FIND_PACKAGE_WrapSystemDoubleConversion
$(package)_cmake_opts += -DCMAKE_DISABLE_FIND_PACKAGE_WrapSystemMd4c=TRUE
$(package)_cmake_opts += -DCMAKE_DISABLE_FIND_PACKAGE_WrapZSTD=TRUE
endif
ifeq ($(host_os),linux)
ifneq (,$(filter linux openbsd,$(host_os)))
# The `-dbus-runtime` configure option does not work
# https://qt-project.atlassian.net/browse/QTBUG-144864
$(package)_cmake_opts += -DINPUT_dbus=runtime
@@ -284,7 +288,9 @@ define $(package)_preprocess_cmds
patch -p1 -i $($(package)_patch_dir)/fix-gcc16-sfinae-qbitarray.patch && \
patch -p1 -i $($(package)_patch_dir)/fix-gcc16-sfinae-qanystringview.patch && \
patch -p1 -i $($(package)_patch_dir)/fix-macos26-qyield.patch && \
patch -p1 -i $($(package)_patch_dir)/fix-qbytearray-include.patch
patch -p1 -i $($(package)_patch_dir)/fix-qbytearray-include.patch && \
patch -p1 -i $($(package)_patch_dir)/fix_openbsd_network_kernel.patch && \
patch -p1 -i $($(package)_patch_dir)/fix_openbsd_plugin_qelfparser.patch
endef
ifeq ($(host),$(build))
$(package)_preprocess_cmds += && patch -p1 -i $($(package)_patch_dir)/qttools_skip_dependencies.patch

View File

@@ -0,0 +1,31 @@
[cmake] Fix shared library versioning on OpenBSD.
This emulates Libtool to make sure Libtool and CMake agree on the ABI
version. Specifically, for OpenBSD, `builds/unix/configure` defines
`version_type=sunos` and skips defining `soname_spec`.
See upstream MR: https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/433.
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -458,9 +458,17 @@ if (WIN32)
endif ()
if (BUILD_SHARED_LIBS)
- set_target_properties(freetype PROPERTIES
- VERSION ${LIBRARY_VERSION}
- SOVERSION ${LIBRARY_SOVERSION})
+ if (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
+ # For OpenBSD, libtool follows `sunos` version type.
+ set_target_properties(freetype PROPERTIES
+ # libtool does not define its internal `soname_spec` variable
+ # for OpenBSD. So skipping the SOVERSION option.
+ VERSION ${LIBTOOL_CURRENT}.${LIBTOOL_REVISION})
+ else ()
+ set_target_properties(freetype PROPERTIES
+ VERSION ${LIBRARY_VERSION}
+ SOVERSION ${LIBRARY_SOVERSION})
+ endif ()
endif ()
# Pick up ftconfig.h and ftoption.h generated above, first.

View File

@@ -0,0 +1,31 @@
Fix compiling on OpenBSD
1. The `net/if_types.h` header does not define the `IFT_STF` symbol.
2. The `netinet6/in6_var.h` header defines some of the used symbols.
For the reference, see:
- https://codeberg.org/OpenBSD/ports/src/commit/f8f1aedbe8aff550c69930b5d92b9c392e298382/x11/qt6/qtbase/patches/patch-src_network_kernel_qnetworkinterface_unix_cpp
--- a/qtbase/src/network/kernel/qnetworkinterface_unix.cpp
+++ b/qtbase/src/network/kernel/qnetworkinterface_unix.cpp
@@ -392,6 +392,9 @@ QT_BEGIN_INCLUDE_NAMESPACE
# include <net/if_media.h>
# include <net/if_types.h>
# include <netinet/in_var.h>
+# ifdef Q_OS_OPENBSD
+# include <netinet6/in6_var.h>
+# endif
#endif // QT_PLATFORM_UIKIT
QT_END_INCLUDE_NAMESPACE
@@ -419,7 +422,9 @@ static QNetworkInterface::InterfaceType probeIfType(int socket, int iftype, stru
return QNetworkInterface::Ieee1394;
case IFT_GIF:
+#ifndef Q_OS_OPENBSD
case IFT_STF:
+#endif
return QNetworkInterface::Virtual;
}

View File

@@ -0,0 +1,20 @@
Fix compiling on OpenBSD
Avoid use of undeclared identifier `ELFOSABI_AIX`.
For the reference, see:
- https://codeberg.org/OpenBSD/ports/src/commit/c5e4088b89277b96d840492f9961b1593182b99c/x11/qt6/qtbase/patches/patch-src_corelib_plugin_qelfparser_p_cpp
--- a/qtbase/src/corelib/plugin/qelfparser_p.cpp
+++ b/qtbase/src/corelib/plugin/qelfparser_p.cpp
@@ -341,7 +341,9 @@ Q_DECL_UNUSED Q_DECL_COLD_FUNCTION static QDebug &operator<<(QDebug &d, ElfHeade
case ELFOSABI_NETBSD: d << " (NetBSD"; break;
case ELFOSABI_LINUX: d << " (GNU/Linux"; break;
case ELFOSABI_SOLARIS: d << " (Solaris"; break;
+#ifndef Q_OS_OPENBSD
case ELFOSABI_AIX: d << " (AIX"; break;
+#endif
case ELFOSABI_IRIX: d << " (IRIX"; break;
case ELFOSABI_FREEBSD: d << " (FreeBSD"; break;
case ELFOSABI_OPENBSD: d << " (OpenBSD"; break;

View File

@@ -117,7 +117,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_HOST_APPLE)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|FreeBSD)$")
if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|FreeBSD|OpenBSD)$")
# Customize pkg-config behavior for finding dependencies
# of the xcb QPA platform plugin:
# 1. Restrict search paths to the depends.

View File

@@ -16,7 +16,7 @@ get_target_property(qt_lib_type Qt6::Core TYPE)
function(import_plugins target)
if(qt_lib_type STREQUAL "STATIC_LIBRARY")
set(plugins Qt6::QMinimalIntegrationPlugin)
if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|FreeBSD)$")
if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|FreeBSD|OpenBSD)$")
list(APPEND plugins Qt6::QXcbIntegrationPlugin)
elseif(WIN32)
list(APPEND plugins Qt6::QWindowsIntegrationPlugin Qt6::QModernWindowsStylePlugin)