libhubbub: add package (#5378)

* libhubbub: add package

* gperf: enable bsd

* libhubbub: improve gperf

* gperf: enable msys

* gperf: fix bsd build

* fix patch

* libhubbub: improve gperf
pull/5381/head
star9029 2 months ago committed by GitHub
parent 52807da729
commit 860c4b3a6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      packages/g/gperf/xmake.lua
  2. 20
      packages/l/libhubbub/patches/0.3.8/treebuilder.patch
  3. 38
      packages/l/libhubbub/port/xmake.lua
  4. 35
      packages/l/libhubbub/xmake.lua
  5. 16
      packages/l/libparserutils/patches/0.2.5/uninitialised-variable.patch
  6. 28
      packages/l/libparserutils/port/xmake.lua
  7. 27
      packages/l/libparserutils/xmake.lua

@ -1,11 +1,12 @@
package("gperf")
set_kind("binary")
set_homepage("https://www.gnu.org/software/gperf")
set_description("Perfect hash function generator.")
set_license("GPL-3.0-or-later")
set_urls("https://ftpmirror.gnu.org/gnu/gperf/gperf-$(version).tar.gz",
"https://ftp.gnu.org/gnu/gperf/gperf-$(version).tar.gz")
add_versions("3.1", "588546b945bba4b70b6a3a616e80b4ab466e3f33024a352fc2198112cdbb3ae2")
if is_host("linux") then
@ -24,7 +25,9 @@ package("gperf")
import("package.tools.xmake").install(package)
end)
on_install("@macosx", "@linux", function (package)
on_install("@macosx", "@linux", "@bsd", "@msys", function (package)
io.replace("lib/getline.cc", "register", "", {plain = true})
io.replace("lib/getopt.c", "register", "", {plain = true})
import("package.tools.autoconf").install(package)
end)

@ -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…
Cancel
Save