Files
waxmplayer/build.sh
2026-04-22 03:30:16 -05:00

36 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Change this if it differs
EMHOME=${EMHOME:=/usr/lib/emscripten/}
cd libxmp
mkdir -p build
cd build
echo "_malloc
_free
_xmp_create_context
_xmp_free_context
_xmp_load_module
_xmp_release_module
_xmp_play_buffer
_xmp_play_frame
_xmp_get_format_list
_xmp_get_module_info
_xmp_set_player
_xmp_get_player
_xmp_get_frame_info
_xmp_start_player
_xmp_end_player
_xmp_restart_module
_xmp_seek_time
_xmp_channel_mute
_xmp_channel_vol
_xmp_inject_event
_xmp_test_module_from_memory
_xmp_load_module_from_memory" > exported.txt
$EMHOME/emcmake cmake ..
$EMHOME/emmake make -j4
$EMHOME/emcc -O3 libxmp.a -o libxmp.js -s WASM=1 -s EXPORTED_FUNCTIONS=@exported.txt -s EXPORT_ALL=1 -s BINARYEN_METHOD="native-wasm" -s EXPORTED_RUNTIME_METHODS='["cwrap","UTF8ToString","HEAPU8","HEAPF32","HEAP16"]' -s ALLOW_MEMORY_GROWTH=1 -s MODULARIZE=1 -s JSPI=1 -s EXPORT_NAME='libxmp' -s ENVIRONMENT='web,worker' -s SINGLE_FILE=0
cd ..
cd ..
cp libxmp/build/libxmp.js libxmp/build/libxmp.wasm .
zip -r waxmplayer.xpi . -x "libxmp/*" "waxmplayer.xpi"