Skip to content

Commit

Permalink
Merge pull request #87 from xmoto/prep-for-release
Browse files Browse the repository at this point in the history
Prep for release
  • Loading branch information
InfinityMin3r committed Jun 20, 2020
2 parents f7ca787 + 20d2a6b commit 4216356
Show file tree
Hide file tree
Showing 19 changed files with 323 additions and 69 deletions.
53 changes: 28 additions & 25 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
language: cpp
dist: bionic

before_install:
- sudo apt-get install -y ninja-build
- sudo apt-get install -y curl
- sudo apt-get install -y libsqlite3-dev libjpeg-dev libbz2-dev liblua5.1-0-dev zlib1g-dev libpng-dev libglu1-mesa-dev
- sudo apt-get install -y libcurl3-openssl-dev libxdg-basedir-dev libxml2-dev
- sudo apt-get install -y libsdl1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl-net1.2-dev
- sudo apt-get install -y libgl1-mesa-dev rpm

script:
- mkdir build && cd $_
- mkdir -p /tmp/xminstall
- cmake -DCMAKE_INSTALL_PREFIX=/tmp/xminstall -G Ninja ..
- ninja
- ninja xmoto_pack
- ninja install
- cpack -G "DEB"
- cpack -G "RPM"

matrix:
include:
- os: linux
dist: bionic
install: ".travis/linux/deps.sh"
script: ".travis/linux/build.sh"

- os: osx
osx_image: xcode10.1 # =10.13/high sierra
install: ".travis/macos/deps.sh"
script: ".travis/macos/build.sh"
cache:
directories:
- $HOME/Library/Caches/Homebrew
before_cache:
- brew cleanup

- os: linux
dist: bionic
name: "Linux MXE"
install: ".travis/linux-mxe/deps.sh"
script: ".travis/linux-mxe/build.sh"

deploy:
provider: releases
api_key:
secure: "XjHXrtaq9VSLL/zA1BKnrFNHrDuz4WUtn9JJs0EnngUt6zjw1q4Z2suVIw4iXWXkblWLIuA+HHXbM0RsiKHvc8FLFuZWpVkV/hz/AXLEZ40Yn+hW3b3z1zaNXFotXiKC+gmJcOgVo3/BQst1dG3gmUv2IM3JhYa4I3jzR9q5AqSqWbH8B1UdpB46St7D27kGdqt6tJAHZtKmyYRP7GfgeIVrCoOrhvgpFgzrj4p2yKy5voQWulXpyRyooaGOfXMzkcFzsiZLbJhLm3BaiFUOyRINufijjeDlyX5Df05a5x6uVxTZfjLFOyfzxTPpI/fMqNoYlRqvheoMVjGAu3s+e3KvllMM4hxD2M0J6WFV6beyzJqIwgR7Z3wgac5E2RJfQYo3S4V2SlKUAxqx4KXdQAiJ3VqdlE8V6p4eyoPIQFrJpsUfUye4d5rKj/U3SOD9OP9PDqNUEzzdwxYh4V0qexHJnegw4BOHIqIS+yr/fv2thJ27/mghG6a4rqxwbhANL7B3ZUVkFh6X+lW9lqsI+HQViJj7KbrFZNsg3rN6vwtfJsEPJctdvC26Dl8+A8vJWTQwPkiMJJSqliakR2P3XPuRRvHc28Q1tqytuVEJAJvF2/yGnGWauFLtI1D1yWlfMCNHnWftFUA3pXwr3DQoc7agKiBQjS+LU+Z58gGYB7o="
file:
file:
- 'xmoto-0.6.0.deb'
- 'xmoto-0.6.0.rpm'
- 'xmoto-0.6.0.dmg'
- 'xmoto-0.6.0-setup.exe'
- 'xmoto-0.6.0-win32.zip'
skip_cleanup: true
on:
branch: "release"
tags: true

addons:
apt:
update: true
packages:
- cmake

88 changes: 88 additions & 0 deletions .travis/linux-mxe/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/bin/sh

set -ex

