From f26c7b91e17548df5cb6db400c4804f399778e9d Mon Sep 17 00:00:00 2001 From: Terry Hearst Date: Fri, 30 Aug 2024 17:23:49 -0400 Subject: [PATCH 1/8] Fixes for linux --- compile-linux.hxml | 3 +++ compile-linux.sh | 3 ++- linux-dist/run-marblegame-debug.sh | 4 ++++ linux-dist/run-marblegame.sh | 12 ++++++++++++ src/gui/PresentsGui.hx | 2 +- 5 files changed, 22 insertions(+), 2 deletions(-) create mode 100755 linux-dist/run-marblegame-debug.sh create mode 100755 linux-dist/run-marblegame.sh diff --git a/compile-linux.hxml b/compile-linux.hxml index bcea82ed..3d082e48 100644 --- a/compile-linux.hxml +++ b/compile-linux.hxml @@ -1,7 +1,10 @@ -cp src -lib heaps -lib hlsdl +-lib colyseus-websocket +-lib datachannel -D highDPI -D flow_border +-D analyzer-optimize -hl native/marblegame.c --main Main diff --git a/compile-linux.sh b/compile-linux.sh index 4aaad4ec..269828e2 100755 --- a/compile-linux.sh +++ b/compile-linux.sh @@ -2,5 +2,6 @@ haxe compile-linux.hxml cd native -gcc -o marblegame -g -I . -L /usr/local/lib marblegame.c /usr/local/lib/{ui.hdll,openal.hdll,fmt.hdll,sdl.hdll,uv.hdll,ssl.hdll} -lSDL2 -lhl -lm +gcc -o marblegame -O2 -I . -L /usr/local/lib marblegame.c /usr/local/lib/{ui.hdll,openal.hdll,fmt.hdll,sdl.hdll,uv.hdll,ssl.hdll,datachannel.hdll} -lSDL2 -lhl -lm -luv +strip marblegame cp marblegame .. diff --git a/linux-dist/run-marblegame-debug.sh b/linux-dist/run-marblegame-debug.sh new file mode 100755 index 00000000..565a2739 --- /dev/null +++ b/linux-dist/run-marblegame-debug.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +cd "$(dirname "$0")" +./hl marblegame.hl diff --git a/linux-dist/run-marblegame.sh b/linux-dist/run-marblegame.sh new file mode 100755 index 00000000..e6fe5fe4 --- /dev/null +++ b/linux-dist/run-marblegame.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +cd "$(dirname "$0")" + +# Add the current directory to the linker path so the .hdll files can be loaded +if [ "x$LD_LIBRARY_PATH" = "x" ]; then + export LD_LIBRARY_PATH=. +else + export LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH" +fi + +./marblegame $@ diff --git a/src/gui/PresentsGui.hx b/src/gui/PresentsGui.hx index cd20573a..b831d2e1 100644 --- a/src/gui/PresentsGui.hx +++ b/src/gui/PresentsGui.hx @@ -14,7 +14,7 @@ class PresentsGui extends GuiImage { this.position = new Vector(); this.extent = new Vector(640, 480); - var ggLogo = new GuiImage(ResourceLoader.getResource('data/ui/GG_logo.png', ResourceLoader.getImage, this.imageResources).toTile()); + var ggLogo = new GuiImage(ResourceLoader.getResource('data/ui/GG_Logo.png', ResourceLoader.getImage, this.imageResources).toTile()); ggLogo.horizSizing = Center; ggLogo.vertSizing = Center; ggLogo.position = new Vector(69, 99); From 1655ee2e2ac435750bd9bd141ec54232eb885248 Mon Sep 17 00:00:00 2001 From: Terry Hearst Date: Fri, 30 Aug 2024 18:25:13 -0400 Subject: [PATCH 2/8] Add CI for linux --- .circleci/config.yml | 119 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 114 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a0f843ab..eb3b28a3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -53,7 +53,7 @@ jobs: haxelib setup ~/haxelib haxelib list haxelib install hashlink - + - run: name: Compile zlib @@ -314,7 +314,7 @@ jobs: # path: ~/MBHaxe/MBHaxe-Platinum-Mac.zip build-win: - executor: + executor: name: win/server-2022 shell: bash.exe # executor type # Checkout the code as the first step. This is a dedicated CircleCI step. @@ -369,7 +369,7 @@ jobs: export PATH=$nekopath:"$PATH" haxelib setup ~/haxelib haxelib list - - run: + - run: name: Build Hashlink command: | mkdir ~/deps @@ -438,7 +438,7 @@ jobs: cp ~/deps/hashlink/x64/Release/datachannel.hdll . cp ~/deps/hashlink/x64/Release/uv.hdll . cp ~/deps/hashlink/include/sdl/lib/x64/SDL2.dll . - cp ~/deps/hashlink/include/openal/bin/Win64/soft_oal.dll ./OpenAL32.dll + cp ~/deps/hashlink/include/openal/bin/Win64/soft_oal.dll ./OpenAL32.dll - run: name: Zip bundle command: | @@ -452,6 +452,108 @@ jobs: # - store_artifacts: # path: ~/project/MBHaxe-Platinum-Win.zip + build-linux: + machine: # executor type + image: ubuntu-2204:current + environment: + #HOMEBREW_NO_AUTO_UPDATE: 1 + #NPROC: 4 + COMMIT_TAG: pipeline.git.tag + steps: + #- add_ssh_keys: + # fingerprints: + # - "82:42:56:a0:57:43:95:4e:00:c0:8c:c1:7f:70:74:47" + - checkout: + path: ~/MBHaxe + - run: + name: Install apt dependencies + command: | + sudo apt install cmake + sudo apt-get install libpng-dev libturbojpeg-dev libvorbis-dev libopenal-dev libsdl2-dev libmbedtls-dev libuv1-dev libsqlite3-dev + + - run: + name: Install Haxe + command: | + set -eux + download_url="https://github.com/HaxeFoundation/haxe/releases/download/4.3.6/haxe-4.3.6-linux64.tar.gz" + echo "Downloading [$download_url]..." + mkdir ~/haxe + curl -fsSL --retry 3 --retry-delay 5 "$download_url" -o ~/haxe.tar.gz + tar xzvf ~/haxe.tar.gz -C ~/haxe --strip-components=1 + export PATH=~/haxe/:"$PATH" + export HAXE_STD_PATH=~/haxe/std + haxelib setup ~/haxelib + haxelib list + + - run: + name: Install hashlink + command: | + mkdir -p ~/deps + cd ~/deps + git clone --depth=1 https://github.com/RandomityGuy/hashlink + git clone --depth=1 https://github.com/RandomityGuy/hxDatachannel + cd hashlink/libs + ln -s ~/deps/hxDatachannel/cpp datachannel + echo -e "\nadd_subdirectory(datachannel)" >> CMakeLists.txt + cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_FIND_FRAMEWORK=LAST -DWITH_SQLITE=OFF -DBUILD_TESTING=OFF -DHASHLINK_INCLUDE_DIR="~/deps/hashlink/src" -DHASHLINK_LIBRARY_DIR="/usr/local/lib/" + cmake --build build --config Release -j$NPROC + sudo cmake --install build + + - run: + name: Install haxe dependencies + command: | + export PATH=~/haxe/:"$PATH" + export HAXE_STD_PATH=~/haxe/std + haxelib dev hashlink ~/deps/hashlink/other/haxelib + haxelib git heaps https://github.com/RandomityGuy/heaps + haxelib dev hlopenal ~/deps/hashlink/libs/openal + haxelib dev hlsdl ~/deps/hashlink/libs/sdl + haxelib dev datachannel ~/deps/hxDatachannel + haxelib install colyseus-websocket + + - save_cache: + key: mbhaxe-deps-v1 + paths: + - /usr/local/lib/datachannel.hdll + - /usr/local/lib/fmt.hdll + - /usr/local/lib/openal.hdll + - /usr/local/lib/sdl.hdll + - /usr/local/lib/ssl.hdll + - /usr/local/lib/ui.hdll + - /usr/local/lib/uv.hdll + + - run: + name: Compile MBHaxe + command: | + export PATH=~/haxe/:"$PATH" + export HAXE_STD_PATH=~/haxe/std + cd ~/MBHaxe + haxe compile.hxml + ./compile-linux.sh + + - run: + name: Package Bundle + command: | + mkdir -p ~/MBHaxe-Ultra-Linux + cd ~/MBHaxe-Ultra-Linux + cp ~/MBHaxe/marblegame* . + cp ~/MBHaxe/linux-dist/* . + cp -r ~/MBHaxe/data data + cp /usr/local/lib/{{fmt,openal,sdl,ssl,ui,uv}.hdll,libhl.so.1.13.0} . + cp /usr/local/bin/hl . + ln -s libhl.so.1.13.0 libhl.so.1 + ln -s libhl.so.1 libhl.so + cd .. + tar -czvf MBHaxe-Ultra-Linux.tar.gz MBHaxe-Ultra-Linux + + #- run: + # name: Upload to Artifact Storage + # command: | + # scp -o StrictHostKeyChecking=no -i $KEYPATH -P $PORT ~/MBHaxe/macos-dist/MBHaxe-Ultra-Mac.dmg $REMOTEDIR/MBHaxe-Ultra-Mac.dmg + + - store_artifacts: + path: ~/MBHaxe-Ultra-Linux.tar.gz + # Invoke jobs via workflows # See: https://circleci.com/docs/2.0/configuration-reference/#workflows @@ -468,4 +570,11 @@ workflows: - build-win: filters: tags: - only: /^\d+.\d+.\d+$/ \ No newline at end of file + only: /^\d+.\d+.\d+$/ + + build-linux: + jobs: + - build-linux: + filters: + tags: + only: /^\d+.\d+.\d+$/ From 81cf0abff0cfea37d962748f5571c9b37ca45ddb Mon Sep 17 00:00:00 2001 From: Terry Hearst Date: Fri, 30 Aug 2024 18:32:25 -0400 Subject: [PATCH 3/8] Ok fine I guess we need this --- .circleci/config.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index eb3b28a3..fe1be2b3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -480,8 +480,16 @@ jobs: mkdir ~/haxe curl -fsSL --retry 3 --retry-delay 5 "$download_url" -o ~/haxe.tar.gz tar xzvf ~/haxe.tar.gz -C ~/haxe --strip-components=1 + download_url="https://github.com/HaxeFoundation/neko/releases/download/v2-4-0/neko-2.4.0-linux64.tar.gz" + echo "Downloading [$download_url]..." + mkdir ~/neko + curl -fsSL --retry 3 --retry-delay 5 "$download_url" -o ~/neko.tar.gz + tar xzvf ~/neko.tar.gz -C ~/neko --strip-components=1 export PATH=~/haxe/:"$PATH" export HAXE_STD_PATH=~/haxe/std + export PATH=~/neko/:"$PATH" + export LD_LIBRARY_PATH=~/neko + sudo chmod +x ~/neko/neko haxelib setup ~/haxelib haxelib list @@ -504,6 +512,8 @@ jobs: command: | export PATH=~/haxe/:"$PATH" export HAXE_STD_PATH=~/haxe/std + export PATH=~/neko/:"$PATH" + export LD_LIBRARY_PATH=~/neko haxelib dev hashlink ~/deps/hashlink/other/haxelib haxelib git heaps https://github.com/RandomityGuy/heaps haxelib dev hlopenal ~/deps/hashlink/libs/openal @@ -527,6 +537,8 @@ jobs: command: | export PATH=~/haxe/:"$PATH" export HAXE_STD_PATH=~/haxe/std + export PATH=~/neko/:"$PATH" + export LD_LIBRARY_PATH=~/neko cd ~/MBHaxe haxe compile.hxml ./compile-linux.sh From df61d125d265eb5698e7f468ce6e185336729bc2 Mon Sep 17 00:00:00 2001 From: Terry Hearst Date: Fri, 30 Aug 2024 18:52:19 -0400 Subject: [PATCH 4/8] Add pkg-config --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fe1be2b3..38cb72c1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -468,7 +468,7 @@ jobs: - run: name: Install apt dependencies command: | - sudo apt install cmake + sudo apt install cmake pkg-config sudo apt-get install libpng-dev libturbojpeg-dev libvorbis-dev libopenal-dev libsdl2-dev libmbedtls-dev libuv1-dev libsqlite3-dev - run: From 6012ae25d3ad2dbfb3a5c22aa77eee53d3b9c1c1 Mon Sep 17 00:00:00 2001 From: Terry Hearst Date: Fri, 30 Aug 2024 19:07:15 -0400 Subject: [PATCH 5/8] Fix paths --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 38cb72c1..3f9cce78 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -500,9 +500,9 @@ jobs: cd ~/deps git clone --depth=1 https://github.com/RandomityGuy/hashlink git clone --depth=1 https://github.com/RandomityGuy/hxDatachannel - cd hashlink/libs - ln -s ~/deps/hxDatachannel/cpp datachannel - echo -e "\nadd_subdirectory(datachannel)" >> CMakeLists.txt + cd hashlink + ln -s ~/deps/hxDatachannel/cpp libs/datachannel + echo -e "\nadd_subdirectory(datachannel)" >> libs/CMakeLists.txt cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_FIND_FRAMEWORK=LAST -DWITH_SQLITE=OFF -DBUILD_TESTING=OFF -DHASHLINK_INCLUDE_DIR="~/deps/hashlink/src" -DHASHLINK_LIBRARY_DIR="/usr/local/lib/" cmake --build build --config Release -j$NPROC sudo cmake --install build From 766fdaa12603e02a6881c81ddb904a54e6879e76 Mon Sep 17 00:00:00 2001 From: Terry Hearst Date: Fri, 30 Aug 2024 19:09:58 -0400 Subject: [PATCH 6/8] Copy hlc_main.c --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3f9cce78..ea63046c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -541,6 +541,7 @@ jobs: export LD_LIBRARY_PATH=~/neko cd ~/MBHaxe haxe compile.hxml + cp ~/deps/hashlink/src/hlc_main.c native ./compile-linux.sh - run: From 39aaa62f0082adcf4c4af37a93fe3d65d47b3f03 Mon Sep 17 00:00:00 2001 From: Terry Hearst Date: Fri, 30 Aug 2024 19:13:39 -0400 Subject: [PATCH 7/8] Inline script --- .circleci/config.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ea63046c..2a229b60 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -541,15 +541,19 @@ jobs: export LD_LIBRARY_PATH=~/neko cd ~/MBHaxe haxe compile.hxml - cp ~/deps/hashlink/src/hlc_main.c native - ./compile-linux.sh + haxe compile-linux.hxml + cd native + cp ~/deps/hashlink/src/hlc_main.c . + gcc -o marblegame -O2 -I . -L /usr/local/lib marblegame.c /usr/local/lib/{ui.hdll,openal.hdll,fmt.hdll,sdl.hdll,uv.hdll,ssl.hdll,datachannel.hdll} -lSDL2 -lhl -lm -luv + strip marblegame - run: name: Package Bundle command: | mkdir -p ~/MBHaxe-Ultra-Linux cd ~/MBHaxe-Ultra-Linux - cp ~/MBHaxe/marblegame* . + cp ~/MBHaxe/marblegame.hl . + cp ~/MBHaxe/native/marblegame . cp ~/MBHaxe/linux-dist/* . cp -r ~/MBHaxe/data data cp /usr/local/lib/{{fmt,openal,sdl,ssl,ui,uv}.hdll,libhl.so.1.13.0} . From f8cb85d37fcd3e923b4460cd9459001b5bf6f64a Mon Sep 17 00:00:00 2001 From: Terry Hearst Date: Fri, 30 Aug 2024 19:19:35 -0400 Subject: [PATCH 8/8] Forgot datachannel --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2a229b60..fe709f53 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -556,7 +556,7 @@ jobs: cp ~/MBHaxe/native/marblegame . cp ~/MBHaxe/linux-dist/* . cp -r ~/MBHaxe/data data - cp /usr/local/lib/{{fmt,openal,sdl,ssl,ui,uv}.hdll,libhl.so.1.13.0} . + cp /usr/local/lib/{{fmt,openal,sdl,ssl,ui,uv,datachannel}.hdll,libhl.so.1.13.0} . cp /usr/local/bin/hl . ln -s libhl.so.1.13.0 libhl.so.1 ln -s libhl.so.1 libhl.so