Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MBU - touch up linux support and add to CI #46

Draft
wants to merge 8 commits into
base: mbu-port
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 131 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
haxelib setup ~/haxelib
haxelib list
haxelib install hashlink


- run:
name: Compile zlib
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -369,7 +369,7 @@ jobs:
export PATH=$nekopath:"$PATH"
haxelib setup ~/haxelib
haxelib list
- run:
- run:
name: Build Hashlink
command: |
mkdir ~/deps
Expand Down Expand Up @@ -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: |
Expand All @@ -452,6 +452,125 @@ 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 pkg-config
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
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

- 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
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

- run:
name: Install haxe dependencies
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
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
export PATH=~/neko/:"$PATH"
export LD_LIBRARY_PATH=~/neko
cd ~/MBHaxe
haxe compile.hxml
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.hl .
cp ~/MBHaxe/native/marblegame .
cp ~/MBHaxe/linux-dist/* .
cp -r ~/MBHaxe/data data
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
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
Comment on lines +566 to +569
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably this is some ssh server you are running locally? store_artifacts below worked for me. Might want to uncomment this block before merge to match the others

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah please uncomment this.


- store_artifacts:
path: ~/MBHaxe-Ultra-Linux.tar.gz


# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
Expand All @@ -468,4 +587,11 @@ workflows:
- build-win:
filters:
tags:
only: /^\d+.\d+.\d+$/
only: /^\d+.\d+.\d+$/

build-linux:
jobs:
- build-linux:
filters:
tags:
only: /^\d+.\d+.\d+$/
3 changes: 3 additions & 0 deletions compile-linux.hxml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion compile-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..
4 changes: 4 additions & 0 deletions linux-dist/run-marblegame-debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

cd "$(dirname "$0")"
./hl marblegame.hl
12 changes: 12 additions & 0 deletions linux-dist/run-marblegame.sh
Original file line number Diff line number Diff line change
@@ -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 $@
2 changes: 1 addition & 1 deletion src/gui/PresentsGui.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down