libhubbub: add package (#5378)
* libhubbub: add package * gperf: enable bsd * libhubbub: improve gperf * gperf: enable msys * gperf: fix bsd build * fix patch * libhubbub: improve gperfpull/5381/head
parent
52807da729
commit
860c4b3a6d
7 changed files with 169 additions and 2 deletions
@ -0,0 +1,20 @@ |
||||
diff --git a/0.3.8/src/treebuilder/in_row.c b/0.3.8/src/treebuilder/in_row.c
|
||||
index 3bf9161..43b9dac 100644
|
||||
--- a/0.3.8/src/treebuilder/in_row.c
|
||||
+++ b/0.3.8/src/treebuilder/in_row.c
|
||||
@@ -57,10 +57,12 @@ static hubbub_error act_as_if_end_tag_tr(hubbub_treebuilder *treebuilder)
|
||||
|
||||
table_clear_stack(treebuilder);
|
||||
|
||||
- element_stack_pop(treebuilder, &ns, &otype, &node);
|
||||
+ if (current_node(treebuilder) != HTML) {
|
||||
+ element_stack_pop(treebuilder, &ns, &otype, &node);
|
||||
|
||||
- treebuilder->tree_handler->unref_node(treebuilder->tree_handler->ctx,
|
||||
- node);
|
||||
+ treebuilder->tree_handler->unref_node(
|
||||
+ treebuilder->tree_handler->ctx, node);
|
||||
+ }
|
||||
|
||||
treebuilder->context.mode = IN_TABLE_BODY;
|
||||
|
@ -0,0 +1,38 @@ |
||||
add_rules("mode.debug", "mode.release") |
||||
|
||||
if is_subhost("windows") then |
||||
add_requires("strawberry-perl") |
||||
add_packages("strawberry-perl") |
||||
end |
||||
add_requires("gperf") |
||||
add_packages("gperf") |
||||
|
||||
add_requires("libparserutils") |
||||
add_packages("libparserutils") |
||||
if is_plat("windows") then |
||||
add_requires("strings_h") |
||||
add_packages("strings_h") |
||||
end |
||||
|
||||
target("hubbub") |
||||
set_kind("$(kind)") |
||||
add_files("src/**.c") |
||||
add_includedirs("include", "src") |
||||
add_headerfiles("include/(hubbub/*.h)") |
||||
|
||||
if is_plat("windows") and is_kind("shared") then |
||||
add_rules("utils.symbols.export_all") |
||||
end |
||||
|
||||
before_build(function (target) |
||||
local perl, gperf |
||||
if is_subhost("windows") then |
||||
perl = path.join(target:pkg("strawberry-perl"):installdir(), "perl/bin/perl.exe") |
||||
gperf = path.join(target:pkg("gperf"):installdir(), "bin/gperf.exe") |
||||
else |
||||
perl = "perl" |
||||
gperf = "gperf" |
||||
end |
||||
os.vrunv(perl, {"build/make-entities.pl"}) |
||||
os.vrunv(gperf, {"src/treebuilder/element-type.gperf", "--output-file=src/treebuilder/autogenerated-element-type.c"}) |
||||
end) |
@ -0,0 +1,35 @@ |
||||
package("libhubbub") |
||||
set_homepage("https://www.netsurf-browser.org/projects/libhubbub") |
||||
set_description("Hubbub is an HTML5 compliant parsing library") |
||||
set_license("MIT") |
||||
|
||||
set_urls("https://source.netsurf-browser.org/libhubbub.git/snapshot/libhubbub-release/$(version).tar.bz2", |
||||
"https://git.netsurf-browser.org/libhubbub.git") |
||||
|
||||
add_versions("0.3.8", "570f2aef99071e0c24d16444b74884d611f46b264bbfb6e314039c9786e87160") |
||||
|
||||
add_patches("0.3.8", "patches/0.3.8/treebuilder.patch", "c966decf79bcd0bbca4fe6c4ccdba776b9b9b3551a5956a894f14a55ec21eb72") |
||||
|
||||
add_deps("libparserutils") |
||||
if is_plat("windows") then |
||||
add_deps("strings_h", {private = true}) |
||||
end |
||||
|
||||
on_load(function (package) |
||||
if not package:is_precompiled() then |
||||
package:add("deps", "gperf") |
||||
if is_subhost("windows") then |
||||
package:add("deps", "strawberry-perl") |
||||
end |
||||
end |
||||
end) |
||||
|
||||
on_install(function (package) |
||||
os.cd(package:version_str()) |
||||
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua") |
||||
import("package.tools.xmake").install(package) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:has_cfuncs("hubbub_error_to_string", {includes = "hubbub/hubbub.h"})) |
||||
end) |
@ -0,0 +1,16 @@ |
||||
diff --git a/0.2.5/src/charset/codecs/codec_utf8.c b/0.2.5/src/charset/codecs/codec_utf8.c
|
||||
index 6117fe6..39bdb28 100644
|
||||
--- a/0.2.5/src/charset/codecs/codec_utf8.c
|
||||
+++ b/0.2.5/src/charset/codecs/codec_utf8.c
|
||||
@@ -409,8 +409,8 @@ parserutils_error charset_utf8_codec_read_char(charset_utf8_codec *c,
|
||||
const uint8_t **source, size_t *sourcelen,
|
||||
uint8_t **dest, size_t *destlen)
|
||||
{
|
||||
- uint32_t ucs4;
|
||||
- size_t sucs4;
|
||||
+ uint32_t ucs4 = 0;
|
||||
+ size_t sucs4 = 0;
|
||||
parserutils_error error;
|
||||
|
||||
/* Convert a single character */
|
||||
|
@ -0,0 +1,28 @@ |
||||
add_rules("mode.debug", "mode.release") |
||||
|
||||
if is_subhost("windows") then |
||||
add_requires("strawberry-perl") |
||||
add_packages("strawberry-perl") |
||||
end |
||||
|
||||
add_defines("WITHOUT_ICONV_FILTER") |
||||
|
||||
target("parserutils") |
||||
set_kind("$(kind)") |
||||
add_files("src/**.c") |
||||
add_includedirs("include", "src") |
||||
add_headerfiles("include/(parserutils/**.h)") |
||||
|
||||
if is_plat("windows") and is_kind("shared") then |
||||
add_rules("utils.symbols.export_all") |
||||
end |
||||
|
||||
before_build(function (target) |
||||
local perl |
||||
if is_subhost("windows") then |
||||
perl = path.join(target:pkg("strawberry-perl"):installdir(), "perl/bin/perl.exe") |
||||
else |
||||
perl = "perl" |
||||
end |
||||
os.vrunv(perl, {"build/make-aliases.pl"}) |
||||
end) |
@ -0,0 +1,27 @@ |
||||
package("libparserutils") |
||||
set_homepage("https://www.netsurf-browser.org/projects/libparserutils") |
||||
set_description("LibParserUtils is a library for building efficient parsers") |
||||
set_license("MIT") |
||||
|
||||
set_urls("https://source.netsurf-browser.org/libparserutils.git/snapshot/libparserutils-release/$(version).tar.bz2", |
||||
"https://git.netsurf-browser.org/libparserutils.git") |
||||
|
||||
add_versions("0.2.5", "816f0cb3281c6f6a6cc974ba00c3975fe91ab1425125aa9af64903065d2a36ec") |
||||
|
||||
add_patches("0.2.5", "patches/0.2.5/uninitialised-variable.patch", "1f9f6b7e0444f1bcb4e13684cc5e3660d33ab30db5e7d995e7644bc8b3fda3ff") |
||||
|
||||
on_load(function (package) |
||||
if is_subhost("windows") and not package:is_precompiled() then |
||||
package:add("deps", "strawberry-perl") |
||||
end |
||||
end) |
||||
|
||||
on_install(function (package) |
||||
os.cd(package:version_str()) |
||||
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua") |
||||
import("package.tools.xmake").install(package) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:has_cfuncs("parserutils_error_to_string", {includes = "parserutils/parserutils.h"})) |
||||
end) |
Loading…
Reference in new issue