Add snapcraft configuration to build snaps

master
Alan Pope 2017-05-01 15:57:33 +01:00
parent 467fc3ce0d
commit 8427df283f
4 changed files with 136 additions and 0 deletions

View File

@ -0,0 +1,12 @@
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=openspades %U
Name=OpenSpades
GenericName=Sandbox building and FPS videogame
Comment=Open-source clone of Ace of Spades
Keywords=game;fps;sandbox;voxel;aos;
Icon=${SNAP}/meta/gui/openspades.png
Categories=Game;ActionGame;
MimeType=x-scheme-handler/aos;

BIN
snap/gui/openspades.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

68
snap/scripts/launch_openspades Executable file
View File

@ -0,0 +1,68 @@
#!/bin/bash
case "$SNAP_ARCH" in
"amd64") ARCH='x86_64-linux-gnu'
;;
"i386") ARCH='i386-linux-gnu'
;;
*)
echo "Unsupported architecture for this app build"
exit 1
;;
esac
if [ ! -f $SNAP_USER_DATA/.local/share/openspades/Resources ];
then
mkdir -p $SNAP_USER_DATA/.local/share/openspades/Resources
cp $SNAP/share/games/openspades/Resources/* $SNAP_USER_DATA/.local/share/openspades/Resources
echo cl_checkForUpdates: 1 > $SNAP_USER_DATA/.local/share/openspades/Resources/SPConfig.cfg
echo s_eax: 1 >> $SNAP_USER_DATA/.local/share/openspades/Resources/SPConfig.cfg
fi
export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH:$LD_LIBRARY_PATH
# XKB config
export XKB_CONFIG_ROOT=$SNAP/usr/share/X11/xkb
export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/pulseaudio:$LD_LIBRARY_PATH
# Mesa Libs
export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/mesa:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/mesa-egl:$LD_LIBRARY_PATH
# XDG Config
export XDG_CONFIG_DIRS=$SNAP/etc/xdg:$XDG_CONFIG_DIRS
export XDG_CONFIG_DIRS=$SNAP/usr/xdg:$XDG_CONFIG_DIRS
# Note: this doesn't seem to work, QML's LocalStorage either ignores
# or fails to use $SNAP_USER_DATA if defined here
export XDG_DATA_DIRS=$SNAP_USER_DATA:$XDG_DATA_DIRS
export XDG_DATA_DIRS=$SNAP/usr/share:$XDG_DATA_DIRS
# Workaround in snapd for proprietary nVidia drivers mounts the drivers in
# /var/lib/snapd/lib/gl that needs to be in LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/var/lib/snapd/lib/gl:$LD_LIBRARY_PATH
# Not good, needed for fontconfig
export XDG_DATA_HOME=$SNAP_USER_DATA/usr/share
# Font Config
export FONTCONFIG_PATH=$SNAP/etc/fonts/config.d
export FONTCONFIG_FILE=$SNAP/etc/fonts/fonts.conf
# Tell libGL where to find the drivers
export LIBGL_DRIVERS_PATH=$SNAP/usr/lib/$ARCH/dri
# Necessary for the SDK to find the translations directory
export APP_DIR=$SNAP
# Use GTK styling for running under Unity 7
export DESKTOP_SESSION=ubuntu
export XDG_SESSION_DESKTOP=ubuntu
export XDG_CURRENT_DESKTOP=Unity
#export LIBGL_DEBUG="verbose"
export XLOCALEDIR="$SNAP/usr/share/X11/locale"
export LOCPATH="$SNAP/usr/lib/locale"
$SNAP/games/openspades "$@"

56
snap/snapcraft.yaml Normal file
View File

@ -0,0 +1,56 @@
name: openspades
version: 'master'
summary: Sandbox building and FPS videogame
description: |
OpenSpades is a compatible client of Ace of Spades 0.75.
Can connect to a vanilla/pyspades/pysnip server.
Uses OpenGL/AL for better experience.
Open source, and cross platform.
grade: stable
confinement: strict
apps:
openspades:
command: launch_openspades
plugs:
- network
- network-bind
- opengl
- x11
- pulseaudio
parts:
scripts:
plugin: dump
source: snap/scripts
organize:
'launch_openspades': bin/
openspades:
plugin: cmake
configflags: [-DCMAKE_BUILD_TYPE=RelWithDebInfo]
source: .
build-packages:
- clang
- imagemagick
- wget
- zip
- unzip
- pkg-config
- libglew-dev
- libcurl4-openssl-dev
- libsdl2-dev
- libsdl2-image-dev
- libalut-dev
- xdg-utils
- libfreetype6-dev
- libopus-dev
- libopusfile-dev
- libjpeg-dev
- libxinerama-dev
- libxft-dev
stage-packages:
- libgl1-mesa-dri
- libgl1-mesa-glx
- libglew1.13
- libopenal1