Skip to content

Create AppImage #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Jun 15, 2016
Merged
16 changes: 11 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
sudo: required
dist: trusty
language: cpp

os:
Expand All @@ -12,14 +14,18 @@ before_install:
# g++ 4.8 for std=c++11
- if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.8; fi
# additional headerfiles
- sudo apt-get install libXxf86vm-dev libXi-dev libudev-dev libXcursor-dev
- sudo apt-get install -f qtbase5-dev qt5-default qttools5-dev-tools libqt5opengl5-dev
- sudo apt-get install libfreeimage-dev libopencv-core-dev libopencv-core-dev libopencv-imgproc-dev libopencv-highgui-dev
- sudo apt-get -y install libXxf86vm-dev libXi-dev libudev-dev libXcursor-dev
- sudo apt-get -y install -f qtbase5-dev qt5-default qttools5-dev-tools libqt5opengl5-dev
- sudo apt-get -y install libfreeimage-dev libopencv-core-dev libopencv-core-dev libopencv-imgproc-dev libopencv-highgui-dev

script:
- qmake -recursive QMAKE_CXX=g++-4.8 QMAKE_CC=gcc-4.8
- qmake -recursive QMAKE_CXX=g++-4.8 QMAKE_CC=gcc-4.8 PREFIX=/app
- make
- sudo make install
- find /app
- curl --upload-file /app/bin/imageplay https://transfer.sh/imageplay
- bash -ex appimage.sh

branches:
only:
- master
- master
116 changes: 116 additions & 0 deletions appimage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#!/bin/bash

########################################################################
# Package the binaries built on Travis-CI as an AppImage
# By Simon Peter 2016
# For more information, see http://appimage.org/
########################################################################

export ARCH=$(arch)

APP=ImagePlay
LOWERAPP=${APP,,}

GIT_REV=$(git rev-parse --short HEAD)
echo $GIT_REV

mkdir -p $HOME/$APP/$APP.AppDir/usr/bin/

cd $HOME/$APP/

wget -q https://github.com/probonopd/AppImages/raw/master/functions.sh -O ./functions.sh
. ./functions.sh

cd $APP.AppDir

sudo chown -R $USER /app/
sed -i -e 's|/app|././|g' /app/bin/imageplay

cp /app/bin/imageplay ./usr/bin/

########################################################################
# Copy desktop and icon file to AppDir for AppRun to pick them up
########################################################################

get_apprun

# FIXME: Use the official .desktop file - where is it?
cat > $LOWERAPP.desktop <<EOF
[Desktop Entry]
Name=$APP
Icon=$LOWERAPP
Type=Application
Comment=$APP
Categories=Graphics;
Exec=$LOWERAPP
EOF

find ../../ -name ImagePlay.png -exec cp {} imageplay.png \;

########################################################################
# Copy in the dependencies that cannot be assumed to be available
# on all target systems
########################################################################

# FIXME: How to find out which subset of plugins is really needed?
mkdir -p ./usr/lib/qt5/plugins/
PLUGINS=/usr/lib/x86_64-linux-gnu/qt5/plugins/
cp -r $PLUGINS/* ./usr/lib/qt5/plugins/

copy_deps

# Move the libraries to usr/bin
move_lib
mv usr/lib/x86_64-linux-gnu/* usr/lib/

########################################################################
# Delete stuff that should not go into the AppImage
########################################################################

# Delete dangerous libraries; see
# https://github.com/probonopd/AppImages/blob/master/excludelist
delete_blacklisted

# We don't bundle the developer stuff
rm -rf usr/include || true
rm -rf usr/lib/cmake || true
rm -rf usr/lib/pkgconfig || true
find . -name '*.la' | xargs -i rm {}
strip usr/bin/* usr/lib/* || true

########################################################################
# desktopintegration asks the user on first run to install a menu item
########################################################################

get_desktopintegration $LOWERAPP

########################################################################
# Determine the version of the app; also include needed glibc version
########################################################################

GLIBC_NEEDED=$(glibc_needed)
VERSION=git$GIT_REV-glibc$GLIBC_NEEDED

########################################################################
# Patch away absolute paths; it would be nice if they were relative
########################################################################

patch_usr
# Possibly need to patch additional hardcoded paths away, replace
# "/usr" with "././" which means "usr/ in the AppDir"

########################################################################
# AppDir complete
# Now packaging it as an AppImage
########################################################################

cd .. # Go out of AppImage

mkdir -p ../out/
generate_appimage

########################################################################
# Upload the AppDir
########################################################################

transfer ../out/*