Skip to content

Commit

Permalink
Merge pull request #31 from open-vcpkg/py-qscintilla
Browse files Browse the repository at this point in the history
[py-qscintilla] New port
  • Loading branch information
m-kuhn authored May 14, 2024
2 parents 6789d5f + e99d613 commit b68f073
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 29 additions & 0 deletions ports/py-qscintilla/fix-static.patch
Original file line number Diff line number Diff line change
@@ -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
64 changes: 64 additions & 0 deletions ports/py-qscintilla/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
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"
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)
22 changes: 22 additions & 0 deletions ports/py-qscintilla/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}

0 comments on commit b68f073

Please sign in to comment.