From 3fadf25bd025fa252eb229156dd6d3f17fb6b4a7 Mon Sep 17 00:00:00 2001 From: David Olofson Date: Wed, 8 Feb 2017 02:15:01 +0100 Subject: [PATCH] Proper itch.io/universal Linux packages 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. --- .travis.yml | 10 ++++--- add-full-data | 9 ++++--- build-packages | 9 +++++++ clean-all | 3 +++ fix-linux-bz2-package | 39 +++++++++++++++++++++++++++ install-audiality2 | 2 +- install-sdl2 | 41 +++++++++++++++++++++++++++++ linux-bundle/.itch.toml | 3 +++ linux-bundle/demo.itch.toml | 3 +++ linux-bundle/kobord-demo.sh | 4 +++ linux-bundle/kobord.sh | 4 +++ linux-bundle/koboredux-demo.desktop | 10 +++++++ linux-bundle/koboredux.desktop | 10 +++++++ 13 files changed, 139 insertions(+), 8 deletions(-) create mode 100755 fix-linux-bz2-package create mode 100755 install-sdl2 create mode 100644 linux-bundle/.itch.toml create mode 100644 linux-bundle/demo.itch.toml create mode 100755 linux-bundle/kobord-demo.sh create mode 100755 linux-bundle/kobord.sh create mode 100755 linux-bundle/koboredux-demo.desktop create mode 100755 linux-bundle/koboredux.desktop diff --git a/.travis.yml b/.travis.yml index 6a5c984..79befb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 @@ -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 @@ -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 diff --git a/add-full-data b/add-full-data index 919b9b2..74637c4 100755 --- a/add-full-data +++ b/add-full-data @@ -57,7 +57,7 @@ fix_permissions() { # -# Bzip2 +# Bzip2 (flattened!) # rebuild_bzip2() { @@ -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} diff --git a/build-packages b/build-packages index ae00812..b1a916c 100755 --- a/build-packages +++ b/build-packages @@ -5,6 +5,8 @@ if [ ! -d "build" ]; then ./cfg-all fi +./install-sdl2 +./install-audiality2 ./install-demo-data ./install-full-data ./install-win32-redist @@ -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 diff --git a/clean-all b/clean-all index d880084..cfeef8c 100755 --- a/clean-all +++ b/clean-all @@ -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 diff --git a/fix-linux-bz2-package b/fix-linux-bz2-package new file mode 100755 index 0000000..74f2293 --- /dev/null +++ b/fix-linux-bz2-package @@ -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!" diff --git a/install-audiality2 b/install-audiality2 index d5b16a0..b61b193 100755 --- a/install-audiality2 +++ b/install-audiality2 @@ -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 diff --git a/install-sdl2 b/install-sdl2 new file mode 100755 index 0000000..a60ba9d --- /dev/null +++ b/install-sdl2 @@ -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/* diff --git a/linux-bundle/.itch.toml b/linux-bundle/.itch.toml new file mode 100644 index 0000000..55f95f8 --- /dev/null +++ b/linux-bundle/.itch.toml @@ -0,0 +1,3 @@ +[[actions]] +name = "play" +path = "kobord.sh" diff --git a/linux-bundle/demo.itch.toml b/linux-bundle/demo.itch.toml new file mode 100644 index 0000000..7bf87ff --- /dev/null +++ b/linux-bundle/demo.itch.toml @@ -0,0 +1,3 @@ +[[actions]] +name = "play" +path = "kobord-demo.sh" diff --git a/linux-bundle/kobord-demo.sh b/linux-bundle/kobord-demo.sh new file mode 100755 index 0000000..3dcc5aa --- /dev/null +++ b/linux-bundle/kobord-demo.sh @@ -0,0 +1,4 @@ +#!/bin/bash +cd "`dirname "$0"`" +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib/ +./kobord-demo $@ diff --git a/linux-bundle/kobord.sh b/linux-bundle/kobord.sh new file mode 100755 index 0000000..48ae6c6 --- /dev/null +++ b/linux-bundle/kobord.sh @@ -0,0 +1,4 @@ +#!/bin/bash +cd "`dirname "$0"`" +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib/ +./kobord $@ diff --git a/linux-bundle/koboredux-demo.desktop b/linux-bundle/koboredux-demo.desktop new file mode 100755 index 0000000..db4a9fa --- /dev/null +++ b/linux-bundle/koboredux-demo.desktop @@ -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; diff --git a/linux-bundle/koboredux.desktop b/linux-bundle/koboredux.desktop new file mode 100755 index 0000000..c6f18ea --- /dev/null +++ b/linux-bundle/koboredux.desktop @@ -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;