[gumbo, litehtml] fix dupplicate gumbo symbols (#29804)

* [gumbo] fix CMakeLists.txt to export include folder properly.

* [litehtml] use vcpkg's gumbo

* [gumbo, litehtml] update version baseline

* [litehtml] fix litehtml CMake config.

* [litehtml] update version baseline

* [litehtml] fix relative includes in litehtml.h

* [litehtml] update version baseline
This commit is contained in:
Sean Farrell 2023-02-23 20:25:44 +01:00 committed by GitHub
parent c5a9aa4028
commit d744711b58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 131 additions and 10 deletions

View File

@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 3.8.0)
project(gumbo)
set(gumbo_public_headers
src/gumbo.h
src/tag_enum.h
)
set(gumbo_srcs
src/attribute.c
src/char_ref.c
@ -23,11 +28,22 @@ endif (MSVC)
add_library(gumbo ${gumbo_srcs})
set_target_properties(gumbo PROPERTIES
C_STANDARD 99
PUBLIC_HEADER "${gumbo_public_headers}"
)
target_include_directories(gumbo PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/>)
install(
TARGETS gumbo EXPORT unofficial-gumbo-config
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PUBLIC_HEADER DESTINATION include
)
install(EXPORT unofficial-gumbo-config
@ -37,6 +53,4 @@ install(EXPORT unofficial-gumbo-config
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/gumbo.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/lib/pkgconfig/gumbo.pc" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/lib/pkgconfig/gumbo.pc" DESTINATION "lib/pkgconfig")
if(NOT DISABLE_INSTALL_HEADERS)
install(FILES src/gumbo.h src/tag_enum.h DESTINATION include)
endif()

View File

@ -12,8 +12,6 @@ file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS_DEBUG
-DDISABLE_INSTALL_HEADERS=ON
)
vcpkg_cmake_install()
@ -24,6 +22,7 @@ vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-gumbo CONFIG_PATH share/unoffic
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/gumbo" RENAME copyright)

View File

@ -1,7 +1,7 @@
{
"name": "gumbo",
"version": "0.10.1",
"port-version": 5,
"port-version": 6,
"description": "An HTML5 parsing library in pure C99",
"homepage": "https://github.com/google/gumbo-parser",
"license": "Apache-2.0",

View File

@ -0,0 +1,32 @@
From 42cf79c0292d655eec41c486710bf610063bdfd8 Mon Sep 17 00:00:00 2001
From: Sean Farrell <sean.farrell@rioki.org>
Date: Thu, 23 Feb 2023 14:17:52 +0100
Subject: [PATCH] Fix relative includes.
---
include/litehtml.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/litehtml.h b/include/litehtml.h
index 98a24e0..d20addd 100644
--- a/include/litehtml.h
+++ b/include/litehtml.h
@@ -1,10 +1,10 @@
#ifndef LITEHTML_H
#define LITEHTML_H
-#include <litehtml/html.h>
-#include <litehtml/document.h>
-#include <litehtml/html_tag.h>
-#include <litehtml/stylesheet.h>
-#include <litehtml/element.h>
+#include <html.h>
+#include <document.h>
+#include <html_tag.h>
+#include <stylesheet.h>
+#include <element.h>
#endif // LITEHTML_H
--
2.33.0.windows.2

View File

@ -3,6 +3,9 @@ vcpkg_from_github(
REPO litehtml/litehtml
REF v0.6
SHA512 b774ed96e53780865e789875f571f96ebce1cd2ff0c05a06ae68a67aec44375cc282c07f77fc87131d422aceddba32bbf3e8e498c870883d8e042adb30834c39
PATCHES
use-vcpkg-gumbo.patch
fix-relative-includes.patch
)
if (VCPKG_TARGET_IS_WINDOWS)
@ -17,7 +20,6 @@ vcpkg_cmake_configure(
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME gumbo CONFIG_PATH lib/cmake/gumbo DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_cmake_config_fixup(PACKAGE_NAME litehtml CONFIG_PATH lib/cmake/litehtml)

View File

@ -0,0 +1,62 @@
From 4ca6d9846bfc39c4aa98d6a41f298078b4bebf8d Mon Sep 17 00:00:00 2001
From: Sean Farrell <sean.farrell@rioki.org>
Date: Thu, 23 Feb 2023 08:15:37 +0100
Subject: [PATCH] Use vcpkg's gumbo
---
CMakeLists.txt | 8 ++------
cmake/litehtmlConfig.cmake | 2 +-
src/document.cpp | 2 +-
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fe71729..21e77c8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,11 +10,7 @@ enable_testing()
set(PROJECT_MAJOR 0)
set(PROJECT_MINOR 0)
-option(EXTERNAL_GUMBO "Link against external gumbo instead of shipping a bundled copy" OFF)
-
-if(NOT EXTERNAL_GUMBO)
- add_subdirectory(src/gumbo)
-endif()
+find_package(unofficial-gumbo CONFIG REQUIRED)
set(SOURCE_LITEHTML
src/background.cpp
@@ -153,7 +149,7 @@ if (LITEHTML_UTF8)
endif()
# Gumbo
-target_link_libraries(${PROJECT_NAME} PUBLIC gumbo)
+target_link_libraries(${PROJECT_NAME} PRIVATE unofficial::gumbo::gumbo)
# install and export
install(TARGETS ${PROJECT_NAME}
diff --git a/cmake/litehtmlConfig.cmake b/cmake/litehtmlConfig.cmake
index 5eedcf4..1027913 100644
--- a/cmake/litehtmlConfig.cmake
+++ b/cmake/litehtmlConfig.cmake
@@ -1,3 +1,3 @@
include(CMakeFindDependencyMacro)
-find_dependency(gumbo)
+find_dependency(unofficial-gumbo)
include(${CMAKE_CURRENT_LIST_DIR}/litehtmlTargets.cmake)
diff --git a/src/document.cpp b/src/document.cpp
index 8bd1ea8..51a9d42 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -26,7 +26,7 @@
#include <cstdio>
#include <algorithm>
#include <functional>
-#include "gumbo.h"
+#include <gumbo.h>
#include "utf8_strings.h"
litehtml::document::document(litehtml::document_container* objContainer, litehtml::context* ctx)
--
2.33.0.windows.2

View File

@ -1,10 +1,12 @@
{
"name": "litehtml",
"version": "0.6.0",
"description": "litehtml is the lightweight HTML rendering engine with CSS2/CSS3 support. ",
"port-version": 1,
"description": "litehtml is the lightweight HTML rendering engine with CSS2/CSS3 support.",
"homepage": "https://github.com/litehtml/litehtml",
"license": "BSD-3-Clause",
"dependencies": [
"gumbo",
{
"name": "vcpkg-cmake",
"host": true

View File

@ -2950,7 +2950,7 @@
},
"gumbo": {
"baseline": "0.10.1",
"port-version": 5
"port-version": 6
},
"gzip-hpp": {
"baseline": "0.1.0",
@ -4734,7 +4734,7 @@
},
"litehtml": {
"baseline": "0.6.0",
"port-version": 0
"port-version": 1
},
"live555": {
"baseline": "2023-01-19",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "b0b57c7286bdadcc64d0e4b2f5b5aca951bb1749",
"version": "0.10.1",
"port-version": 6
},
{
"git-tree": "33203d45b5dcbc9d4bb0175691909a4e9c930d81",
"version": "0.10.1",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "2f2981f2edef7c5f69ba42716c007822f74e99ae",
"version": "0.6.0",
"port-version": 1
},
{
"git-tree": "64b99f7658dac91ee9c3ed9749b0fd3718f3a4a9",
"version": "0.6.0",