add litehtml (#1789)

* add litehtml

* add gumbo

* improve gumbo

* fix gumbo for windows

* fix gumbo for windows

* fix litehtml
pull/1791/head
ruki 2 years ago committed by GitHub
parent 6a862af16b
commit 0f348266fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 33
      packages/g/gumbo-parser/xmake.lua
  2. 31
      packages/l/litehtml/xmake.lua

@ -0,0 +1,33 @@
package("gumbo-parser")
set_homepage("https://github.com/google/gumbo-parser")
set_description("An HTML5 parsing library in pure C99")
set_license("Apache-2.0")
add_urls("https://github.com/google/gumbo-parser/archive/refs/tags/$(version).tar.gz",
"https://github.com/google/gumbo-parser.git")
add_versions("v0.10.1", "28463053d44a5dfbc4b77bcf49c8cee119338ffa636cc17fc3378421d714efad")
on_install(function (package)
io.writefile("xmake.lua", [[
add_rules("mode.debug", "mode.release")
target("gumbo")
set_kind("$(kind)")
add_files("src/*.c")
add_headerfiles("src/*.h")
if is_plat("windows") then
add_includedirs("visualc/include")
if is_kind("shared") then
add_rules("utils.symbols.export_all", {export_classes = true})
end
end
]])
local configs = {}
if package:config("shared") then
configs.kind = "shared"
end
import("package.tools.xmake").install(package, configs)
end)
on_test(function (package)
assert(package:has_cfuncs("gumbo_parse_with_options", {includes = "gumbo.h"}))
end)

@ -0,0 +1,31 @@
package("litehtml")
set_homepage("http://www.litehtml.com/")
set_description("Fast and lightweight HTML/CSS rendering engine")
add_urls("https://github.com/litehtml/litehtml.git")
add_versions("2023.01.05", "1e803393bdc8e586e8eefd4c33973e04994bb288")
add_deps("cmake", "gumbo-parser")
on_install(function (package)
local configs = {"-DBUILD_TESTING=OFF", "-DEXTERNAL_GUMBO=ON"}
if package:is_plat("windows") and package:config("shared") then
table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
end
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
import("package.tools.cmake").install(package, configs, {packagedeps = "gumbo-parser"})
os.cp("include/litehtml.h", package:installdir("include"))
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include <string>
#include <litehtml.h>
using namespace litehtml;
void test() {
css_element_selector selector;
selector.parse(".class");
}
]]}, {configs = {languages = "c++11"}}))
end)
Loading…
Cancel
Save