Skip to content

Commit

Permalink
Proper itch.io/universal Linux packages
Browse files Browse the repository at this point in the history
Travis CI and build-packages now install the latest stable SDL2 and
(minimal PNG-only) SDL2_image from source. These libs are stripped and
included in the itch.io/Linux tar.bz2 packages.

The tar.bz2 archives from CPack are flattened, and SDL2 libs, an itch.io
manifest, a .desktop file, and a wrapper script is added, so that these
archives can be unpacked and used as is, either manually, or via the
itch.io app.

Closes #361.
  • Loading branch information
olofson committed Feb 9, 2017
1 parent 8918a72 commit 3fadf25
Show file tree
Hide file tree
Showing 13 changed files with 139 additions and 8 deletions.
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ dist: trusty

before_install:
- sudo apt-get update -qq
- sudo apt-get install -y libsdl2-dev libsdl2-image-dev
- sudo apt install rpm
- ./install-sdl2
- ./install-audiality2
- if [[ "$DEMO" == "ON" ]]; then ./install-demo-data; fi

Expand All @@ -29,6 +29,8 @@ script:
- cmake -DCMAKE_INSTALL_PREFIX=/usr -DDEMO_BUILD=$DEMO ..
- make
- make package
- cd ..
- ./fix-linux-bz2-package build/koboredux-*-Linux.tar.bz2

