Skip to content

Commit

Permalink
Add py-qscintilla-qt5
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Mar 3, 2024
1 parent 0fbf39c commit ecf619c
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 0 deletions.
29 changes: 29 additions & 0 deletions ports/py-qscintilla-qt5/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
62 changes: 62 additions & 0 deletions ports/py-qscintilla-qt5/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
vcpkg_download_distfile(ARCHIVE
URLS "https://www.riverbankcomputing.com/static/Downloads/QScintilla/2.13.4/QScintilla_src-2.13.4.tar.gz"
FILENAME "QScintilla-2.13.4.tar.gz"
SHA512 591379f4d48a6de1bc61db93f6c0d1c48b6830a852679b51e27debb866524c320e2db27d919baf32576c2bf40bba62e38378673a86f22db9839746e26b0f77cd
)

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/qt5/bin/qmake${VCPKG_HOST_EXECUTABLE_SUFFIX}"
"--api-dir" "${CURRENT_PACKAGES_DIR}/share/qt5/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 "PyQt5.QtCore")

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-qt5/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "py-qscintilla-qt5",
"version": "2.13.4",
"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-qt5"
},
"py-pyqt5",
{
"name": "vcpkg-python-scripts",
"host": true
},
{
"name": "vcpkg-qmake-qt5",
"host": true
}
]
}

0 comments on commit ecf619c

Please sign in to comment.