From 7cb7de0193eeaefd1937eeba31f501101b84ea52 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Tue, 14 May 2024 07:50:41 +0200 Subject: [PATCH 1/3] [py-qscintilla] New port --- ports/py-qscintilla/fix-static.patch | 29 +++++++++++++ ports/py-qscintilla/portfile.cmake | 62 ++++++++++++++++++++++++++++ ports/py-qscintilla/vcpkg.json | 22 ++++++++++ 3 files changed, 113 insertions(+) create mode 100644 ports/py-qscintilla/fix-static.patch create mode 100644 ports/py-qscintilla/portfile.cmake create mode 100644 ports/py-qscintilla/vcpkg.json diff --git a/ports/py-qscintilla/fix-static.patch b/ports/py-qscintilla/fix-static.patch new file mode 100644 index 0000000..ab1cf54 --- /dev/null +++ b/ports/py-qscintilla/fix-static.patch @@ -0,0 +1,29 @@ +diff --git a/src/qscintilla.pro b/src/qscintilla.pro +index 8d0acd2..2246442 100644 +--- a/src/qscintilla.pro ++++ b/src/qscintilla.pro +@@ -37,13 +37,13 @@ CONFIG(debug, debug|release) { + TARGET = qscintilla2_qt$${QT_MAJOR_VERSION} + } + +-macx:!CONFIG(staticlib) { ++macx:!CONFIG(static) { + QMAKE_POST_LINK += install_name_tool -id @rpath/$(TARGET1) $(TARGET) + } + + INCLUDEPATH += . ../scintilla/include ../scintilla/lexlib ../scintilla/src + +-!CONFIG(staticlib) { ++!CONFIG(static) { + DEFINES += QSCINTILLA_MAKE_DLL + + # Comment this in to build a dynamic library supporting multiple +@@ -86,7 +86,7 @@ qsci.files = ../qsci + INSTALLS += qsci + + features.path = $$[QT_HOST_DATA]/mkspecs/features +-CONFIG(staticlib) { ++CONFIG(static) { + features.files = $$PWD/features_staticlib/qscintilla2.prf + } else { + features.files = $$PWD/features/qscintilla2.prf diff --git a/ports/py-qscintilla/portfile.cmake b/ports/py-qscintilla/portfile.cmake new file mode 100644 index 0000000..7c2ec76 --- /dev/null +++ b/ports/py-qscintilla/portfile.cmake @@ -0,0 +1,62 @@ +vcpkg_download_distfile(ARCHIVE + URLS "https://www.riverbankcomputing.com/static/Downloads/QScintilla/${VERSION}/QScintilla_src-${VERSION}.tar.gz" + FILENAME "QScintilla-${VERSION}.tar.gz" + SHA512 19e2f9e0a14947501c575018df368d24eb7f8c74e74faa5246db36415bf28dc0beee507ed0e73107c02b36a99bbaf55f0ef3349f479d2332e1b92b2c4a32788a +) + +vcpkg_extract_source_archive( + SOURCE_PATH + ARCHIVE ${ARCHIVE} + PATCHES + fix-static.patch +) + +file(RENAME "${SOURCE_PATH}/Python/pyproject-qt5.toml" "${SOURCE_PATH}/Python/pyproject.toml") + +set(SIPBUILD_ARGS + "--qmake" "${CURRENT_INSTALLED_DIR}/tools/Qt6/bin/qmake${VCPKG_HOST_EXECUTABLE_SUFFIX}" + "--api-dir" "${CURRENT_PACKAGES_DIR}/share/Qt6/qsci/api/python" + "--qsci-features-dir" "${SOURCE_PATH}/src/features" + "--qsci-include-dir" "${SITE_PACKAGES}/src" + "--qsci-library-dir" "${SOURCE_PATH}/src" + "--no-make" + "--verbose" + "--build-dir" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" + "--target-dir" "${CURRENT_INSTALLED_DIR}/tools/python3/Lib/site-packages/" +) + +# TODO: help it find sip include dirs, manually patched into sipbuild/project.py for now +# "--sip-include-dirs" "${CURRENT_INSTALLED_DIR}/tools/python3/Lib/site-packages/" + +vcpkg_backup_env_variables(VARS PATH) + +vcpkg_add_to_path(PREPEND "${CURRENT_HOST_INSTALLED_DIR}/tools/python3/Scripts/") + +message(STATUS "Running sipbuild...") +vcpkg_execute_required_process( + COMMAND "${PYTHON3}" "-m" "sipbuild.tools.build" ${SIPBUILD_ARGS} + WORKING_DIRECTORY "${SOURCE_PATH}/Python" + LOGNAME "sipbuild-${TARGET_TRIPLET}" +) +message(STATUS "Running sipbuild...finished.") + +# inventory.txt is consumed by the distinfo tool which is run during make and should be run against the package directory +file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}" NATIVE_INSTALLED_DIR) +vcpkg_replace_string("${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/inventory.txt" + "${CURRENT_INSTALLED_DIR}" + "${CURRENT_PACKAGES_DIR}") + vcpkg_replace_string("${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/inventory.txt" + "${NATIVE_INSTALLED_DIR}" + "${CURRENT_PACKAGES_DIR}") + +vcpkg_qmake_build(SKIP_MAKEFILE BUILD_LOGNAME "install" TARGETS "install") + +vcpkg_restore_env_variables(VARS PATH) + +vcpkg_python_test_import(MODULE "PyQt6.Qsci") + +vcpkg_copy_pdbs() + + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/py-qscintilla/vcpkg.json b/ports/py-qscintilla/vcpkg.json new file mode 100644 index 0000000..f83167b --- /dev/null +++ b/ports/py-qscintilla/vcpkg.json @@ -0,0 +1,22 @@ +{ + "name": "py-qscintilla", + "version": "2.14.1", + "description": "Python bindings for QScintilla, which is a port to Qt of the Scintilla editing component. Features syntax highlighting, code-completion and much more (Barebone build without python bindings (missing dependeny PyQt) and without QtDesigner plugin)", + "homepage": "https://www.riverbankcomputing.com/software/qscintilla", + "license": "GPL-3.0-or-later", + "supports": "!xbox", + "dependencies": [ + { + "name": "qscintilla" + }, + "py-pyqt6", + { + "name": "vcpkg-python-scripts", + "host": true + }, + { + "name": "vcpkg-qmake", + "host": true + } + ] +} From c787cae0fb08a2907b4c1a50f44fc24affc041f1 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Tue, 14 May 2024 07:53:10 +0200 Subject: [PATCH 2/3] test --- .github/workflows/windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 99515f8..8004d44 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -57,7 +57,7 @@ jobs: - name: 🌋 Build run: | - .\vcpkg\vcpkg.exe install --overlay-ports="${{ github.workspace }}/ports" --triplet=${{ matrix.triplet }} --x-buildtrees-root=C:/vcpkg-build py-pyqt6 py-pyyaml py-numpy gdal[python] + .\vcpkg\vcpkg.exe install --overlay-ports="${{ github.workspace }}/ports" --triplet=${{ matrix.triplet }} --x-buildtrees-root=C:/vcpkg-build py-pyqt6 py-pyyaml py-numpy gdal[python] py-qscintilla - name: 📑 Upload logs uses: actions/upload-artifact@v4 From e99d6131b98c8156ad58a7bb382d3b79feb32741 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Tue, 14 May 2024 08:40:08 +0200 Subject: [PATCH 3/3] python is release only --- ports/py-qscintilla/portfile.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/py-qscintilla/portfile.cmake b/ports/py-qscintilla/portfile.cmake index 7c2ec76..cbb4f34 100644 --- a/ports/py-qscintilla/portfile.cmake +++ b/ports/py-qscintilla/portfile.cmake @@ -1,3 +1,5 @@ +set(VCPKG_BUILD_TYPE release) + vcpkg_download_distfile(ARCHIVE URLS "https://www.riverbankcomputing.com/static/Downloads/QScintilla/${VERSION}/QScintilla_src-${VERSION}.tar.gz" FILENAME "QScintilla-${VERSION}.tar.gz"