Skip to content

Commit

Permalink
Switch to module output for emscripten builds
Browse files Browse the repository at this point in the history
Results in smaller outputs, and unblocks the switch to Vite.

Updates mihaip/infinite-mac#155
  • Loading branch information
mihaip committed May 28, 2023
1 parent c9b4223 commit 49787f8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
6 changes: 6 additions & 0 deletions BasiliskII/src/Unix/Makefile.in
Expand Up @@ -32,6 +32,12 @@ DEFS = @DEFS@ @DEFINES@ -D_REENTRANT -DDATADIR=\"$(datadir)/$(APP)\"
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
ifeq ($(EMSCRIPTEN),yes)
# We can't specify these flags in _emconfigure.sh because then the autoconf
# tests will fail (the version of node that they conftest program is run
# under does not support modules).
LDFLAGS += -s INITIAL_MEMORY=268435456 # 256 MB
LDFLAGS += -s MODULARIZE -s EXPORT_ES6 -s EXPORT_NAME=emulator
LDFLAGS += -s EXPORTED_RUNTIME_METHODS=FS
# Breaks emscripten because it can't link with libm.a or SDL (which are
# built for the host OS)
SKIP_LIBS = -lm -lSDL -L/usr/lib/x86_64-linux-gnu -L/usr/lib/aarch64-linux-gnu
Expand Down
9 changes: 1 addition & 8 deletions BasiliskII/src/Unix/_emconfigure.sh
Expand Up @@ -4,10 +4,6 @@ set -euo pipefail
em_flags=""
em_ldflags=""

em_ldflags+=" -s INITIAL_MEMORY=268435456"
em_ldflags+=" -s FORCE_FILESYSTEM=1"
em_ldflags+=" -s WASM=1"

em_defines=""
if [[ -z "${macemujs_conf_debug:-}" ]]; then
em_flags+=" -O3 -gsource-map"
Expand All @@ -19,16 +15,13 @@ else
em_defines+=" -DDEBUG"
fi

export CC="emcc"
export CXX="em++"
export AR="emar"
export EMSCRIPTEN=1
export DEFINES=$em_defines
export CFLAGS="$em_flags -g"
export CPPFLAGS="$em_flags -g"
export LDFLAGS="$em_flags $em_ldflags"

./autogen.sh \
emconfigure ./autogen.sh \
--without-esd \
--without-gtk \
--disable-sdl-video \
Expand Down
11 changes: 11 additions & 0 deletions SheepShaver/src/Unix/Makefile.in
Expand Up @@ -11,6 +11,8 @@ datadir = @datadir@
mandir = @mandir@
man1dir = $(mandir)/man1

EMSCRIPTEN = @EMSCRIPTEN@

DESTDIR =

CC = @CC@
Expand Down Expand Up @@ -83,6 +85,15 @@ CXXFLAGS += $(GUI_CFLAGS)
LIBS += $(GUI_LIBS)
endif

ifeq ($(EMSCRIPTEN),yes)
# We can't specify these flags in _emconfigure.sh because then the autoconf
# tests will fail (the version of node that they conftest program is run
# under does not support modules).
LDFLAGS += -s INITIAL_MEMORY=268435456 # 256 MB
LDFLAGS += -s MODULARIZE -s EXPORT_ES6 -s EXPORT_NAME=emulator
LDFLAGS += -s EXPORTED_RUNTIME_METHODS=FS
endif

## Rules
.PHONY: modules install uninstall clean distclean depend dep
.SUFFIXES:
Expand Down
9 changes: 1 addition & 8 deletions SheepShaver/src/Unix/_emconfigure.sh
Expand Up @@ -4,10 +4,6 @@ set -euo pipefail
em_flags=""
em_ldflags=""

em_ldflags+=" -s INITIAL_MEMORY=268435456"
em_ldflags+=" -s FORCE_FILESYSTEM=1"
em_ldflags+=" -s WASM=1"

em_defines=""
if [[ -z "${macemujs_conf_debug:-}" ]]; then
em_flags+=" -O3 -gsource-map"
Expand All @@ -19,16 +15,13 @@ else
em_defines+=" -DDEBUG"
fi

export CC="emcc"
export CXX="em++"
export AR="emar"
export EMSCRIPTEN=1
export DEFINES=$em_defines
export CFLAGS="$em_flags -g"
export CPPFLAGS="$em_flags -g"
export LDFLAGS="$em_flags $em_ldflags"

./autogen.sh \
emconfigure ./autogen.sh \
--without-esd \
--without-gtk \
--disable-sdl-video \
Expand Down

0 comments on commit 49787f8

Please sign in to comment.