From 3dcf735ffe31111650690f3772d0fc36f7977548 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 18 Jun 2019 07:55:07 +1000 Subject: [PATCH] Add web to buildbot script and fix mistakes in windows build bot --- misc/buildbot.sh | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/misc/buildbot.sh b/misc/buildbot.sh index fce18c32b..3b7aa1d39 100644 --- a/misc/buildbot.sh +++ b/misc/buildbot.sh @@ -20,12 +20,14 @@ # However! The default libcurl package will produce an executable that won't run on Arch (due to defining CURL_OPENSSL_3) # As such, you may want to uninstall libcurl package, manually compile curl's source code for both 32 and 64 bit, # then add the .so files to /usr/lib/i386-linux-gnu and /usr/lib/x86_64-linux-gnu/ -cd ~/client/src/ -echo $PWD + +# change these as needed +SOURCE_DIR=~/client +EMSCRIPTEN_PATH=/usr/bin/emscripten/emcc # ----------------------------- c_build_win32() { - cp ~/client/misc/CCicon_32.res ~/client/misc/src/CCicon_32.res + cp $SOURCE_DIR/misc/CCicon_32.res $SOURCE_DIR/src/CCicon_32.res rm cc-w32-d3d.exe cc-w32-ogl.exe i686-w64-mingw32-gcc *.c -O1 -s -fno-stack-protector -DCC_COMMIT_SHA=\"$LATEST\" -o cc-w32-d3d.exe CCicon_32.res -mwindows -lws2_32 -lwininet -lwinmm -limagehlp -lcrypt32 -ld3d9 -w @@ -33,7 +35,7 @@ c_build_win32() { } c_build_win64() { - cp ~/client/misc/CCicon_64.res ~/client/misc/src/CCicon_64.res + cp $SOURCE_DIR/misc/CCicon_64.res $SOURCE_DIR/src/CCicon_64.res rm cc-w64-d3d.exe cc-w64-ogl.exe x86_64-w64-mingw32-gcc *.c -O1 -s -fno-stack-protector -DCC_COMMIT_SHA=\"$LATEST\" -o cc-w64-d3d.exe CCicon_64.res -mwindows -lws2_32 -lwininet -lwinmm -limagehlp -lcrypt32 -ld3d9 -w @@ -50,7 +52,22 @@ c_build_nix64() { gcc *.c -O1 -fvisibility=hidden -s -rdynamic -fno-stack-protector -DCC_COMMIT_SHA=\"$LATEST\" -m64 -o cc-nix64 -lX11 -lpthread -lGL -lm -lcurl -lopenal -ldl -w } +c_build_web() { + echo "Building web.." + rm cc.js + $EMSCRIPTEN_PATH *.c -O1 -o cc.js -s FETCH=1 -s WASM=0 -s ALLOW_MEMORY_GROWTH=1 --preload-file texpacks/default.zip -w + # so game loads textures from classicube.net/static/default.zip + sed -i 's#cc.data#/static/default.zip#g' cc.js + # fix texture pack overlay always showing 'Download size: Determining..." + sed -i 's#xhr.onload = function(e) {#xhr.onload = function(e) { Fetch.setu64(fetch + 32, e.total);#g' cc.js + # fix mouse wheel scrolling page not being properly prevented + # "[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive." + sed -i 's#eventHandler.useCapture);#{ useCapture: eventHandler.useCapture, passive: false });#g' cc.js +} + # ----------------------------- +cd $SOURCE_DIR/src/ +echo $PWD git pull https://github.com/UnknownShadow200/ClassiCube.git git fetch --all git reset --hard origin/master @@ -60,3 +77,4 @@ c_build_win32 c_build_win64 c_build_nix32 c_build_nix64 +c_build_web \ No newline at end of file