# needed for cmake to find some programs
export PATH="/usr/lib/mxe/usr/bin:$PATH"

mkdir build && cd build
mkdir -p /tmp/xmoto

MXE_PATH=/usr/lib/mxe
MXE_TARGET="i686-w64-mingw32.shared"

is_broken_symlink() {
if [ -L "$1" ] && [ ! -e "$1" ]; then
return 0
else
return 1
fi
}

relink() {
for prog in "$@"; do
if is_broken_symlink "$MXE_HOST_PFX-$prog"; then
sudo rm "$MXE_HOST_PFX-$prog"
sudo ln -s "$MXE_CROSS_PFX-$prog" "$MXE_HOST_PFX-$prog"
fi
done
}

MXE_HOST_PFX="$MXE_PATH/usr/x86_64-pc-linux-gnu/bin/$MXE_TARGET"
MXE_CROSS_PFX="$MXE_PATH/usr/bin/$MXE_TARGET"

# add the mxe DLLs to wine's path
export WINEPATH="$MXE_PATH/usr/$MXE_TARGET/bin${WINEPATH:+:${WINEPATH}}"
export WINEARCH=win32

echo "MXE_PATH: $MXE_PATH"
echo "MXE HOST PREFIX: $MXE_HOST_PFX"
echo "MXE CROSS PREFIX: $MXE_CROSS_PFX"
echo "WINEPATH: $WINEPATH"

relink "gcc" "g++"

"$MXE_CROSS_PFX-cmake" \
-DCMAKE_INSTALL_PREFIX=/tmp/xmoto \
-DCMAKE_BUILD_TYPE=Release \
-DXMOTO_PACK=manual ..

make -j"$(nproc)"

Xvfb :0 -screen 0 1024x768x16 &
xvfb_pid=$!

sleep 5

echo "pidof Xvfb:"
pidof Xvfb

make xmoto_pack

# not that any reasonable PID 1 responds to SIGTERM anyway ;)
if [ "$xvfb_pid" -gt 1 ]; then
kill -15 "$xvfb_pid" || true
fi

# aaand if the graceful termination doesn't work..
jobs -p | xargs -r kill -9

#make install

"$MXE_CROSS_PFX"-cpack -G "NSIS"
"$MXE_CROSS_PFX"-cpack -G "ZIP"

fix_pkg_name() {
if [ -z "$1" ] || [ -z "$2" ]; then
>&2 echo "Error: [fix_pkg_name]: 2 parameters required"
fi
file="$1"
ext="${file##*.}"
mv "$file" "${file%.$ext}-$2${ext:+.${ext}}"
}

# add -win32 to .zip files, and -setup to .exe files
for pkg in xmoto-*.zip; do fix_pkg_name "$pkg" "win32"; done
for pkg in xmoto-*.exe; do fix_pkg_name "$pkg" "setup"; done


17 changes: 17 additions & 0 deletions .travis/linux-mxe/deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -ex

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 86B72ED9
sudo add-apt-repository 'deb [arch=amd64] http://mirror.mxe.cc/repos/apt bionic main'

# for xvfb
sudo add-apt-repository universe

sudo apt-get update

sudo apt-get install -y \
mxe-i686-w64-mingw32.shared-{cc,curl,jpeg,libpng,zlib,libxml2,sqlite,gettext} \
mxe-i686-w64-mingw32.shared-{smpeg2,sdl,sdl-mixer,sdl-net,sdl-ttf,lzma,bzip2,nsis} \
wine-stable wine32 xvfb

15 changes: 15 additions & 0 deletions .travis/linux/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

set -ex

mkdir build && cd build
mkdir -p /tmp/xminstall
cmake -DCMAKE_INSTALL_PREFIX=/tmp/xminstall \
-DCMAKE_BUILD_TYPE=Release -G Ninja ..
ninja
ninja xmoto_pack
ninja install

cpack -G "DEB"
cpack -G "RPM"

12 changes: 12 additions & 0 deletions .travis/linux/deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

set -ex

