From 10c44bb43928de8afadf2f928186a9fd02328674 Mon Sep 17 00:00:00 2001 From: Funda Wang Date: Wed, 17 Dec 2025 23:07:10 +0800 Subject: [PATCH] fix build with cmake 4 --- fix-cmake4-lib-path.patch | 67 +++++++++++++++++++++++++++++++++++++++ python-pyside6.spec | 10 ++++-- 2 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 fix-cmake4-lib-path.patch diff --git a/fix-cmake4-lib-path.patch b/fix-cmake4-lib-path.patch new file mode 100644 index 0000000..17f028c --- /dev/null +++ b/fix-cmake4-lib-path.patch @@ -0,0 +1,67 @@ +diff --git a/sources/pyside6/cmake/PySideSetup.cmake b/sources/pyside6/cmake/PySideSetup.cmake +index 34ec035..cf3b55a 100644 +--- a/sources/pyside6/cmake/PySideSetup.cmake ++++ b/sources/pyside6/cmake/PySideSetup.cmake +@@ -14,6 +14,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/Macros") + # package. Needs to support top-level build as well (Shiboken is not yet installed in that case). + include(ShibokenHelpers) + include(PySideHelpers) ++include(GNUInstallDirs) + + #does nothing if QFP_NO_OVERRIDE_OPTIMIZATION_FLAGS (no-size-optimization) flag is not set + override_release_flags_for_size_optimization() +@@ -103,8 +104,7 @@ add_definitions(${Qt${QT_MAJOR_VERSION}Core_DEFINITIONS}) + + option(BUILD_TESTS "Build tests." TRUE) + option(ENABLE_VERSION_SUFFIX "Used to use current version in suffix to generated files. This is used to allow multiples versions installed simultaneous." FALSE) +-set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" ) +-set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE) ++set(LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is ${CMAKE_INSTALL_LIBDIR})" FORCE) + if(CMAKE_HOST_APPLE) + set(ALTERNATIVE_QT_INCLUDE_DIR "" CACHE PATH "Deprecated. CMake now finds the proper include dir itself.") + set(OSX_USE_LIBCPP "OFF" CACHE BOOL "Explicitly link the libc++ standard library (useful for macOS deployment targets lower than 10.9.") +diff --git a/sources/shiboken6/ApiExtractor/CMakeLists.txt b/sources/shiboken6/ApiExtractor/CMakeLists.txt +index 37758f7..6fa8192 100644 +--- a/sources/shiboken6/ApiExtractor/CMakeLists.txt ++++ b/sources/shiboken6/ApiExtractor/CMakeLists.txt +@@ -7,6 +7,7 @@ cmake_minimum_required(VERSION 3.18) + cmake_policy(VERSION 3.18) + + set(CMAKE_AUTOMOC ON) ++include(GNUInstallDirs) + + set(apiextractor_SRC + abstractmetaargument.cpp abstractmetaargument.h +@@ -129,7 +130,7 @@ target_compile_definitions(apiextractor + PRIVATE CMAKE_CXX_COMPILER="${CMAKE_CXX_COMPILER}" + PRIVATE QT_LEAN_HEADERS=1) + +-set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE) ++set(LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is ${CMAKE_INSTALL_LIBDIR})" FORCE) + + if (BUILD_TESTS) + find_package(Qt6 REQUIRED COMPONENTS Test) +diff --git a/sources/shiboken6/cmake/ShibokenSetup.cmake b/sources/shiboken6/cmake/ShibokenSetup.cmake +index 32823d9..3591cd7 100644 +--- a/sources/shiboken6/cmake/ShibokenSetup.cmake ++++ b/sources/shiboken6/cmake/ShibokenSetup.cmake +@@ -6,6 +6,7 @@ include(CheckIncludeFileCXX) + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") + + include(ShibokenHelpers) ++include(GNUInstallDirs) + + option(DISABLE_DOCSTRINGS "Disable documentation extraction." FALSE) + +@@ -90,9 +91,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D QT_NO_CAST_FROM_ASCII -D QT_NO_CAST_T + set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + +-set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" ) +-set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install \ +- prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE) ++set(LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "The subdirectory relative to the install \ ++ prefix where libraries will be installed (default is ${CMAKE_INSTALL_LIBDIR})" FORCE) + set(BIN_INSTALL_DIR "bin" CACHE PATH "The subdirectory relative to the install prefix where \ + dlls will be installed (default is /bin)" FORCE) + diff --git a/python-pyside6.spec b/python-pyside6.spec index 09afef1..edca530 100644 --- a/python-pyside6.spec +++ b/python-pyside6.spec @@ -10,7 +10,7 @@ Name: python-%{pypi_name} Version: 6.8.2.1 -Release: 1 +Release: 2 Summary: Python bindings for the Qt 6 cross-platform application and UI framework License: LGPL-3.0-only OR GPL-3.0-only WITH Qt-GPL-exception-1.0 @@ -21,6 +21,8 @@ Source0: https://download.qt.io/official_releases/QtForPython/%{pypi_name #https://bugreports.qt.io/browse/PYSIDE-2491 Patch0: 147389_fix-build.patch +Patch1: fix-cmake4-lib-path.patch + BuildRequires: cmake BuildRequires: ninja-build BuildRequires: gcc @@ -213,8 +215,9 @@ sed -i 's#${base}/../shiboken6/##' sources/pyside6/CMakeLists.txt %build -%cmake -G Ninja \ +%cmake_qt6 \ -DCMAKE_BUILD_TYPE=None \ + -DLIB_INSTALL_DIR=%{_libdir} \ -DSHIBOKEN_PYTHON_LIBRARIES=`pkgconf python3-embed --libs` \ -DBUILD_TESTS=OFF \ -DCMAKE_BUILD_RPATH_USE_ORIGIN:BOOL=ON \ @@ -324,5 +327,8 @@ find %{buildroot}%{python3_sitelib}/shiboken6_generator/scripts -type f -name "* %{python3_sitearch}/shiboken6_generator-%{version}-py%{python3_version}.egg-info/ %changelog +* Wed Dec 17 2025 Funda Wang - 6.8.2.1-2 +- fix build with cmake 4 + * Wed Jun 11 2025 yangfeng - 6.8.2.1-1 - Initial release for OpenEuler -- Gitee