adonthell-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[adonthell-commits] master d9e714e: ADDED script to build portable linux


From: Kai Sterker
Subject: [adonthell-commits] master d9e714e: ADDED script to build portable linux binary using AppImageKit
Date: Tue, 16 Aug 2016 20:08:47 +0000 (UTC)

branch: master
commit d9e714ec45a54b71f07a31a7e87862ed1d104ab3
Author: Kai Sterker <address@hidden>
Commit: Kai Sterker <address@hidden>

    ADDED script to build portable linux binary using AppImageKit
---
 .gitignore           |    2 +
 Makefile.am          |    6 ++-
 README               |    5 +-
 README.Linux         |   54 +++++++++++++++++++++
 configure.ac         |    4 ++
 make_linux_appimg.sh |  131 ++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 199 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore
index 55da1b2..1b61c1b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
 .cproject
 .project
 remove-potcdate.sed
+*~
 *.o
 *.pyc
 .deps
@@ -37,3 +38,4 @@ compile
 POTFILES
 __pycache__
 /src/modules/adonthell.py
+Adonthell.AppDir
diff --git a/Makefile.am b/Makefile.am
index 6d74ab0..98cb4d9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,9 @@
 SUBDIRS = m4 po src doc
 EXTRA_DIST = config.rpath ABOUT-NLS NEWBIE autogen.sh \
-        autogen.sh adonthell.spec.in adonthell.spec README.MacOSX \
-        README.Win32 make_osx_bundle.sh make_windows_pkg.sh
+        autogen.sh adonthell.spec.in adonthell.spec \
+        README.Linux README.MacOSX README.Win32 \
+        make_linux_appimg.sh make_osx_bundle.sh \
+        make_windows_pkg.sh
 
 dist_man_MANS = adonthell.6
 
diff --git a/README b/README
index ae6b2cd..393cc20 100644
--- a/README
+++ b/README
@@ -17,7 +17,10 @@
 Installation:
 =============
 
-See the INSTALL and NEWBIE files for details.
+When compiling Adonthell from source, refer to the INSTALL and 
+NEWBIE files for details. Additional information for compiling
+on a specific platform can be found in the respective README.<os>
+files.
 
 Note that this package alone doesn't allow you to play anything - 
 you'll need a game package in addition to this one. The official
diff --git a/README.Linux b/README.Linux
new file mode 100644
index 0000000..e3b9fcc
--- /dev/null
+++ b/README.Linux
@@ -0,0 +1,54 @@
+                                       
+                                       Adonthell on GNU/Linux
+
+This file contains additional information for compiling Adonthell 
+under GNU/Linux. For general compilation instructions refer to the 
+INSTALL file. Even more details are found within the NEWBIE file.
+
+"Universal" AppImage package:
+=============================
+In order to create a binary distributable package of Adonthell 
+that is not tied to any single distribution, a set of scripts are
+provided to create a standalone AppImage package, that works in
+a similar fashion as application bundles on MacOS X.
+
+Prerequisites
+-------------
+In addition to the dependencies listed in the INSTALL file, the
+following extra packages are required:
+
+* AppImageKit 
+  https://github.com/probonopd/AppImageKit
+  
+  See https://github.com/probonopd/AppImageKit/wiki/Creating-AppImages
+  for detailed installation instructions.
+  
+* virtualenv
+  https://pypi.python.org/pypi/virtualenv
+
+  See https://virtualenv.pypa.io/en/stable/ for installation
+  instructions.
+  
+Creating Adonthell AppImage
+---------------------------
+
+In the adonthell-0.3.x directory, run
+
+    make_linux_appimg.sh
+
+If all goes well, it should configure, build and install Adonthell into
+Adonthell.AppDir, including all shared libraries and a complete Python
+environment. All that is mising now in the bundle is the actual game data.
+
+Change into the wastesedge-0.3.x directory and run
+
+    make_linux_appimg.sh ../adonthell-0.3.x/Adonthell.AppDir
+
+(adjusting the location to the .AppDir as needed). This will configure,
+build and install Waste's Edge into the Adonthell.AddDir folder, which
+then will be turned into a self-extracting, executable, compressed ISO
+image containing Adonthell and all it's dependencies, ready to run on
+(almost) any Linux system with a recent enough version of glibc.
+
+For maximum compatibility, it is recommended to create the AppImage on
+a fairly old build system.
diff --git a/configure.ac b/configure.ac
index 5edad6a..e791bd3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,6 +95,10 @@ if test x$gamedatadir = xnone; then
         gamedatadir="${datadir}"
         DEFS="$DEFS -DDATA_DIR=\"\\\"../\\\"\""
       ;;
