feat: ports - zlib, libwapcaplet, libparserutils

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:11:55 +02:00
co-authored by Claude Opus 5
parent 48e97f4e09
commit acb169e2c4
13 changed files with 358 additions and 4 deletions
+35
View File
@@ -0,0 +1,35 @@
# libparserutils for MontaukOS
#
# Upstream: https://github.com/netsurf-browser/libparserutils (official mirror
# of git.netsurf-browser.org; submodule at upstream/, pinned, no local patches).
#
# Input streams, buffers and charset conversion -- the base every other
# NetSurf parsing library sits on (libhubbub, libcss, libdom).
#
# Built WITHOUT_ICONV_FILTER, an upstream-supported switch: src/input/filter.c
# otherwise wants <iconv.h>, which MontaukOS has no port of. That leaves the
# library's own charset codecs (ascii, 8859, ext8, utf8, utf16), which covers
# UTF-8 and the Latin encodings. Exotic ones (Shift-JIS, Big5, ...) are
# unsupported until something ports iconv.
UPSTREAM := upstream
PORT_NAME := libparserutils
PORT_LIB := 1
PORT_ARCHIVE := libparserutils.a
PORT_HEADER_ROOT := $(UPSTREAM)/include
PORT_HEADERS := $(shell find $(UPSTREAM)/include -name '*.h' 2>/dev/null)
include ../../mk/port.mk
NS_CFLAGS_EXTRA := -DWITHOUT_ICONV_FILTER
.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),parserutils)
clean: clean-lib
@$(call ns_clean,$(UPSTREAM))
rm -rf $(UPSTREAM)/$(NS_BUILDDIR)
+28
View File
@@ -0,0 +1,28 @@
# libwapcaplet for MontaukOS
#
# Upstream: https://github.com/netsurf-browser/libwapcaplet (official mirror of
# git.netsurf-browser.org; submodule at upstream/, pinned, no local patches).
#
# Interned string handling. The smallest NetSurf library and the first one
# ported, chosen to prove their buildsystem cross-compiles for x86_64-montauk.
# It does, unpatched -- see the NetSurf section of mk/port.mk.
UPSTREAM := upstream
PORT_NAME := libwapcaplet
PORT_LIB := 1
PORT_ARCHIVE := libwapcaplet.a
PORT_HEADER_ROOT := $(UPSTREAM)/include
PORT_HEADERS := $(UPSTREAM)/include/libwapcaplet/libwapcaplet.h
include ../../mk/port.mk
.PHONY: all clean
all: install-lib
$(PORT_ARCHIVE): $(wildcard $(UPSTREAM)/src/*.c $(UPSTREAM)/include/libwapcaplet/*.h)
$(call ns_build,$(UPSTREAM),wapcaplet)
clean: clean-lib
@$(call ns_clean,$(UPSTREAM))
rm -rf $(UPSTREAM)/$(NS_BUILDDIR)
+51
View File
@@ -0,0 +1,51 @@
# zlib for MontaukOS
#
# Upstream: https://github.com/madler/zlib (submodule at upstream/, pinned to
# v1.3.1; no local patches). Needed by NetSurf for gzip Content-Encoding, and
# by libpng.
#
# DYNAMIC_CRC_TABLE is deliberately NOT defined: it pulls in <stdatomic.h> and
# a runtime once() init, where the default path uses the checked-in static CRC
# tables in crc32.h. Deterministic and one less dependency.
UPSTREAM := upstream
PORT_NAME := zlib
PORT_LIB := 1
PORT_ARCHIVE := libz.a
PORT_HEADER_ROOT := $(UPSTREAM)
PORT_HEADERS := $(UPSTREAM)/zlib.h $(UPSTREAM)/zconf.h
include ../../mk/port.mk
CFLAGS := \
-std=gnu11 \
$(PORT_CFLAGS_COMMON) \
-Wall \
-Wno-implicit-fallthrough \
-DHAVE_UNISTD_H \
-DHAVE_STDARG_H \
-I $(UPSTREAM) \
-isystem $(shell $(CC) -print-file-name=include)
SRCS := \
adler32.c compress.c crc32.c deflate.c gzclose.c gzlib.c gzread.c \
gzwrite.c infback.c inffast.c inflate.c inftrees.c trees.c uncompr.c \
zutil.c
OBJS := $(addprefix $(OBJDIR)/,$(SRCS:.c=.o))
.PHONY: all clean
all: install-lib
$(PORT_ARCHIVE): $(OBJS)
$(AR) rcs $@ $(OBJS)
@echo "Built: $@"
$(OBJDIR)/%.o: $(UPSTREAM)/%.c Makefile
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
clean: clean-lib
-include $(OBJS:.o=.d)