Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions ports/kf6syntaxhighlighting/001_fix_lnk2005_windows_static.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
diff --git a/examples/codeeditor/CMakeLists.txt b/examples/codeeditor/CMakeLists.txt
--- a/examples/codeeditor/CMakeLists.txt
+++ b/examples/codeeditor/CMakeLists.txt
@@ -1,4 +1,7 @@
if(TARGET Qt6::Widgets)
add_executable(codeeditor codeeditor.cpp main.cpp)
target_link_libraries(codeeditor Qt6::Widgets KF6SyntaxHighlighting)
+ if(MSVC AND NOT BUILD_SHARED_LIBS)
+ target_link_options(codeeditor PRIVATE /FORCE:MULTIPLE)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems almost certainly incorrect. Can you describe the linker error that this is trying to work around and why this attempt is safe?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my understanding, Qt changed something in some recent version, and the functions in removed_api.cpp, are not inlined in windows static builds, so this causes LNK2005 duplicate symbol errors. I think that's a bug in the qt, I'm trying to see if I can fix it in the qtbase port instead, see #50859.

+ endif()
endif()
diff --git a/examples/codepdfprinter/CMakeLists.txt b/examples/codepdfprinter/CMakeLists.txt
--- a/examples/codepdfprinter/CMakeLists.txt
+++ b/examples/codepdfprinter/CMakeLists.txt
@@ -1,4 +1,7 @@
if(TARGET Qt6::Widgets AND TARGET Qt6::PrintSupport)
add_executable(codepdfprinter codepdfprinter.cpp main.cpp)
target_link_libraries(codepdfprinter Qt6::Widgets Qt6::PrintSupport KF6SyntaxHighlighting)
+ if(MSVC AND NOT BUILD_SHARED_LIBS)
+ target_link_options(codepdfprinter PRIVATE /FORCE:MULTIPLE)
+ endif()
endif()
diff --git a/src/cli/CMakeLists.txt b/src/cli/CMakeLists.txt
--- a/src/cli/CMakeLists.txt
+++ b/src/cli/CMakeLists.txt
@@ -2,4 +2,8 @@
ecm_mark_nongui_executable(ksyntaxhighlighter6)
target_link_libraries(ksyntaxhighlighter6 KF6SyntaxHighlighting)

+if(MSVC AND NOT BUILD_SHARED_LIBS)
+ target_link_options(ksyntaxhighlighter6 PRIVATE /FORCE:MULTIPLE)
+endif()
+
install(TARGETS ksyntaxhighlighter6 ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
diff --git a/src/indexer/CMakeLists.txt b/src/indexer/CMakeLists.txt
--- a/src/indexer/CMakeLists.txt
+++ b/src/indexer/CMakeLists.txt
@@ -33,4 +33,8 @@
else()
target_link_libraries(katehighlightingindexer Qt6::Core)
endif()
+
+ if(MSVC AND NOT BUILD_SHARED_LIBS)
+ target_link_options(katehighlightingindexer PRIVATE /FORCE:MULTIPLE)
+ endif()
endif()
45 changes: 45 additions & 0 deletions ports/kf6syntaxhighlighting/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO KDE/syntax-highlighting
REF "v${VERSION}"
SHA512 a1ff5ae92624000baee9eea8e5d48040a967fd085482e6648c913d343a1d9d67b142c0867ad308100f0b7645237de15e78889b480d76ca25fad44b228aa0d957
HEAD_REF master
PATCHES
001_fix_lnk2005_windows_static.patch
)

# Prevent KDEClangFormat from writing to source effectively blocking parallel configure
file(WRITE "${SOURCE_PATH}/.clang-format" "DisableFormat: true\nSortIncludes: false\n")

vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
INVERTED_FEATURES
translations KF_SKIP_PO_PROCESSING
)

vcpkg_find_acquire_program(PERL)
get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
vcpkg_add_to_path("${PERL_EXE_PATH}")

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DBUILD_TESTING=OFF
-DKDE_INSTALL_QMLDIR=qml
${FEATURE_OPTIONS}
)

vcpkg_cmake_install(ADD_BIN_TO_PATH)
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/KF6SyntaxHighlighting)
vcpkg_copy_pdbs()

vcpkg_copy_tools(
TOOL_NAMES ksyntaxhighlighter6
AUTO_CLEAN
)

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

file(GLOB LICENSE_FILES "${SOURCE_PATH}/LICENSES/*")
vcpkg_install_copyright(FILE_LIST ${LICENSE_FILES})
45 changes: 45 additions & 0 deletions ports/kf6syntaxhighlighting/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "kf6syntaxhighlighting",
"version": "6.23.0",
"description": "Syntax highlighting engine for Kate syntax definitions",
"homepage": "https://invent.kde.org/frameworks/syntax-highlighting",
"documentation": "https://api.kde.org/ksyntaxhighlighting-index.html",
"supports": "!android & !(windows & arm64)",
"dependencies": [
"ecm",
{
"name": "qtbase",
"default-features": false
},
{
"name": "qttools",
"host": true,
"default-features": false,
"features": [
"linguist"
]
},
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"translations": {
"description": "Build and install translation files",
"dependencies": [
{
"name": "qttools",
"host": true,
"features": [
"linguist"
]
}
]
}
}
}
4 changes: 4 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4424,6 +4424,10 @@
"baseline": "6.22.0",
"port-version": 0
},
"kf6syntaxhighlighting": {
"baseline": "6.23.0",
"port-version": 0
},
"kfr": {
"baseline": "6.3.1",
"port-version": 0
Expand Down
9 changes: 9 additions & 0 deletions versions/k-/kf6syntaxhighlighting.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "c3530a130de8f576a35391554f42a36b730bce78",
"version": "6.23.0",
"port-version": 0
}
]
}
Loading