Add support for building on iOS

This commit is contained in:
Carson Katri
2025-09-16 12:41:50 -04:00
committed by Pierre Tachoire
parent 3f2f56d603
commit 8568c821fa
5 changed files with 128 additions and 65 deletions

View File

@@ -9,24 +9,29 @@ F=
# OS and ARCH
kernel = $(shell uname -ms)
ifeq ($(kernel), Darwin arm64)
OS := macos
ARCH := aarch64
OS ?= macos
ARCH ?= aarch64
else ifeq ($(kernel), Darwin x86_64)
OS := macos
ARCH := x86_64
OS ?= macos
ARCH ?= x86_64
else ifeq ($(kernel), Linux aarch64)
OS := linux
ARCH := aarch64
OS ?= linux
ARCH ?= aarch64
else ifeq ($(kernel), Linux arm64)
OS := linux
ARCH := aarch64
OS ?= linux
ARCH ?= aarch64
else ifeq ($(kernel), Linux x86_64)
OS := linux
ARCH := x86_64
OS ?= linux
ARCH ?= x86_64
else
$(error "Unhandled kernel: $(kernel)")
endif
MAKE ?= make
CMAKE ?= cmake
AUTOCONF_FLAGS ?=
CFLAGS ?=
LDFLAGS ?=
# Infos
# -----
@@ -156,38 +161,40 @@ _install-netsurf: clean-netsurf
mkdir -p $(BC_NS) && \
cp -R vendor/netsurf/share $(BC_NS) && \
export PREFIX=$(BC_NS) && \
export OPTLDFLAGS="-L$(ICONV)/lib" && \
export OPTCFLAGS="$(OPTCFLAGS) -I$(ICONV)/include" && \
export OPTLDFLAGS="$(LDFLAGS) -L$(ICONV)/lib" && \
export OPTCFLAGS="$(CFLAGS) $(OPTCFLAGS) -I$(ICONV)/include" && \
printf "\e[33mInstalling libwapcaplet...\e[0m\n" && \
cd vendor/netsurf/libwapcaplet && \
BUILDDIR=$(BC_NS)/build/libwapcaplet make install && \
BUILDDIR=$(BC_NS)/build/libwapcaplet $(MAKE) install && \
cd ../libparserutils && \
printf "\e[33mInstalling libparserutils...\e[0m\n" && \
BUILDDIR=$(BC_NS)/build/libparserutils make install && \
BUILDDIR=$(BC_NS)/build/libparserutils $(MAKE) install && \
cd ../libhubbub && \
printf "\e[33mInstalling libhubbub...\e[0m\n" && \
BUILDDIR=$(BC_NS)/build/libhubbub make install && \
BUILDDIR=$(BC_NS)/build/libhubbub $(MAKE) install && \
rm src/treebuilder/autogenerated-element-type.c && \
cd ../libdom && \
printf "\e[33mInstalling libdom...\e[0m\n" && \
BUILDDIR=$(BC_NS)/build/libdom make install && \
printf "\e[33mRunning libdom example...\e[0m\n" && \
cd examples && \
$(ZIG) cc \
-I$(ICONV)/include \
-I$(BC_NS)/include \
-L$(ICONV)/lib \
-L$(BC_NS)/lib \
-liconv \
-ldom \
-lhubbub \
-lparserutils \
-lwapcaplet \
-o a.out \
dom-structure-dump.c \
$(ICONV)/lib/libiconv.a && \
./a.out > /dev/null && \
rm a.out && \
BUILDDIR=$(BC_NS)/build/libdom $(MAKE) install && \
if [ -z "$${SKIP_EXAMPLES}" ]; then \
printf "\e[33mRunning libdom example...\e[0m\n" && \
cd examples && \
$(ZIG) cc \
-I$(ICONV)/include \
-I$(BC_NS)/include \
-L$(ICONV)/lib \
-L$(BC_NS)/lib \
-liconv \
-ldom \
-lhubbub \
-lparserutils \
-lwapcaplet \
-o a.out \
dom-structure-dump.c \
$(ICONV)/lib/libiconv.a && \
./a.out > /dev/null && \
rm a.out; \
fi && \
printf "\e[36mDone NetSurf $(OS)\e[0m\n"
clean-netsurf:
@@ -211,7 +218,7 @@ endif
build-libiconv: clean-libiconv
@cd vendor/libiconv/libiconv-1.17 && \
./configure --prefix=$(ICONV) --enable-static && \
./configure --prefix=$(ICONV) --enable-static $(AUTOCONF_FLAGS) && \
make && make install
install-libiconv: download-libiconv build-libiconv
@@ -231,7 +238,7 @@ MIMALLOC := $(BC)vendor/mimalloc/out/$(OS)-$(ARCH)
_build_mimalloc: clean-mimalloc
@mkdir -p $(MIMALLOC)/build && \
cd $(MIMALLOC)/build && \
cmake -DMI_BUILD_SHARED=OFF -DMI_BUILD_OBJECT=OFF -DMI_BUILD_TESTS=OFF -DMI_OVERRIDE=OFF $(OPTS) ../../.. && \
$(CMAKE) -DMI_BUILD_SHARED=OFF -DMI_BUILD_OBJECT=OFF -DMI_BUILD_TESTS=OFF -DMI_OVERRIDE=OFF $(OPTS) ../../.. && \
make && \
mkdir -p $(MIMALLOC)/lib