From c7e2caa4d6c0b76fb66cec36e063444366258886 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sat, 11 Jan 2025 01:01:39 +0100 Subject: [PATCH] package created using the webbuild interface [release 0.4.2-1mamba;Fri Jan 03 2025] --- README.md | 2 ++ libdom-0.4.2-gcc-14.patch | 60 +++++++++++++++++++++++++++++++++++++ libdom.spec | 62 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 124 insertions(+) create mode 100644 libdom-0.4.2-gcc-14.patch create mode 100644 libdom.spec diff --git a/README.md b/README.md index 09787e5..92e0698 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # libdom +LibDOM is an implementation of the W3C DOM, written in C. + diff --git a/libdom-0.4.2-gcc-14.patch b/libdom-0.4.2-gcc-14.patch new file mode 100644 index 0000000..72d3e34 --- /dev/null +++ b/libdom-0.4.2-gcc-14.patch @@ -0,0 +1,60 @@ +From 2687282d56dfef19e26e9639a5c0cd81de957e22 Mon Sep 17 00:00:00 2001 +From: Peter Shkenev +Date: Sat, 10 Aug 2024 14:01:59 +0100 +Subject: fixes libdom build on gcc 14 due to calloc-transposed-args warning + +--- + bindings/xml/expat_xmlparser.c | 2 +- + src/core/node.c | 2 +- + src/html/html_document.c | 5 ++--- + 3 files changed, 4 insertions(+), 5 deletions(-) + +diff --git a/bindings/xml/expat_xmlparser.c b/bindings/xml/expat_xmlparser.c +index a63ccf1..ba5b4e7 100644 +--- a/bindings/xml/expat_xmlparser.c ++++ b/bindings/xml/expat_xmlparser.c +@@ -484,7 +484,7 @@ dom_xml_parser_create(const char *enc, const char *int_enc, + + UNUSED(int_enc); + +- parser = calloc(sizeof(*parser), 1); ++ parser = calloc(1, sizeof(*parser)); + if (parser == NULL) { + msg(DOM_MSG_CRITICAL, mctx, "No memory for parser"); + return NULL; +diff --git a/src/core/node.c b/src/core/node.c +index da179c3..9eabd2f 100644 +--- a/src/core/node.c ++++ b/src/core/node.c +@@ -2379,7 +2379,7 @@ static inline dom_exception _dom_event_targets_expand( + if (t == NULL) { + /* Create the event target list */ + size = 64; +- t = calloc(sizeof(*t), size); ++ t = calloc(size, sizeof(*t)); + if (t == NULL) { + return DOM_NO_MEM_ERR; + } +diff --git a/src/html/html_document.c b/src/html/html_document.c +index cf3c25d..71b693a 100644 +--- a/src/html/html_document.c ++++ b/src/html/html_document.c +@@ -134,13 +134,12 @@ dom_exception _dom_html_document_initialise(dom_html_document *doc, + doc->cookie = NULL; + doc->body = NULL; + +- doc->memoised = calloc(sizeof(dom_string *), hds_COUNT); ++ doc->memoised = calloc(hds_COUNT, sizeof(dom_string *)); + if (doc->memoised == NULL) { + error = DOM_NO_MEM_ERR; + goto out; + } +- doc->elements = calloc(sizeof(dom_string *), +- DOM_HTML_ELEMENT_TYPE__COUNT); ++ doc->elements = calloc(DOM_HTML_ELEMENT_TYPE__COUNT, sizeof(dom_string *)); + if (doc->elements == NULL) { + error = DOM_NO_MEM_ERR; + goto out; +-- +cgit v1.2.3 + diff --git a/libdom.spec b/libdom.spec new file mode 100644 index 0000000..e77628e --- /dev/null +++ b/libdom.spec @@ -0,0 +1,62 @@ +Name: libdom +Version: 0.4.2 +Release: 1mamba +Summary: Document Object Model library +Group: System/Libraries +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: https://www.netsurf-browser.org/projects/libdom/ +Source: https://git.netsurf-browser.org/libdom.git/release%2F%{version}/libdom-%{version}.tar.bz2 +Patch0: libdom-0.4.2-gcc-14.patch +License: MIT +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +BuildRequires: libexpat-devel +BuildRequires: libhubbub-devel +BuildRequires: libparserutils-devel +BuildRequires: libwapcaplet-devel +## AUTOBUILDREQ-END +BuildRequires: netsurf-buildsystem + +%description +LibDOM is an implementation of the W3C DOM, written in C. + +%package devel +Group: Development/Libraries +Summary: Development files for %{name} +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} + +%description devel +This package contains libraries and header files for developing applications that use %{name}. + +%prep +%setup -q +%patch 0 -p1 -b .gcc-14 + +%build +%make COMPONENT_TYPE=lib-shared INCLUDEDIR=include LIBDIR=%{_lib} PREFIX=%{_prefix} + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%makeinstall COMPONENT_TYPE=lib-shared INCLUDEDIR=include LIBDIR=%{_lib} PREFIX=%{_prefix} + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%files +%defattr(-,root,root) +%{_libdir}/libdom.so.* +%doc COPYING + +%files devel +%defattr(-,root,root) +%dir %{_includedir}/dom +%{_includedir}/dom/* +%{_libdir}/libdom.so +%{_libdir}/pkgconfig/libdom.pc +%doc README + +%changelog +* Fri Jan 03 2025 Silvan Calarco 0.4.2-1mamba +- package created using the webbuild interface