sudo apt-get update
sudo apt-get install -y \
curl ninja-build rpm \
libsqlite3-dev libjpeg-dev libbz2-dev liblua5.1-0-dev \
zlib1g-dev libpng-dev libglu1-mesa-dev \
libcurl3-openssl-dev libxdg-basedir-dev libxml2-dev libgl1-mesa-dev \
libsdl1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl-net1.2-dev

14 changes: 14 additions & 0 deletions .travis/macos/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

set -ex

mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release \
-DBUILD_MACOS_BUNDLE=ON -G Ninja ..
ninja

# Homebrew on Catalina (10.15) sets inconsistent permissions on dylibs
# and CMake happily copies them as is, and then chokes on its own brilliance.
sudo \
cpack -G DragNDrop

15 changes: 15 additions & 0 deletions .travis/macos/deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

set -ex

brew update

# packages to be checked for before installing them
for pkg in cmake ninja jpeg libpng \
bzip2 curl sqlite3 libxml2 zlib; do
brew list "$pkg" &>/dev/null || brew install "$pkg"
done

# install the rest of the packages
brew install gettext sdl sdl_mixer sdl_net sdl_ttf

21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Copyright (C) 2005-2020

# Introduction

[X-Moto Website](http://xmoto.tuxfamily.org)
[X-Moto Website](https://xmoto.tuxfamily.org)

X-Moto is a challenging 2D motocross platform game, where physics play
an all important role in the gameplay. You need to control your bike to
Expand All @@ -21,7 +21,8 @@ Download and install the game from https://xmoto.tuxfamily.org
See the wiki:
- [Windows](https://github.com/xmoto/xmoto/wiki/Building-on-Windows)
- [Linux](https://github.com/xmoto/xmoto/wiki/Building-on-Linux)
- macOS and FreeBSD are *temporarily* not supported.
- [macOS](https://github.com/xmoto/xmoto/wiki/Building-on-macOS)
- [FreeBSD](https://github.com/xmoto/xmoto/wiki/Building-on-FreeBSD)

# Basic Gameplay

Expand Down Expand Up @@ -52,12 +53,12 @@ your needs.
Additionally, some other keys can be pressed while playing:

- Escape - Pauses the game, and opens the in-game menu
- F12 - Takes a screenshot (saved in the ~/.local/share/xmoto directory)
- F12 - Takes a screenshot (saved in the ``~/.local/share/xmoto`` directory)

# Command-line Options

X-Moto supports a range of options you can specify on the command
line when starting the program. Run xmoto --help to get details on these options.
line when starting the program. Run ``xmoto --help`` to get details on these options.

# Letting X-Moto Access The Web

Expand All @@ -76,13 +77,13 @@ you're in doubt.
# Replays

X-Moto supports recording and playback of
replays. These are always stored in the Replays/ directory, which is
located in the .local/share/xmoto in the user directory.
replays. These are always stored in the ``Replays/`` directory, which is
located in the ``.local/share/xmoto`` in the user directory.
One should be aware that replays can take up quite a large amount of
harddisk space - on average you can expect a single minute of replay
to equal around 50 kilobytes. If you want to disable recording of
replays, you can set the 'StoreReplays' variable to 'false' in
config.dat, which is located in .local/share/xmoto.
replays, you can set the ``StoreReplays`` variable to ``false`` in
``config.dat``, which is located in ``~/.local/share/xmoto``.

Other things to be aware of regarding X-Moto replays:

Expand All @@ -92,8 +93,8 @@ Other things to be aware of regarding X-Moto replays:

# Advanced Configuration Options

Options are saved in a file called config.dat. The file is saved
in ~/.config/xmoto.
Options are saved in a file called ``config.dat``. The file is saved
in ``~/.config/xmoto``.
It is a plain XML text file, so it should be straight-forward to modify
in any text editor. In addition to the options accessible from inside
the game, there's a couple more, which is not interesting enough to
Expand Down
50 changes: 43 additions & 7 deletions bin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
set(XMOTO_PACK "always" CACHE STRING "When to build xmoto.bin")
set_property(CACHE XMOTO_PACK PROPERTY STRINGS "manual" "always")

add_custom_command(
OUTPUT xmoto.bin
COMMAND xmoto --pack xmoto.bin "${CMAKE_CURRENT_SOURCE_DIR}"
MAIN_DEPENDENCY package.lst
COMMENT "Packing xmoto.bin"
)
if(WIN32 AND CMAKE_CROSSCOMPILING)
add_custom_command(
OUTPUT xmoto.bin
# setting DISPLAY=:0.0 for travis
COMMAND ${CMAKE_COMMAND} -E env DISPLAY=:0.0 wine
"${PROJECT_BINARY_DIR}/src/xmoto.exe"
--pack xmoto.bin "${CMAKE_CURRENT_SOURCE_DIR}"
MAIN_DEPENDENCY package.lst
COMMENT "Packing xmoto.bin"
)
else()
add_custom_command(
OUTPUT xmoto.bin
COMMAND xmoto --pack xmoto.bin "${CMAKE_CURRENT_SOURCE_DIR}"
MAIN_DEPENDENCY package.lst
COMMENT "Packing xmoto.bin"
)
endif()

if (XMOTO_PACK STREQUAL "always")
if(XMOTO_PACK STREQUAL "always")
add_custom_target(xmoto_pack ALL DEPENDS xmoto.bin)
else()
add_custom_target(xmoto_pack DEPENDS xmoto.bin)
Expand All @@ -18,6 +30,30 @@ if(WIN32)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/xmoto.bin" DESTINATION "./")
install(DIRECTORY Textures/Musics DESTINATION ./Textures)
install(DIRECTORY Textures/Fonts DESTINATION ./Textures)
elseif(BUILD_MACOS_BUNDLE)
install(CODE "
set(RESOURCES_DIR_PATH
\"\${CMAKE_INSTALL_PREFIX}/xmoto.app/Contents/Resources\")
execute_process(COMMAND \"\${CMAKE_COMMAND}\"
-E copy
\"${CMAKE_CURRENT_BINARY_DIR}/xmoto.bin\"
\"\${RESOURCES_DIR_PATH}/xmoto.bin\"
)
# Musics
execute_process(COMMAND \"\${CMAKE_COMMAND}\"
-E copy_directory
\"${CMAKE_CURRENT_SOURCE_DIR}/Textures/Musics\"
\"\${RESOURCES_DIR_PATH}/Textures/Musics\"
)
# Fonts
execute_process(COMMAND \"\${CMAKE_COMMAND}\"
-E copy_directory
\"${CMAKE_CURRENT_SOURCE_DIR}/Textures/Fonts\"
\"\${RESOURCES_DIR_PATH}/Textures/Fonts\"
)
")
else()
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/xmoto.bin" DESTINATION share/xmoto)
install(DIRECTORY Textures/Musics DESTINATION share/xmoto/Textures)
Expand Down
24 changes: 20 additions & 4 deletions cpack/macos.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
set(CPACK_BUNDLE_NAME "XMoto")
set(CPACK_BUNDLE_PLIST macos/Info.plist)
set(CPACK_BUNDLE_ICON macos/xmoto.icns)
set(CPACK_BUNDLE_PLIST ${PROJECT_SOURCE_DIR}/macos/Info.plist)
set(CPACK_BUNDLE_ICON ${PROJECT_SOURCE_DIR}/macos/xmoto.icns)

if(MACOS)
#install(FILES macos/)
set(CPACK_DMG_VOLUME_NAME "X-Moto-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")

include(InstallRequiredSystemLibraries)

if(BUILD_MACOS_BUNDLE)
set_target_properties(xmoto PROPERTIES
MACOSX_BUNDLE_INFO_PLIST
"${PROJECT_SOURCE_DIR}/macos/Info.plist"
)
install(TARGETS xmoto
RUNTIME DESTINATION . COMPONENT Runtime
BUNDLE DESTINATION . COMPONENT Runtime
)

install(CODE "
include(BundleUtilities)
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/xmoto.app\" \"\" \"\")
" COMPONENT Runtime)
endif()

0 comments on commit 4216356

Please sign in to comment.