build mgba wasm

This commit is contained in:
Corwin 2024-04-03 22:58:10 +01:00
parent a7de8c07d2
commit e1453cb4c8
No known key found for this signature in database
3 changed files with 33 additions and 0 deletions

View file

@ -92,6 +92,11 @@ release +args: (_run-tool "release" args)
miri: miri:
(cd agb-hashmap && cargo miri test) (cd agb-hashmap && cargo miri test)
build-mgba-wasm:
rm -r website/app/src/vendor
mkdir website/app/src/vendor
podman build --file website/mgba-wasm/BuildMgbaWasm --output=website/app/src/vendor .
_run-tool +tool: _run-tool +tool:
(cd tools && cargo build) (cd tools && cargo build)
"$CARGO_TARGET_DIR/debug/tools" {{tool}} "$CARGO_TARGET_DIR/debug/tools" {{tool}}

View file

@ -21,3 +21,6 @@
npm-debug.log* npm-debug.log*
yarn-debug.log* yarn-debug.log*
yarn-error.log* yarn-error.log*
src/vendor

View file

@ -0,0 +1,25 @@
FROM docker.io/emscripten/emsdk:3.1.46 as builder
RUN apt-get update && \
apt-get install -y --no-install-recommends make cmake git && \
apt-get autoremove -y && apt-get clean
RUN userdel emscripten -r
USER root
ENV BUILD_DIR=build-wasm
WORKDIR /
RUN git clone https://github.com/thenick775/mgba.git --filter=tree:0 -b feature/wasm
RUN mkdir /mgba/build-wasm
WORKDIR /mgba/build-wasm
RUN git checkout 27dede256b6de36303a87d0886f81505a0f30c28
RUN emcmake cmake .. && make install DESTDIR=install
FROM scratch
COPY --from=builder /mgba/build-wasm/wasm/mgba.js .
COPY --from=builder /mgba/build-wasm/wasm/mgba.wasm .
COPY --from=builder /mgba/build-wasm/wasm/mgba.d.ts .