xpack: `set_bindir()` only affects the .html file and not the .wasm and .js file in a wasm package
Xmake Version
3.0.1+HEAD.3350cc5
Operating System Version and Architecture
Ubuntu 22.04
Describe Bug
When generating a zip archive with a web build if I use set_bindir(".") only the html file is moved and the wasm and js files are still left in the bin/ directory.
Expected Behavior
The js and wasm files should be placed at the same location as the html file.
Project Configuration
Example:
xpack configuration:
includes("@builtin/xpack")
xpack("myapp", function ()
add_targets("myapp")
-- Type of archive
if is_plat("linux") then
set_formats("targz")
else
set_formats("zip")
end
-- File name
set_basename("myapp-$(version)_$(plat)_$(arch)")
-- Set the archive structure
set_prefixdir("myapp-$(version)")
set_bindir(".")
end)
Generatated zip:
$ unzip -l ./build/xpack/myapp/myapp-1.0.0_wasm_wasm32.zip
Archive: ./build/xpack/myapp/myapp-1.0.0_wasm_wasm32.zip
Length Date Time Name
--------- ---------- ----- ----
2383 2025-08-25 20:51 myapp-1.0.0/myapp.html
239333 2025-08-25 20:51 myapp-1.0.0/bin/myapp.js
1202679 2025-08-25 20:51 myapp-1.0.0/bin/myapp.wasm
--------- -------
1444395 3 files
Even though
Additional Information and Error Logs
$ xmake pack -v
checking for emcc ... /home/user/Documents/dev/emsdk/upstream/emscripten/emcc
checking for the c compiler (cc) ... emcc
checking for /home/user/Documents/dev/emsdk/upstream/emscripten/emcc ... ok
checking for the c compiler (cc) ... emcc
checking for the c compiler (cc) ... emcc
checking for flags (-fPIC) ... ok
checking for flags (-O3) ... ok
checking for flags (-DNDEBUG) ... ok
[ 38%]: cache compiling.release src/main.c
/home/user/Documents/dev/emsdk/upstream/emscripten/emcc -c -fvisibility=hidden -Wall -Werror -O3 -std=c99 -isystem /home/user/.xmake/packages/r/raylib/5.5/7c3cb30070034ef5bac4ec6c81c3c2a8/include -isystem /home/user/.xmake/packages/f/flecs/v4.1.0/47378490c4a44e188410038b26dbea91/include -isystem /home/user/.xmake/packages/t/tomlc99/2023.09.30/da5824dde37a4e8589c816d0d0da351a/include -isystem /home/user/.xmake/packages/r/raylib-nuklear/v5.5.1/cf06154a7cab490787362801c2f3df34/include -DNDEBUG -o build/.objs/myapp/wasm/wasm32/release/src/main.c.o src/main.c
[ 38%]: cache compiling.release src/module/raylib.c
/home/user/Documents/dev/emsdk/upstream/emscripten/emcc -c -fvisibility=hidden -Wall -Werror -O3 -std=c99 -isystem /home/user/.xmake/packages/r/raylib/5.5/7c3cb30070034ef5bac4ec6c81c3c2a8/include -isystem /home/user/.xmake/packages/f/flecs/v4.1.0/47378490c4a44e188410038b26dbea91/include -isystem /home/user/.xmake/packages/t/tomlc99/2023.09.30/da5824dde37a4e8589c816d0d0da351a/include -isystem /home/user/.xmake/packages/r/raylib-nuklear/v5.5.1/cf06154a7cab490787362801c2f3df34/include -DNDEBUG -o build/.objs/myapp/wasm/wasm32/release/src/module/raylib.c.o src/module/raylib.c
[ 38%]: cache compiling.release src/module/raylib/render.c
/home/user/Documents/dev/emsdk/upstream/emscripten/emcc -c -fvisibility=hidden -Wall -Werror -O3 -std=c99 -isystem /home/user/.xmake/packages/r/raylib/5.5/7c3cb30070034ef5bac4ec6c81c3c2a8/include -isystem /home/user/.xmake/packages/f/flecs/v4.1.0/47378490c4a44e188410038b26dbea91/include -isystem /home/user/.xmake/packages/t/tomlc99/2023.09.30/da5824dde37a4e8589c816d0d0da351a/include -isystem /home/user/.xmake/packages/r/raylib-nuklear/v5.5.1/cf06154a7cab490787362801c2f3df34/include -DNDEBUG -o build/.objs/myapp/wasm/wasm32/release/src/module/raylib/render.c.o src/module/raylib/render.c
checking for flags (-MMD -MF) ... ok
checking for flags (-fdiagnostics-color=always) ... ok
checking for em++ ... /home/user/Documents/dev/emsdk/upstream/emscripten/em++
checking for the linker (ld) ... em++
checking for /home/user/Documents/dev/emsdk/upstream/emscripten/em++ ... ok
checking for flags (-fPIC) ... ok
checking for flags (-O3) ... ok
checking for flags (-O3) ... ok
checking for flags (-sALLOW_MEMORY_GROWTH=1) ... ok
checking for flags (-sSTACK_SIZE=1mb) ... ok
checking for flags (-sUSE_GLFW=3) ... ok
checking for flags (-sASSERTIONS=1) ... ok
checking for flags (-sWASM=1) ... ok
checking for flags (-sASYNCIFY) ... ok
checking for flags (--shell-file=src/main.html) ... ok
checking for flags (--preload-file=assets@assets) ... ok
[ 56%]: linking.release myapp.html
/home/user/Documents/dev/emsdk/upstream/emscripten/em++ -o build/wasm/wasm32/release/myapp.html build/.objs/myapp/wasm/wasm32/release/src/main.c.o build/.objs/myapp/wasm/wasm32/release/src/module/raylib.c.o build/.objs/myapp/wasm/wasm32/release/src/module/raylib/render.c.o -L/home/user/.xmake/packages/r/raylib/5.5/7c3cb30070034ef5bac4ec6c81c3c2a8/lib -L/home/user/.xmake/packages/f/flecs/v4.1.0/47378490c4a44e188410038b26dbea91/lib -L/home/user/.xmake/packages/t/tomlc99/2023.09.30/da5824dde37a4e8589c816d0d0da351a/lib -lraylib -lflecs_static -ltomlc99 -O3 -sALLOW_MEMORY_GROWTH=1 -sSTACK_SIZE=1mb -sUSE_GLFW=3 -sASSERTIONS=1 -sWASM=1 -sASYNCIFY --shell-file=src/main.html --preload-file=assets@assets
packing build/xpack/myapp/myapp-1.0.0_wasm_wasm32.zip ..
checking for llvm-objdump ... no
checking for objdump ... /usr/bin/objdump
checking for llvm-objdump ... no
checking for objdump ... /usr/bin/objdump
checking for zip ... /usr/bin/zip
/usr/bin/zip /home/user/Documents/dev/myapp.xmake/build/xpack/myapp/myapp-1.0.0_wasm_wasm32.zip -9 -r -@
adding: myapp-1.0.0/myapp.html (deflated 62%)
adding: myapp-1.0.0/bin/myapp.js (deflated 75%)
adding: myapp-1.0.0/bin/myapp.wasm (deflated 67%)
pack ok
The bin directory is hardcoded here. https://github.com/xmake-io/xmake/commit/cdd5062919821da123cd84d5dbb3cb07cd889ee9
@SirLynix
https://github.com/xmake-io/xmake/blob/34e28c383b48d1c4c0df70a25500fa07ea70dc99/xmake/rules/platform/wasm/installfiles/xmake.lua#L27-L31
installfiles cannot distinguish between bin and lib files. Therefore it cannot use the global set_bindir .