diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/tidy-html5 | |
Diffstat (limited to 'vcpkg/ports/tidy-html5')
| -rw-r--r-- | vcpkg/ports/tidy-html5/cmake_find_package_support.patch | 43 | ||||
| -rw-r--r-- | vcpkg/ports/tidy-html5/debug-postfix.patch | 25 | ||||
| -rw-r--r-- | vcpkg/ports/tidy-html5/disable-doc.patch | 13 | ||||
| -rw-r--r-- | vcpkg/ports/tidy-html5/fix_unsupport_func_uwp.patch | 13 | ||||
| -rw-r--r-- | vcpkg/ports/tidy-html5/portfile.cmake | 34 | ||||
| -rw-r--r-- | vcpkg/ports/tidy-html5/static-vs-shared.patch | 34 | ||||
| -rw-r--r-- | vcpkg/ports/tidy-html5/vcpkg.json | 18 |
7 files changed, 180 insertions, 0 deletions
diff --git a/vcpkg/ports/tidy-html5/cmake_find_package_support.patch b/vcpkg/ports/tidy-html5/cmake_find_package_support.patch new file mode 100644 index 0000000..9c03d5e --- /dev/null +++ b/vcpkg/ports/tidy-html5/cmake_find_package_support.patch @@ -0,0 +1,43 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8efec25..3fedb02 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -407,10 +407,12 @@ else () + OUTPUT_NAME ${LIB_NAME} ) + + endif () ++set_target_properties(${name} PROPERTIES EXPORT_NAME tidy) ++target_include_directories( ${name} PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>) + if (NOT TIDY_CONSOLE_SHARED) # user wants default static linkage + list ( APPEND add_LIBS ${name} ) + endif () +-install(TARGETS ${name} ++install(TARGETS ${name} EXPORT unofficial-tidy-html5Config + RUNTIME DESTINATION ${BIN_INSTALL_DIR} + ARCHIVE DESTINATION ${LIB_INSTALL_DIR} + LIBRARY DESTINATION ${LIB_INSTALL_DIR} +@@ -440,7 +442,9 @@ if (BUILD_SHARED_LIB) + NO_SONAME ${NO_SONAME} ) + set_target_properties( ${name} PROPERTIES + COMPILE_FLAGS "-DBUILD_SHARED_LIB -DBUILDING_SHARED_LIB") +- install(TARGETS ${name} ++ set_target_properties(${name} PROPERTIES EXPORT_NAME tidy) ++ target_include_directories( ${name} PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>) ++ install(TARGETS ${name} EXPORT unofficial-tidy-html5Config + RUNTIME DESTINATION ${BIN_INSTALL_DIR} + ARCHIVE DESTINATION ${LIB_INSTALL_DIR} + LIBRARY DESTINATION ${LIB_INSTALL_DIR} +@@ -450,6 +454,13 @@ if (BUILD_SHARED_LIB) + endif () + endif () + ++#------------------------------------------------------------------------ ++# CMake FIND_PACKAGE() Support ++#------------------------------------------------------------------------ ++install(EXPORT unofficial-tidy-html5Config ++ DESTINATION ${LIB_INSTALL_DIR}/cmake/unofficial-tidy-html5 ++ NAMESPACE unofficial::tidy-html5::) ++ + + #------------------------------------------------------------------------ + # Main Executable diff --git a/vcpkg/ports/tidy-html5/debug-postfix.patch b/vcpkg/ports/tidy-html5/debug-postfix.patch new file mode 100644 index 0000000..2c882f0 --- /dev/null +++ b/vcpkg/ports/tidy-html5/debug-postfix.patch @@ -0,0 +1,25 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 979ae25..4eb88a1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,9 @@ if(WIN32 AND MSVC) + set( MSVC_FLAGS "-DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS" ) + + # to distinguish between debug and release lib in windows ++ if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + set( CMAKE_DEBUG_POSTFIX "d" ) # little effect in unix ++ endif() + else() + # add any gcc flags + endif() +diff --git a/tidy.pc.cmake.in b/tidy.pc.cmake.in +index 7d819f1..cbdd299 100644 +--- a/tidy.pc.cmake.in ++++ b/tidy.pc.cmake.in +@@ -7,5 +7,5 @@ Name: @LIB_NAME@ + Description: @LIBTIDY_DESCRIPTION@ + URL: @LIBTIDY_URL@ + Version: @LIBTIDY_VERSION@ +-Libs: -L${libdir} -l@LIB_NAME@ ++Libs: -L${libdir} -l@LIB_NAME@@CMAKE_DEBUG_POSTFIX@ + Cflags: -I${includedir} diff --git a/vcpkg/ports/tidy-html5/disable-doc.patch b/vcpkg/ports/tidy-html5/disable-doc.patch new file mode 100644 index 0000000..105c766 --- /dev/null +++ b/vcpkg/ports/tidy-html5/disable-doc.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8efec25..d2edac2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -508,7 +508,7 @@ endif () + # Create man pages + ################################################# + +-if (UNIX AND SUPPORT_CONSOLE_APP) ++if (0) + find_program( XSLTPROC_FOUND xsltproc ) + if (XSLTPROC_FOUND) + ## NOTE: man name must match exe ie currently `${LIB_NAME}.1` not `tidy.1` diff --git a/vcpkg/ports/tidy-html5/fix_unsupport_func_uwp.patch b/vcpkg/ports/tidy-html5/fix_unsupport_func_uwp.patch new file mode 100644 index 0000000..7da38b6 --- /dev/null +++ b/vcpkg/ports/tidy-html5/fix_unsupport_func_uwp.patch @@ -0,0 +1,13 @@ +diff --git a/src/sprtf.c b/src/sprtf.c +index 3468ac1..1630405 100644 +--- a/src/sprtf.c ++++ b/src/sprtf.c +@@ -387,7 +387,7 @@ static void wprt( PTSTR ps ) + { + static char _s_woibuf[1024]; + char * cp = _s_woibuf; +- int len = (int)lstrlen(ps); ++ int len = (int)wcslen(ps); + if(len) { + int ret = WideCharToMultiByte( CP_ACP, /* UINT CodePage, // code page */ + 0, /* DWORD dwFlags, // performance and mapping flags */ diff --git a/vcpkg/ports/tidy-html5/portfile.cmake b/vcpkg/ports/tidy-html5/portfile.cmake new file mode 100644 index 0000000..c6b9486 --- /dev/null +++ b/vcpkg/ports/tidy-html5/portfile.cmake @@ -0,0 +1,34 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO htacg/tidy-html5 + REF 5.8.0 + SHA512 f352165bdda5d1fca7bba3365560b64d6f70a4e010821cd246cde43bed5c23cea3408d461d3f889110fd35ec9b68aa2b4e95412b07775eb852b7ee1745007a44 + HEAD_REF master + PATCHES + disable-doc.patch + static-vs-shared.patch + debug-postfix.patch + fix_unsupport_func_uwp.patch + cmake_find_package_support.patch +) + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED_LIB) +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + NO_CHARSET_FLAG + OPTIONS + -DBUILD_SHARED_LIB=${BUILD_SHARED_LIB} + -DTIDY_CONSOLE_SHARED=${BUILD_SHARED_LIB} +) +vcpkg_cmake_install() +vcpkg_fixup_pkgconfig() +vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-tidy-html5 CONFIG_PATH lib/cmake/unofficial-tidy-html5) + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/bin/tidyd${VCPKG_TARGET_EXECUTABLE_SUFFIX}" +) + +vcpkg_copy_tools(TOOL_NAMES tidy AUTO_CLEAN) + +file(INSTALL "${SOURCE_PATH}/README/LICENSE.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/vcpkg/ports/tidy-html5/static-vs-shared.patch b/vcpkg/ports/tidy-html5/static-vs-shared.patch new file mode 100644 index 0000000..92b6c8e --- /dev/null +++ b/vcpkg/ports/tidy-html5/static-vs-shared.patch @@ -0,0 +1,34 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d2edac2..979ae25 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -395,11 +395,11 @@ endif () + + #------------------------------------------------------------------------ + # Static Library +-# The static library always builds. ++if(NOT BUILD_SHARED_LIB) + #------------------------------------------------------------------------ + set(name tidy-static) + add_library ( ${name} STATIC ${CFILES} ${HFILES} ${LIBHFILES} ) +-if (WIN32) ++if (0) + set_target_properties( ${name} PROPERTIES + OUTPUT_NAME ${LIB_NAME}_static ) + else () +@@ -415,12 +415,14 @@ install(TARGETS ${name} + ARCHIVE DESTINATION ${LIB_INSTALL_DIR} + LIBRARY DESTINATION ${LIB_INSTALL_DIR} + ) +-install( FILES ${HFILES} DESTINATION ${INCLUDE_INSTALL_DIR} ) + if(MSVC) + # install(FILES $<TARGET_PDB_FILE:${name}> DESTINATION lib OPTIONAL) + INSTALL(FILES ${PROJECT_BINARY_DIR}/${name}.dir/Debug/${name}.pdb ++ OPTIONAL + DESTINATION lib CONFIGURATIONS Debug ) + endif() ++endif() ++install( FILES ${HFILES} DESTINATION ${INCLUDE_INSTALL_DIR} ) + + #------------------------------------------------------------------------ + # Dynamic Library diff --git a/vcpkg/ports/tidy-html5/vcpkg.json b/vcpkg/ports/tidy-html5/vcpkg.json new file mode 100644 index 0000000..9d9eefd --- /dev/null +++ b/vcpkg/ports/tidy-html5/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "tidy-html5", + "version": "5.8.0", + "port-version": 2, + "description": "Tidy tidies HTML and XML. It can tidy your documents by itself, and developers can easily integrate its features into even more powerful tools.", + "homepage": "https://www.html-tidy.org", + "license": null, + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} |