diff --git a/.gitmodules b/.gitmodules index 5d29021..26c5932 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,3 +22,21 @@ [submodule "net-libs/libdom/upstream"] path = net-libs/libdom/upstream 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 diff --git a/Makefile b/Makefile index 7020008..189e1eb 100644 --- a/Makefile +++ b/Makefile @@ -28,9 +28,15 @@ PORTS := \ dev-libs/zlib \ dev-libs/libwapcaplet \ dev-libs/libparserutils \ + dev-libs/libnsutils \ + dev-libs/libnslog \ + dev-libs/libutf8proc \ net-libs/libhubbub \ net-libs/libcss \ net-libs/libdom \ + net-libs/libnspsl \ + media-libs/libnsgif \ + media-libs/libnsbmp \ games-fps/doom # Bundle directories are keyed by port name, not category path. diff --git a/dev-libs/libnslog/Makefile b/dev-libs/libnslog/Makefile new file mode 100644 index 0000000..2a1518f --- /dev/null +++ b/dev-libs/libnslog/Makefile @@ -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) diff --git a/dev-libs/libnslog/upstream b/dev-libs/libnslog/upstream new file mode 160000 index 0000000..bedff21 --- /dev/null +++ b/dev-libs/libnslog/upstream @@ -0,0 +1 @@ +Subproject commit bedff2146270a8a73cc265bab46ec39f9c170d07 diff --git a/dev-libs/libnsutils/Makefile b/dev-libs/libnsutils/Makefile new file mode 100644 index 0000000..13053ae --- /dev/null +++ b/dev-libs/libnsutils/Makefile @@ -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) diff --git a/dev-libs/libnsutils/upstream b/dev-libs/libnsutils/upstream new file mode 160000 index 0000000..0bd3906 --- /dev/null +++ b/dev-libs/libnsutils/upstream @@ -0,0 +1 @@ +Subproject commit 0bd39060740b6163bd50875326654a722df97eb2 diff --git a/dev-libs/libutf8proc/Makefile b/dev-libs/libutf8proc/Makefile new file mode 100644 index 0000000..8e41148 --- /dev/null +++ b/dev-libs/libutf8proc/Makefile @@ -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) diff --git a/dev-libs/libutf8proc/upstream b/dev-libs/libutf8proc/upstream new file mode 160000 index 0000000..0d22740 --- /dev/null +++ b/dev-libs/libutf8proc/upstream @@ -0,0 +1 @@ +Subproject commit 0d22740b0de2636307cb95c928b244263ed17caa diff --git a/media-libs/libnsbmp/Makefile b/media-libs/libnsbmp/Makefile new file mode 100644 index 0000000..9da4dd0 --- /dev/null +++ b/media-libs/libnsbmp/Makefile @@ -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) diff --git a/media-libs/libnsbmp/upstream b/media-libs/libnsbmp/upstream new file mode 160000 index 0000000..ea063c9 --- /dev/null +++ b/media-libs/libnsbmp/upstream @@ -0,0 +1 @@ +Subproject commit ea063c9f46acb43e90208da14073332b505ef7e7 diff --git a/media-libs/libnsgif/Makefile b/media-libs/libnsgif/Makefile new file mode 100644 index 0000000..de70e93 --- /dev/null +++ b/media-libs/libnsgif/Makefile @@ -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) diff --git a/media-libs/libnsgif/upstream b/media-libs/libnsgif/upstream new file mode 160000 index 0000000..22e99eb --- /dev/null +++ b/media-libs/libnsgif/upstream @@ -0,0 +1 @@ +Subproject commit 22e99eb6818b1284d0f3ff1b7f46159e87221220 diff --git a/net-libs/libnspsl/Makefile b/net-libs/libnspsl/Makefile new file mode 100644 index 0000000..d809047 --- /dev/null +++ b/net-libs/libnspsl/Makefile @@ -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) diff --git a/net-libs/libnspsl/upstream b/net-libs/libnspsl/upstream new file mode 160000 index 0000000..82815c2 --- /dev/null +++ b/net-libs/libnspsl/upstream @@ -0,0 +1 @@ +Subproject commit 82815c2bc7fd70d1b6afccfa89a9a0f3fa73db8a diff --git a/test/Makefile b/test/Makefile index 588add3..97f141f 100644 --- a/test/Makefile +++ b/test/Makefile @@ -25,6 +25,12 @@ SYSROOT_LIBS := \ $(PORT_SYSROOT_LIB)/libhubbub.a \ $(PORT_SYSROOT_LIB)/libparserutils.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 TEST_ELF := $(OUTDIR)/test/porttest.elf diff --git a/test/porttest.c b/test/porttest.c index 59e242a..23c0893 100644 --- a/test/porttest.c +++ b/test/porttest.c @@ -6,6 +6,10 @@ #include #include #include +#include +#include +#include +#include #include #include #include @@ -19,6 +23,17 @@ static css_error pt_resolve_url(void *pw, const char *base, 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) { lwc_string *a = NULL, *b = NULL; bool same = false; @@ -110,6 +125,27 @@ int main(void) { 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); parserutils_buffer_destroy(buf); return 0;