diff --git a/.gitignore b/.gitignore index 9a05c74..2ce3986 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,6 @@ trace-*.json *.blend *.blend1 - # Don't need this .vscode/ @@ -28,14 +27,19 @@ trace-*.json temp/ -*.zip -*.tar.gz - +# MacOS .package/.dmg related files .DS_Store *.dmg - !platforms/macos/Martian\ Chess.app/Contents/Info.plist platforms/macos icon_*.png *.iconset *.icns + +# Linux AppImage related build files +platforms/linux +AppRun +*.AppImage +*.zip +*.tar.gz +.DirIcon diff --git a/platforms/linux/MartianChess.AppDir/martian-chess.desktop b/platforms/linux/MartianChess.AppDir/martian-chess.desktop new file mode 100644 index 0000000..2c3acb3 --- /dev/null +++ b/platforms/linux/MartianChess.AppDir/martian-chess.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=MartianChess +Exec=martian-chess +Icon=martian-chess +Type=Application +Categories=Game;BoardGame; diff --git a/scripts/build-linux.sh b/scripts/build-linux.sh new file mode 100755 index 0000000..1e0bac9 --- /dev/null +++ b/scripts/build-linux.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +cargo run --target x86_64-unknown-linux-gnu --release diff --git a/scripts/icons-linux.sh b/scripts/icons-linux.sh new file mode 100755 index 0000000..1b846a4 --- /dev/null +++ b/scripts/icons-linux.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +cp media/MartianChess.png platforms/linux/MartianChess.AppDir/martian-chess.png diff --git a/scripts/package-linux.sh b/scripts/package-linux.sh index 3a77c77..b8e1e5e 100755 --- a/scripts/package-linux.sh +++ b/scripts/package-linux.sh @@ -1,5 +1,23 @@ #!/usr/bin/env bash -# cargo build --release +APP_DIR=platforms/linux/MartianChess.AppDir/ -tar -czvf martian-chess-linux-beta.tar.gz --exclude windows ./lib ./assets -C ./target/release martian-chess +# Copy binary to build dir +TARGET_DIR=target/x86_64-unknown-linux-gnu/release/ +BUILD_BIN=$TARGET_DIR/martian-chess +PACKAGE_BIN=$APP_DIR/AppRun +cp -f $BUILD_BIN $PACKAGE_BIN + +# Copy dynamic libraries +PACKAGE_LIB_DIR=$APP_DIR/usr/lib/ +LIB_DIR=lib/linux/ +mkdir -p $PACKAGE_LIB_DIR +cp -f $LIB_DIR/* $PACKAGE_LIB_DIR/ + +# Copy assets +cp -rf assets $APP_DIR/ + +# Build AppImage file +DEST_DIR=packages/MartianChess.AppImage +ARCH=x86_64 +appimagetool $APP_DIR $DEST_DIR diff --git a/shell.nix b/shell.nix index c3df45b..8aa7dbb 100644 --- a/shell.nix +++ b/shell.nix @@ -20,6 +20,7 @@ mkShell rec { libxkbcommon wayland # To use the wayland feature gimp ffmpeg + appimagekit # Building appimages ]; LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs;