feat: ports - libnsutils, libnslog, libutf8proc, libnspsl, libnsgif, libnsbmp

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018Ae69wJS7sueQMUwNxV3nX
This commit is contained in:
2026-08-07 20:28:37 +02:00
co-authored by Claude Opus 5
parent f1d17b62c1
commit d14c8565d3
16 changed files with 251 additions and 0 deletions
+18
View File
@@ -22,3 +22,21 @@
[submodule "net-libs/libdom/upstream"] [submodule "net-libs/libdom/upstream"]
path = net-libs/libdom/upstream path = net-libs/libdom/upstream
url = https://github.com/netsurf-browser/libdom.git url = https://github.com/netsurf-browser/libdom.git
[submodule "dev-libs/libnsutils/upstream"]
path = dev-libs/libnsutils/upstream
url = https://github.com/netsurf-browser/libnsutils.git
[submodule "dev-libs/libnslog/upstream"]
path = dev-libs/libnslog/upstream
url = https://github.com/netsurf-browser/libnslog.git
[submodule "net-libs/libnspsl/upstream"]
path = net-libs/libnspsl/upstream
url = https://github.com/netsurf-browser/libnspsl.git
[submodule "media-libs/libnsgif/upstream"]
path = media-libs/libnsgif/upstream
url = https://github.com/netsurf-browser/libnsgif.git
[submodule "media-libs/libnsbmp/upstream"]
path = media-libs/libnsbmp/upstream
url = https://github.com/netsurf-browser/libnsbmp.git
[submodule "dev-libs/libutf8proc/upstream"]
path = dev-libs/libutf8proc/upstream
url = git://git.netsurf-browser.org/libutf8proc.git
+6
View File
@@ -28,9 +28,15 @@ PORTS := \
dev-libs/zlib \ dev-libs/zlib \
dev-libs/libwapcaplet \ dev-libs/libwapcaplet \
dev-libs/libparserutils \ dev-libs/libparserutils \
dev-libs/libnsutils \
dev-libs/libnslog \
dev-libs/libutf8proc \
net-libs/libhubbub \ net-libs/libhubbub \
net-libs/libcss \ net-libs/libcss \
net-libs/libdom \ net-libs/libdom \
net-libs/libnspsl \
media-libs/libnsgif \
media-libs/libnsbmp \
games-fps/doom games-fps/doom
# Bundle directories are keyed by port name, not category path. # Bundle directories are keyed by port name, not category path.
+29
View File
@@ -0,0 +1,29 @@
# libnslog for MontaukOS
#
# Upstream: https://github.com/netsurf-browser/libnslog (official mirror of
# git.netsurf-browser.org) (submodule at
# upstream/, pinned, no local patches).
#
# Filtered logging used by the browser core.
UPSTREAM := upstream
PORT_NAME := libnslog
PORT_LIB := 1
PORT_ARCHIVE := libnslog.a
PORT_PC_IN := $(UPSTREAM)/libnslog.pc.in
PORT_PC_VERSION := 0.1.3
PORT_HEADER_ROOT := $(UPSTREAM)/include
PORT_HEADERS := $(shell find $(UPSTREAM)/include -name '*.h' 2>/dev/null)
include ../../mk/port.mk
.PHONY: all clean
all: install-lib
$(PORT_ARCHIVE): $(shell find $(UPSTREAM)/src $(UPSTREAM)/include -name '*.c' -o -name '*.h' 2>/dev/null)
$(call ns_build,$(UPSTREAM),nslog)
clean: clean-lib
@$(call ns_clean,$(UPSTREAM))
rm -rf $(UPSTREAM)/$(NS_BUILDDIR)
+30
View File
@@ -0,0 +1,30 @@
# libnsutils for MontaukOS
#
# Upstream: https://github.com/netsurf-browser/libnsutils (official mirror of
# git.netsurf-browser.org) (submodule at
# upstream/, pinned, no local patches).
#
# Assorted small utilities (time, base64) shared across NetSurf.
# A hard requirement of the browser core.
UPSTREAM := upstream
PORT_NAME := libnsutils
PORT_LIB := 1
PORT_ARCHIVE := libnsutils.a
PORT_PC_IN := $(UPSTREAM)/libnsutils.pc.in
PORT_PC_VERSION := 0.1.1
PORT_HEADER_ROOT := $(UPSTREAM)/include
PORT_HEADERS := $(shell find $(UPSTREAM)/include -name '*.h' 2>/dev/null)
include ../../mk/port.mk
.PHONY: all clean
all: install-lib
$(PORT_ARCHIVE): $(shell find $(UPSTREAM)/src $(UPSTREAM)/include -name '*.c' -o -name '*.h' 2>/dev/null)
$(call ns_build,$(UPSTREAM),nsutils)
clean: clean-lib
@$(call ns_clean,$(UPSTREAM))
rm -rf $(UPSTREAM)/$(NS_BUILDDIR)
+32
View File
@@ -0,0 +1,32 @@
# libutf8proc for MontaukOS
#
# Upstream: git://git.netsurf-browser.org/libutf8proc.git (submodule at
# upstream/, pinned, no local patches).
#
# NetSurf's fork of utf8proc, used only by utils/idna.c for international
# domain names. NOTE: upstream is NetSurf's own server over git:// -- there is
# no GitHub mirror and no https endpoint, so this submodule is fetched over an
# unauthenticated protocol. NetSurf builds fine without it
# (NETSURF_USE_UTF8PROC=NO), at the cost of IDN handling.
UPSTREAM := upstream
PORT_NAME := libutf8proc
PORT_LIB := 1
PORT_ARCHIVE := libutf8proc.a
PORT_PC_IN := $(UPSTREAM)/libutf8proc.pc.in
PORT_PC_VERSION := 2.4.0-1
PORT_HEADER_ROOT := $(UPSTREAM)/include
PORT_HEADERS := $(shell find $(UPSTREAM)/include -name '*.h' 2>/dev/null)
include ../../mk/port.mk
.PHONY: all clean
all: install-lib
$(PORT_ARCHIVE): $(shell find $(UPSTREAM)/src $(UPSTREAM)/include -name '*.c' -o -name '*.h' 2>/dev/null)
$(call ns_build,$(UPSTREAM),utf8proc)
clean: clean-lib
@$(call ns_clean,$(UPSTREAM))
rm -rf $(UPSTREAM)/$(NS_BUILDDIR)
+29
View File
@@ -0,0 +1,29 @@
# libnsbmp for MontaukOS
#
# Upstream: https://github.com/netsurf-browser/libnsbmp (official mirror of
# git.netsurf-browser.org) (submodule at
# upstream/, pinned, no local patches).
#
# BMP and ICO decoder. Self-contained.
UPSTREAM := upstream
PORT_NAME := libnsbmp
PORT_LIB := 1
PORT_ARCHIVE := libnsbmp.a
PORT_PC_IN := $(UPSTREAM)/libnsbmp.pc.in
PORT_PC_VERSION := 0.1.7
PORT_HEADER_ROOT := $(UPSTREAM)/include
PORT_HEADERS := $(shell find $(UPSTREAM)/include -name '*.h' 2>/dev/null)
include ../../mk/port.mk
.PHONY: all clean
all: install-lib
$(PORT_ARCHIVE): $(shell find $(UPSTREAM)/src $(UPSTREAM)/include -name '*.c' -o -name '*.h' 2>/dev/null)
$(call ns_build,$(UPSTREAM),nsbmp)
clean: clean-lib
@$(call ns_clean,$(UPSTREAM))
rm -rf $(UPSTREAM)/$(NS_BUILDDIR)
+29
View File
@@ -0,0 +1,29 @@
# libnsgif for MontaukOS
#
# Upstream: https://github.com/netsurf-browser/libnsgif (official mirror of
# git.netsurf-browser.org) (submodule at
# upstream/, pinned, no local patches).
#
# GIF decoder. Self-contained -- no zlib or libpng dependency.
UPSTREAM := upstream
PORT_NAME := libnsgif
PORT_LIB := 1
PORT_ARCHIVE := libnsgif.a
PORT_PC_IN := $(UPSTREAM)/libnsgif.pc.in
PORT_PC_VERSION := 1.0.0
PORT_HEADER_ROOT := $(UPSTREAM)/include
PORT_HEADERS := $(shell find $(UPSTREAM)/include -name '*.h' 2>/dev/null)
include ../../mk/port.mk
.PHONY: all clean
all: install-lib
$(PORT_ARCHIVE): $(shell find $(UPSTREAM)/src $(UPSTREAM)/include -name '*.c' -o -name '*.h' 2>/dev/null)
$(call ns_build,$(UPSTREAM),nsgif)
clean: clean-lib
@$(call ns_clean,$(UPSTREAM))
rm -rf $(UPSTREAM)/$(NS_BUILDDIR)
+30
View File
@@ -0,0 +1,30 @@
# libnspsl for MontaukOS
#
# Upstream: https://github.com/netsurf-browser/libnspsl (official mirror of
# git.netsurf-browser.org) (submodule at
# upstream/, pinned, no local patches).
#
# Public Suffix List lookup, used to decide cookie scope and what counts as a
# registrable domain.
UPSTREAM := upstream
PORT_NAME := libnspsl
PORT_LIB := 1
PORT_ARCHIVE := libnspsl.a
PORT_PC_IN := $(UPSTREAM)/libnspsl.pc.in
PORT_PC_VERSION := 0.1.7
PORT_HEADER_ROOT := $(UPSTREAM)/include
PORT_HEADERS := $(shell find $(UPSTREAM)/include -name '*.h' 2>/dev/null)
include ../../mk/port.mk
.PHONY: all clean
all: install-lib
$(PORT_ARCHIVE): $(shell find $(UPSTREAM)/src $(UPSTREAM)/include -name '*.c' -o -name '*.h' 2>/dev/null)
$(call ns_build,$(UPSTREAM),nspsl)
clean: clean-lib
@$(call ns_clean,$(UPSTREAM))
rm -rf $(UPSTREAM)/$(NS_BUILDDIR)
+6
View File
@@ -25,6 +25,12 @@ SYSROOT_LIBS := \
$(PORT_SYSROOT_LIB)/libhubbub.a \ $(PORT_SYSROOT_LIB)/libhubbub.a \
$(PORT_SYSROOT_LIB)/libparserutils.a \ $(PORT_SYSROOT_LIB)/libparserutils.a \
$(PORT_SYSROOT_LIB)/libwapcaplet.a \ $(PORT_SYSROOT_LIB)/libwapcaplet.a \
$(PORT_SYSROOT_LIB)/libnsutils.a \
$(PORT_SYSROOT_LIB)/libnslog.a \
$(PORT_SYSROOT_LIB)/libnspsl.a \
$(PORT_SYSROOT_LIB)/libnsgif.a \
$(PORT_SYSROOT_LIB)/libnsbmp.a \
$(PORT_SYSROOT_LIB)/libutf8proc.a \
$(PORT_SYSROOT_LIB)/libz.a $(PORT_SYSROOT_LIB)/libz.a
TEST_ELF := $(OUTDIR)/test/porttest.elf TEST_ELF := $(OUTDIR)/test/porttest.elf
+36
View File
@@ -6,6 +6,10 @@
#include <hubbub/parser.h> #include <hubbub/parser.h>
#include <libcss/libcss.h> #include <libcss/libcss.h>
#include <dom/dom.h> #include <dom/dom.h>
#include <nsutils/time.h>
#include <nsgif.h>
#include <libnsbmp.h>
#include <libutf8proc/utf8proc.h>
#include <zlib.h> #include <zlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -19,6 +23,17 @@ static css_error pt_resolve_url(void *pw, const char *base,
return CSS_OK; return CSS_OK;
} }
/* libnsgif needs a bitmap callback table; nothing is decoded here, so these
are only enough to satisfy nsgif_create(). */
static void *pt_bitmap_create(int w, int h) { (void) w; (void) h; return NULL; }
static void pt_bitmap_destroy(void *bm) { (void) bm; }
static uint8_t *pt_bitmap_get_buffer(void *bm) { (void) bm; return NULL; }
static const nsgif_bitmap_cb_vt pt_gif_bitmap_cbs = {
.create = pt_bitmap_create,
.destroy = pt_bitmap_destroy,
.get_buffer = pt_bitmap_get_buffer,
};
int main(void) { int main(void) {
lwc_string *a = NULL, *b = NULL; lwc_string *a = NULL, *b = NULL;
bool same = false; bool same = false;
@@ -110,6 +125,27 @@ int main(void) {
if (doc != NULL) dom_node_unref(doc); if (doc != NULL) dom_node_unref(doc);
} }
/* Support libraries: construct/query rather than just resolve symbols. */
{
uint64_t ms = 0;
nsgif_t *gif = NULL;
const utf8proc_property_t *prop;
printf("libnsutils: monotonic time %s\n",
(nsu_getmonotonic_ms(&ms) == NSUERROR_OK) ? "PASS" : "FAIL");
printf("libnsgif: create %s\n",
(nsgif_create(&pt_gif_bitmap_cbs, NSGIF_BITMAP_FMT_R8G8B8A8,
&gif) == NSGIF_OK && gif != NULL) ? "PASS" : "FAIL");
if (gif != NULL) nsgif_destroy(gif);
/* U+00E9 LATIN SMALL LETTER E WITH ACUTE -> category Ll */
prop = utf8proc_get_property(0x00E9);
printf("libutf8proc: property lookup %s\n",
(prop != NULL && prop->category == UTF8PROC_CATEGORY_LL)
? "PASS" : "FAIL");
}
lwc_string_unref(a); lwc_string_unref(b); lwc_string_unref(a); lwc_string_unref(b);
parserutils_buffer_destroy(buf); parserutils_buffer_destroy(buf);
return 0; return 0;