deploy:
skip_cleanup: true
Expand All @@ -37,9 +39,9 @@ deploy:
secure: FA4FE9EvlMu40snssAbcB/HSv8mqomC5N28/f5pSxggfCXeNKbL1NH7lT+/4dafJxkh1VjdAmUI/ENHnyP8h8a6lIrXD6YRTboV2n0WCovBguqKR4d5TTG1izeVHgHfy5iPFiSpg/bjNntrUCpq7oQ0BPeKcsvuZzBgOfLJYBObkCSb7pron4p22N4b19TS8LGWpzA2XOB74LXs2YkftjtMLjTdoemnJxXBAZKMa2H5UbyCtJTqHuM5pq0uHuaIbSjZLL/5/QR5mbeSzVxL93q2eGUR22MZgqhRiCLxKO48xQv7twH/NYiI+U4cw+DB3UmWtUFZUEdZ061kWS8RLpXYIcBakPT33EgBeSeAReNESvoQi1t42/kPmyweU0i1X77c6V/Wcw1jgS7yYVESbpQdemBHf1WSoam0tCJ7QnW9KuN+o19/O13Ic3IN0RvXlyTQnrZntxs7OtTxutGCSFuqIOCoFYT9wLhbjO0MNLL6ojnKkaoFjuCv/RDae1rJksKrNRh4wx0u0DQIeQ5mNWOViFerB4ocKD9uwrBhfgIn5kyrJlvxc8yCv5jmshaJNZBCZn3DOPjhyTkqbzB/tbGe8YsXBnUVWCDktjvj3U9ykSBkx/AYKgXB4mHsbpc+2SLuQ4NPiYrQykKABXFASC+yl36y1QZ0Fo0mT1w1bvG4=
file-glob: true
file:
- koboredux-*-Linux.deb
- koboredux-*-Linux.rpm
- koboredux-*-Linux.tar.bz2
- build/koboredux-*-Linux.deb
- build/koboredux-*-Linux.rpm
- build/koboredux-*-Linux.tar.bz2
on:
tags: true
repo: olofson/koboredux
9 changes: 6 additions & 3 deletions add-full-data
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fix_permissions() {


#
# Bzip2
# Bzip2 (flattened!)
#

rebuild_bzip2() {
Expand All @@ -66,9 +66,12 @@ rebuild_bzip2() {
tar -xjvf ${BZIP2ARCH}
rm -rf ${BZIP2ARCH}

add_data_files "${PACKAGENAME}/${DATADIR}"
add_data_files "${PACKAGENAME}"

fix_permissions "${PACKAGENAME}"
find . -type d -print0 | xargs -0 chmod 755
find . -type f -print0 | xargs -0 chmod 644
find kobord* -type f -print0 | xargs -0 chmod 755
find *.desktop -type f -print0 | xargs -0 chmod 755

# Repackage and clean up
BZIP2=--best tar -cvjSf ${BZIP2ARCH} ${PACKAGENAME}
Expand Down
9 changes: 9 additions & 0 deletions build-packages
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ if [ ! -d "build" ]; then
./cfg-all
fi

./install-sdl2
./install-audiality2
./install-demo-data
./install-full-data
./install-win32-redist
Expand Down Expand Up @@ -36,9 +38,16 @@ for i in $BUILDDIR/$FILTER ; do
echo "[ Leaving $(basename $i) ]"
echo
done
cd ${SOURCEDIR}

# HAX: Can't get CPack to stop adding those bogus directories...
for a in ${PKGDIR}/KoboRedux-*-win32.zip ; do
echo $a
zip -d $a */home/*
done

# HAX: No reliable way of selectively flattening archives with CPack. >:-/
for a in ${PKGDIR}/koboredux-*-Linux.tar.bz2 ; do
echo $a
${SOURCEDIR}/fix-linux-bz2-package $a
done
3 changes: 3 additions & 0 deletions clean-all
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ rm -rf packages full-packages
rm -rf koboreduxassets audiality2
rm -rf win32-redist
rm -f copyright
rm -rf SDL2-2*
rm -rf SDL2_image-2*
rm -rf linux-bundle-lib
39 changes: 39 additions & 0 deletions fix-linux-bz2-package
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
SOURCEDIR="$(pwd)"
PKGPATH=$1
ARCHNAME=$(basename ${PKGPATH%})
PKGNAME=${ARCHNAME%.*.*}
[[ ${PKGNAME} == *"demo"* ]] && DEMO="-demo" || DEMO=""

cd $(dirname ${PKGPATH})

echo "Flattening package ${PKGNAME}..."

# Extract
tar -xjvf ${ARCHNAME}
rm -f ${ARCHNAME}
mv ${PKGNAME} orig-pkg

# Rebuild
mkdir ${PKGNAME}
mv orig-pkg/usr/bin/kobord${DEMO} ${PKGNAME}
mv orig-pkg/usr/share/koboredux${DEMO}/* ${PKGNAME}
mv orig-pkg/usr/share/doc/koboredux${DEMO}/* ${PKGNAME}
if [[ ${DEMO} == "" ]] ; then
cp ${SOURCEDIR}/linux-bundle/.itch.toml ${PKGNAME}
else
cp ${SOURCEDIR}/linux-bundle/demo.itch.toml ${PKGNAME}/.itch.toml
fi
cp ${SOURCEDIR}/linux-bundle/kobord${DEMO}.sh ${PKGNAME}
cp ${SOURCEDIR}/linux-bundle/koboredux${DEMO}.desktop ${PKGNAME}
mkdir ${PKGNAME}/lib
cp ${SOURCEDIR}/linux-bundle-lib/* ${PKGNAME}/lib

# Archive
BZIP2=--best tar -cvjSf ${ARCHNAME} ${PKGNAME}

# Clean up
rm -rf ${PKGNAME}
rm -rf orig-pkg

echo "Package ${PKGNAME} flattened!"
2 changes: 1 addition & 1 deletion install-audiality2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
. ./PACKAGEDEFS

if pkg-config audiality2 --exists; then
echo "Audiality 2 already installed on the system!"
echo "Audiality 2 already installed in the system!"
exit
fi

Expand Down
41 changes: 41 additions & 0 deletions install-sdl2
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/sh
set -ex

SDLRELEASE=2.0.5
SDLURL="https://www.libsdl.org/release/SDL2-${SDLRELEASE}.tar.gz"

IMGRELEASE=2.0.1
IMGURL="https://www.libsdl.org/projects/SDL_image/release/SDL2_image-${IMGRELEASE}.tar.gz"

rm -rf linux-bundle-lib
mkdir linux-bundle-lib

# SDL2
if pkg-config sdl2 --exists; then
echo "SDL2 already installed in the system!"
else
curl -O ${SDLURL}
tar -xzvf SDL2-${SDLRELEASE}.tar.gz
cd SDL2-${SDLRELEASE}
./configure --prefix=/usr
make
sudo make install
cp -L build/.libs/libSDL2-*.so.0 ../linux-bundle-lib
cd ..
fi

# SDL2_image
if [ -f "/usr/include/SDL2/SDL_image.h" ]; then
echo "SDL2_image already installed in the system!"
else
curl -O ${IMGURL}
tar -xzvf SDL2_image-${IMGRELEASE}.tar.gz
cd SDL2_image-${IMGRELEASE}
./configure --prefix=/usr --disable-bmp --disable-gif --disable-jpg --disable-jpg-shared --disable-lbm --disable-pcx --enable-png --enable-png-shared --disable-pnm --disable-tga --disable-tif --disable-tif-shared --disable-xcf --disable-xpm --disable-xv --disable-webp --disable-webp-shared
make
sudo make install
cp -L .libs/libSDL2_image-*.so.0 ../linux-bundle-lib
cd ..
fi

strip linux-bundle-lib/*
3 changes: 3 additions & 0 deletions linux-bundle/.itch.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[[actions]]
name = "play"
path = "kobord.sh"
3 changes: 3 additions & 0 deletions linux-bundle/demo.itch.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[[actions]]
name = "play"
path = "kobord-demo.sh"
4 changes: 4 additions & 0 deletions linux-bundle/kobord-demo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
cd "`dirname "$0"`"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib/
./kobord-demo $@
4 changes: 4 additions & 0 deletions linux-bundle/kobord.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
cd "`dirname "$0"`"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib/
./kobord $@
10 changes: 10 additions & 0 deletions linux-bundle/koboredux-demo.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=Kobo Redux Demo
GenericName=Arcade Game
Comment=Arcade style 2D shooter (Demo version)
TryExec=kobord-demo
Exec=bash -c '"$(dirname "$1")"/kobord-demo.sh' dummy %k
Terminal=false
Categories=Application;Game;ArcadeGame;2DGraphics;
10 changes: 10 additions & 0 deletions linux-bundle/koboredux.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=Kobo Redux
GenericName=Arcade Game
Comment=Arcade style 2D shooter
TryExec=kobord
Exec=bash -c '"$(dirname "$1")"/kobord.sh' dummy %k
Terminal=false
Categories=Application;Game;ArcadeGame;2DGraphics;

0 comments on commit 3fadf25

Please sign in to comment.