fix: update NetSurf port & montauk frontend to use new paths for fonts and icons
This commit is contained in:
1 parent
6f3cf99667
commit
35e3d1a0bb
21 files changed
+3376
-34
No files matched your search
+54
-30
@@ -1,22 +1,19 @@
|
||||
# NetSurf for MontaukOS -- monkey frontend
|
||||
# NetSurf for MontaukOS -- native window browser frontend
|
||||
#
|
||||
# Upstream: https://github.com/netsurf-browser/netsurf (official mirror of
|
||||
# git.netsurf-browser.org; submodule at upstream/, pinned).
|
||||
#
|
||||
# monkey is NetSurf's headless, script-driven frontend: it drives the full
|
||||
# browser core (HTML parse -> CSS cascade -> layout) and reports through a
|
||||
# line protocol on stdout instead of drawing. That makes it the right first
|
||||
# target -- no graphics, no fonts, and no fetcher required.
|
||||
# The port reuses NetSurf's compact monkey frontend glue, but MontaukOS builds
|
||||
# enter a native Window Server event loop with browser chrome and render into a
|
||||
# shared surface. The line-oriented monkey protocol remains available off-OS.
|
||||
#
|
||||
# CONFIGURATION
|
||||
# NETSURF_USE_CURL=NO no libcurl port; the built-in file/about/data
|
||||
# fetchers remain, which is enough for file:// URLs.
|
||||
# fetch_montauk will register alongside them later.
|
||||
# NETSURF_USE_OPENSSL=NO reached only through curl. BearSSL is the eventual
|
||||
# answer, via the fetcher rather than through here.
|
||||
# NETSURF_USE_CURL=NO no libcurl port; fetch_montauk uses MontaukOS DNS,
|
||||
# TCP, and the native BearSSL TLS helper.
|
||||
# NETSURF_USE_OPENSSL=NO HTTPS is implemented by fetch_montauk via BearSSL.
|
||||
# NETSURF_USE_DUKTAPE=NO no JavaScript; also avoids the nsgenbind host tool.
|
||||
# NETSURF_USE_PNG/JPEG/ no ports for these codecs yet. GIF and BMP are on,
|
||||
# JPEGXL/WEBP=NO since libnsgif and libnsbmp are in the sysroot.
|
||||
# NETSURF_USE_JPEG=YES enables the port-local stb_image JPEG/PNG handler.
|
||||
# JPEGXL/WEBP/SVG=NO those optional decoder libraries are not ported.
|
||||
# NETSURF_FS_BACKING_STORE=YES NOT optional for monkey: frontends/monkey/
|
||||
# main.c references filesystem_llcache_table
|
||||
# unconditionally, and that lives in
|
||||
@@ -48,17 +45,20 @@ include ../../mk/port.mk
|
||||
# dropped at the top of the checkout, not inside build/.
|
||||
NS_BUILD_OUT := $(UPSTREAM)/nsmonkey
|
||||
|
||||
# Where the binary and its resources land on MontaukOS. NetSurf cannot start
|
||||
# without its resources (Messages, default.css, quirks.css ...), so the
|
||||
# resource path is compiled in and the tree is installed alongside.
|
||||
NS_RESPATH := 0:/os/netsurf/
|
||||
NS_INSTALL := $(MONTAUKOS)/programs/bin/os
|
||||
# NetSurf cannot start without its resources (Messages, default.css,
|
||||
# quirks.css ...). Keep the compile-time fallback inside the app bundle; the
|
||||
# MontaukOS frontend normally derives this directory from argv[0] at runtime.
|
||||
NS_RESPATH := 0:/apps/netsurf/res/
|
||||
APP_INSTALL := $(MONTAUKOS)/programs/bin/apps/netsurf
|
||||
LEGACY_INSTALL := $(MONTAUKOS)/programs/bin/os
|
||||
|
||||
# libutf8proc installs its header to include/libutf8proc/ but its .pc
|
||||
# advertises only -I${includedir}, while utils/idna.c includes <utf8proc.h>.
|
||||
# Add the subdirectory here rather than staging a duplicate copy of the header.
|
||||
NETSURF_CFLAGS := \
|
||||
$(PORT_CFLAGS_COMMON) \
|
||||
-DWITH_MONTAUK_FETCHER \
|
||||
-DWITH_JPEG \
|
||||
-I $(COMPAT) \
|
||||
-I $(PORT_SYSROOT_INC)/libutf8proc
|
||||
|
||||
@@ -68,10 +68,11 @@ NETSURF_ARGS := \
|
||||
CC=$(CC) \
|
||||
AR=$(AR) \
|
||||
NETSURF_USE_CURL=NO \
|
||||
NETSURF_USE_MONTAUK=YES \
|
||||
NETSURF_USE_OPENSSL=NO \
|
||||
NETSURF_USE_DUKTAPE=NO \
|
||||
NETSURF_USE_PNG=NO \
|
||||
NETSURF_USE_JPEG=NO \
|
||||
NETSURF_USE_JPEG=YES \
|
||||
NETSURF_USE_JPEGXL=NO \
|
||||
NETSURF_USE_WEBP=NO \
|
||||
NETSURF_USE_VIDEO=NO \
|
||||
@@ -85,46 +86,69 @@ NETSURF_ARGS := \
|
||||
# so -lparserutils lands to the right of this archive and resolves the symbols
|
||||
# it references.
|
||||
COMPAT_LIB := $(CURDIR)/compat/libnscompat.a
|
||||
BRIDGE_OBJ := $(CURDIR)/compat/montauk_bridge.o
|
||||
STB_OBJ := $(CURDIR)/compat/stb_truetype_impl.o
|
||||
STB_IMAGE_OBJ := $(CURDIR)/compat/stb_image_impl.o
|
||||
|
||||
# NetSurf formats floats (page load time in the status bar, plot coordinates).
|
||||
# The Montauk libc keeps %e/%f/%g in a separate archive member reached by a
|
||||
# WEAK reference, and a weak undefined ref does not extract a member -- without
|
||||
# this the status bar reads "Done (%fs)". See programs/lib/libc/printf_float.c.
|
||||
NS_LDFLAGS := $(COMPAT_LIB) -Wl,-u,_pf_putfloat
|
||||
# Link the SDK libc explicitly as well. The cross compiler has a libc snapshot
|
||||
# in its private sysroot, but that snapshot is only for bootstrapping the
|
||||
# toolchain and can lag the OS tree. In particular, the older allocator is not
|
||||
# safe for NetSurf's worker-thread allocation traffic.
|
||||
NS_LDFLAGS := $(COMPAT_LIB) -L$(MONTAUKOS)/programs/lib/libjpeg \
|
||||
$(MONTAUKOS)/programs/lib/libloader/liblibloader.a \
|
||||
$(LIBTLS_A) $(LIBBEARSSL_A) $(LIBC_A) -Wl,-u,_pf_putfloat
|
||||
|
||||
$(COMPAT_LIB): compat/iconv.c compat/iconv.h
|
||||
$(COMPAT_LIB): compat/iconv.c compat/iconv.h $(BRIDGE_OBJ) $(STB_OBJ) $(STB_IMAGE_OBJ)
|
||||
$(CC) $(NETSURF_CFLAGS) -std=gnu99 -c compat/iconv.c -o compat/iconv.o
|
||||
$(AR) rcs $@ compat/iconv.o
|
||||
$(AR) rcs $@ compat/iconv.o $(BRIDGE_OBJ) $(STB_OBJ) $(STB_IMAGE_OBJ)
|
||||
@echo "Built: $@"
|
||||
|
||||
$(BRIDGE_OBJ): files/montauk_bridge.cpp files/montauk_bridge.h
|
||||
$(CXX) $(PORT_CFLAGS_COMMON) -std=gnu++20 -fno-exceptions -fno-rtti \
|
||||
-I $(MONTAUKOS)/programs/lib/bearssl/inc -I files -c $< -o $@
|
||||
|
||||
$(STB_OBJ): files/stb_truetype_impl.cpp
|
||||
$(CXX) $(PORT_CFLAGS_COMMON) -std=gnu++20 -fno-exceptions -fno-rtti -c $< -o $@
|
||||
|
||||
$(STB_IMAGE_OBJ): compat/stb_image_impl.c
|
||||
$(CC) $(PORT_CFLAGS_COMMON) -std=gnu11 -c $< -o $@
|
||||
|
||||
.PHONY: all clean netsurf-build
|
||||
all: netsurf-build
|
||||
|
||||
netsurf-build: $(COMPAT_LIB)
|
||||
@$(call ns_patch,$(UPSTREAM))
|
||||
cp files/montauk.c files/montauk.h files/montauk_bridge.h $(UPSTREAM)/content/fetchers/
|
||||
cp files/montauk_ui.c files/montauk_ui.h $(UPSTREAM)/frontends/monkey/
|
||||
cp files/montauk_image.c $(UPSTREAM)/content/handlers/image/jpeg.c
|
||||
CFLAGS="$(NETSURF_CFLAGS)" LDFLAGS="$(NS_LDFLAGS)" $(NS_ENV) \
|
||||
$(NS_MAKE) -C $(UPSTREAM) $(NETSURF_ARGS)
|
||||
@test -f $(NS_BUILD_OUT) || { echo "netsurf: expected $(NS_BUILD_OUT)" >&2; exit 1; }
|
||||
@echo "Built: $(NS_BUILD_OUT) ($$(stat -c%s $(NS_BUILD_OUT)) bytes)"
|
||||
|
||||
# Install as a MontaukOS system program plus its resource tree. Not an app
|
||||
# bundle: monkey is a console REPL with no GUI, so it carries no manifest and
|
||||
# no .port marker -- remember to uninstall before cutting a release ISO.
|
||||
# Install a self-contained app bundle, including NetSurf's resource tree.
|
||||
.PHONY: install uninstall
|
||||
install: netsurf-build
|
||||
mkdir -p $(NS_INSTALL)/netsurf
|
||||
cp $(NS_BUILD_OUT) $(NS_INSTALL)/nsmonkey.elf
|
||||
rm -rf $(LEGACY_INSTALL)/nsmonkey.elf $(LEGACY_INSTALL)/netsurf
|
||||
mkdir -p $(APP_INSTALL)/res
|
||||
cp $(NS_BUILD_OUT) $(APP_INSTALL)/netsurf.elf
|
||||
cp files/manifest.toml $(APP_INSTALL)/manifest.toml
|
||||
cp $(MONTAUKOS)/programs/bin/os/icons/web-browser.svg $(APP_INSTALL)/web-browser.svg
|
||||
# -L, not -r alone: nearly everything in a NetSurf frontend res/ dir is a
|
||||
# symlink into ../../../resources/. Copied as links they dangle outside
|
||||
# the installed tree, and the ramdisk turns a symlink into a ZERO-LENGTH
|
||||
# FILE (Fs/Ramdisk.cpp only handles typeflag '5'), so default.css and
|
||||
# welcome.html arrive empty and every page lays out to nothing.
|
||||
cp -rL $(UPSTREAM)/frontends/monkey/res/. $(NS_INSTALL)/netsurf/
|
||||
@echo "installed: 0:/os/nsmonkey.elf + 0:/os/netsurf/ resources"
|
||||
cp -rL $(UPSTREAM)/frontends/monkey/res/. $(APP_INSTALL)/res/
|
||||
@echo "installed: self-contained NetSurf app bundle"
|
||||
|
||||
uninstall:
|
||||
rm -rf $(NS_INSTALL)/nsmonkey.elf $(NS_INSTALL)/netsurf
|
||||
@echo "removed nsmonkey.elf and its resources"
|
||||
rm -rf $(APP_INSTALL) $(LEGACY_INSTALL)/nsmonkey.elf $(LEGACY_INSTALL)/netsurf
|
||||
@echo "removed NetSurf app bundle"
|
||||
|
||||
clean:
|
||||
@$(NS_ENV) $(NS_MAKE) -C $(UPSTREAM) $(NETSURF_ARGS) clean >/dev/null 2>&1 || true
|
||||
|
||||
Reference in new issue
Block a user