Skip to content

Commit

Permalink
Fix self-extract build
Browse files Browse the repository at this point in the history
`run.sh` script now used only when a self-extrcat build is invoked
via CPack.
  • Loading branch information
petarov committed May 8, 2016
1 parent 93ccfb2 commit aba0c1b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 27 deletions.
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,7 @@ configure_file (
"${PROJECT_SOURCE_DIR}/src/Config.h")

INSTALL(TARGETS savagewheels RUNTIME DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}")
if (WIN32 AND NOT UNIX)
INSTALL(PROGRAMS "${CMAKE_CURRENT_SOURCE_DIR}/run.sh" DESTINATION "${INSTALL_DIR}")
else()
if (UNIX AND NOT WIN32)
# address Arch Linux packaging by explicitly specifying data dirs
if (NOT INSTALL_DATADIR)
set(INSTALL_DATADIR "${CMAKE_INSTALL_DATADIR}")
Expand All @@ -261,8 +259,15 @@ else()
configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/savagewheels.in"
"${CMAKE_CURRENT_BINARY_DIR}/savagewheels.sh"
@ONLY)

INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/savagewheels.sh"
DESTINATION "${CMAKE_INSTALL_BINDIR}" RENAME savagewheels)

# add run.sh if building a static distro
if (CMAKE_BUILD_STATIC)
INSTALL(PROGRAMS "${CMAKE_CURRENT_SOURCE_DIR}/run.sh"
DESTINATION "./")
endif()
endif()

INSTALL(FILES
Expand Down
3 changes: 3 additions & 0 deletions HISTORY
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Savage Wheels Release HISTORY
-----------------------------

V1.6.1 Patch
* added Linux configurable game data directories

V1.6 Release
* added support for SDL_mixer sound library. It is now the default sound library used.

Expand Down
29 changes: 6 additions & 23 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ CPACK="$(which cpack)"
VERMAJ=`perl -nle 'print $1 if /.*VER_MAJ\s(\d+).*/' src/Main.h`
VERMIN=`perl -nle 'print $1 if /.*VER_MIN\s(\d+).*/' src/Main.h`
VERSION="$VERMAJ.$VERMIN"
#ARCH="$(uname -m)"
#TMP_PATH="$CUR_DIR/build/savagewheels-$VERSION-linux"

#if [ $ARCH = "x86_64" ]; then
# TMP_PATH="$TMP_PATH-x64"
#else
# TMP_PATH="$TMP_PATH-$ARCH"
#fi

usage() {
echo "dist-build.sh - Savage Wheels ${VERMAJ}.${VERMIN} distributable package build script"
Expand All @@ -32,10 +24,6 @@ usage() {
cleanup() {
echo "Cleaning up old files ..."

#if [ -e $TMP_PATH ]; then
# rm -rf $TMP_PATH
#fi

cd $BUILD_PATH
make clean
cd ..
Expand All @@ -47,12 +35,6 @@ cleanup() {

build() {
echo "Building package ..."

mkdir $TMP_PATH
if [ ! -e $TMP_PATH ]; then
echo "Dist path could not be created - $TMP_PATH"
exit
fi

if [ ! -e $CMAKE ]; then
echo "CMake was not found - $CMAKE"
Expand All @@ -64,7 +46,9 @@ build() {
fi

cd $BUILD_PATH
$CMAKE cmake -G "Unix Makefiles" ../ -DCMAKE_BUILD_TYPE:STRING=Release
$CMAKE cmake -G "Unix Makefiles" ../ \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_BUILD_STATIC=1
make -j$CPU_CORES

$CPACK
Expand All @@ -77,10 +61,9 @@ build() {

if [ "$1" = "clean" ]; then
cleanup
#elif [ "$1" = "build" ]; then
else
elif [ "$1EMPTY" = "EMPTY" ]; then
cleanup
build
#else
# usage
else
usage
fi
4 changes: 3 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
CUR_DIR="$(dirname $(readlink -f $0))"

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUR_DIR:.
export SAVAGEWHEELS_SYS_DATADIR="$CUR_DIR/share"
export SAVAGEWHEELS_LIBEXECDIR="$CUR_DIR/libexec"

# Run the game
exec ./savagewheels "$@"
exec bin/savagewheels "$@"

0 comments on commit aba0c1b

Please sign in to comment.