+      *)
+        gamedatadir="${datadir}/adonthell"
+        DEFS="$DEFS -DDATA_DIR=\"\\\"../share/adonthell\\\"\""
+      ;;
     esac        
   else
     gamedatadir="${datadir}/adonthell"
diff --git a/make_linux_appimg.sh b/make_linux_appimg.sh
new file mode 100755
index 0000000..5c7ca1f
--- /dev/null
+++ b/make_linux_appimg.sh
@@ -0,0 +1,131 @@
+#!/bin/sh
+
+# -- check for virtualenv 
+if [ ! -x "$(command -v virtualenv)" ]; then
+  echo "This script requires virtualenv"
+  echo "See https://pypi.python.org/pypi/virtualenv";
+  exit 1
+fi
+
+cwd=`pwd`
+
+# -- build adonthell
+if [ ! -f "configure" ]; then
+  if [ ! -f "autogen.sh" ]; then
+    echo "This script must be run in the adonthell-0.3.x directory"
+    exit 1
+  fi
+  ./autogen.sh
+fi
+
+if [ -f "Makefile" ]; then
+   make distclean
+fi
+
+if [ -d "build" ]; then
+  rm -rf build
+fi
+
+mkdir build
+
+APP=adonthell-0.3
+
+# -- strip version from application name
+appname=`echo "$APP" | sed 's/-.*//'`
+
+# -- application folder name starts with capital| awk '{ print $3 }'
+uppercase=`echo $appname | sed 's/./\U&/'`
+appdir="$uppercase.AppDir"
+bundle="$appdir/usr"
+bindir=$bundle/bin
+libdir=$bundle/lib
+
+# -- cleanup existing bundle
+rm -rf $appdir
+
+# -- TODO: need a better way to copy all dependencies on the standard
+#          python library in one fell swoop
+
+# -- prepare python
+virtualenv -p python --always-copy --no-setuptools --no-pip $bundle
+#virtualenv --relocatable $bundle
+rm -rf $bundle/bin
+rm -rf $bundle/include
+rm -rf $bundle/local
+
+# -- we also require random.py and its dependencies
+pylibdir=`python -c 'import distutils.sysconfig; 
print(distutils.sysconfig.get_config_var("LIBP"))'`
+for i in `python -m modulefinder -x unittest $pylibdir/random.py | grep ^m | 
awk '{ print $3 }'` ; do
+    if test "x$i" = "x" ; then
+        continue
+    fi
+    cp -n "$i" $appdir$i
+done
+cp $pylibdir/random.py $appdir$pylibdir
+
+cd build
+
+# -- prepare application
+prefix=${cwd}/${bundle}
+
+configure_args="--disable-unix-install --disable-pyc --with-python=python 
--prefix=$prefix --mandir=/tmp"
+
+echo "Configuring $appname. This may take a while ..."
+../configure $configure_args > /dev/null
+if [ $? -ne 0 ]; then
+   exit 1
+fi
+
+# -- compile application
+echo "Building $appname ..."
+make V=0 -j 2
+if [ $? -ne 0 ]; then
+   exit 1
+fi
+
+
+# -- install application
+make V=0 install
+if [ $? -ne 0 ]; then
+   exit 1
+fi
+
+cd ..
+
+copyLibs()
+{
+    # -- find all non-standard shared libraries used by app
+    for i in `ldd $1 | awk '{ print $3 }' | grep -i -e /usr -e libpng` ; do
+  
+        # -- strip debug symbols
+        strip -S "$1" 
+
+        # -- strip path from library name
+        libname=`echo "$i" | sed 's/.*\///'`
+
+        # -- skip some system libs under /usr
+        if test $libname = "libstdc++.so.6" ; then
+            continue
+        fi
+
+        # -- copy them to the bundle framework directory, if not there yet
+        if [ ! -f $libdir/$libname ] ; then
+            echo "Adding $i to $libdir"
+            cp "$i" $libdir
+            copyLibs "$libdir/$libname"
+        fi
+    done
+}
+
+# -- copy shared libraries used by application
+copyLibs "$bindir/$APP"
+
+# -- copy libvorbis and dependencies
+libvorbispath=`pkg-config vorbis --variable=libdir`
+if test "x$libvorbispath" != "x" ; then
+  cp "$libvorbispath/libvorbis.so" "$libdir"
+  copyLibs "$libdir/libvorbis.so"
+else
+  echo "*** Cannot find libvorbis. Background music will not work ..."
+fi
+



reply via email to

[Prev in Thread] Current Thread [Next in Thread]