From https://github.com/probonopd/AppImageKit/wiki:
It's kinda like a .App on OSX, and it works surprisingly well. It's a binary file with a compressed filesystem image attached, which will be mounted on start.What is an AppImage?
An AppImage is a downloadable file for Linux that contains an application and everything the application needs to run (e.g., libraries, icons, fonts, translations, etc.) that cannot be reasonably expected to be part of each target system.
To create an AppImage you'll need to save this YAML file, ie. as XnViewMP.yml:
Code: Select all
app: XnViewMP
ingredients:
dist: precise
packages:
- libasound2
- libatk1.0-0
- libc6
- libcairo2
- libcups2
- libfontconfig1
- libfreetype6
- libgcc1
- libgdk-pixbuf2.0-0
- libgl1-mesa-glx
- libglib2.0-0
- libgstreamer0.10-0
- libgstreamer-plugins-base0.10-0
- libgtk2.0-0
- libice6
- libpango-1.0-0
- libpangocairo-1.0-0
- libpangoft2-1.0-0
- libpulse0
- libsm6
- libsqlite3-0
- libstdc++6
- libx11-6
- libx11-xcb1
- libxcb1
- libxcomposite1
- libxext6
- libxi6
- libxml2
- libxrender1
- libxslt1.1
- zlib1g
sources:
- deb http://archive.ubuntu.com/ubuntu/ precise main restricted universe
- deb http://archive.ubuntu.com/ubuntu/ precise-updates main restricted universe
- deb http://archive.ubuntu.com/ubuntu/ precise-security main restricted universe
script:
- VERSION=$(wget -q -O- http://www.xnview.com/xnviewmp_update.txt | sed -n -e 's/^version=//p' | sed -e 's/\r//g')
- wget -c http://download.xnview.com/old_versions/XnViewMP-$(echo $VERSION | tr -d '.')-linux-x64.tgz
- wget -c http://archive.ubuntu.com/ubuntu/pool/main/c/chrpath/chrpath_0.13-2build2_amd64.deb -O chrpath.deb
- echo $VERSION > VERSION
script:
- dpkg -x ../chrpath.deb ../chrpath
- tar xf ../XnViewMP-*-linux-x64.tgz
- ../chrpath/usr/bin/chrpath -d XnView/XnView
- find XnView/* -type f -name *.so* -exec ../chrpath/usr/bin/chrpath -d '{}' \;
- mkdir -p usr/bin usr/share/icons/hicolor/64x64/apps
- mv XnView/ usr/
- cat > usr/bin/xnviewmp <<\EOF
- #!/bin/sh
- usr="$(pwd)"
- export GST_PLUGIN_PATH="$usr/lib/x86_64-linux-gnu/gstreamer-0.10"
- export GST_PLUGIN_SCANNER="$usr/lib/x86_64-linux-gnu/gstreamer0.10/gstreamer-0.10/gst-plugin-scanner"
- export LD_LIBRARY_PATH="$usr/XnView/lib:$usr/XnView/Plugins:$LD_LIBRARY_PATH"
- export QT_PLUGIN_PATH="$usr/XnView/lib:$QT_PLUGIN_PATH"
- "$usr/XnView/XnView" "$@"
- EOF
- chmod a+x usr/bin/xnviewmp
- cat > xnviewmp.desktop <<\EOF
- [Desktop Entry]
- Type=Application
- Name=XnView MP
- Comment=Graphic viewer, browser, converter
- Exec=xnviewmp %U
- Terminal=false
- Icon=xnviewmp
- Categories=Graphics;
- StartupNotify=true
- MimeType=image/bmp;image/gif;image/jpeg;image/png;image/tiff;image/x-tga;image/x-pcx;image/jp2;
- EOF
- cp ./usr/XnView/xnview.png xnviewmp.png
- cp xnviewmp.png ./usr/share/icons/hicolor/64x64/apps/
Code: Select all
sudo apt-get install fuse
sudo modprobe fuse
user="$(whoami)"
sudo usermod -a -G fuse $user
Code: Select all
wget -O Recipe https://raw.githubusercontent.com/probonopd/AppImages/master/recipes/meta/Recipe
bash Recipe XnViewMP.yml
Code: Select all
#!/bin/sh
echo "wait a few seconds..."
alldeps="$( (find ./* -type f -exec readelf -d '{}' 2>/dev/null \;) | grep 'NEEDED' | cut -d '[' -f2 | tr -d ']' | sort | uniq )"
for f in $alldeps; do
if [ "x$(find ./* -name $f)" = "x" ]; then
deps="$deps $f"
fi
done
for f in $deps; do
if [ "$f" = "libGL.so.1" ]; then
pkgs="$pkgs libgl1-mesa-glx"
else
pkgs="$pkgs $(dpkg -S $f | grep "amd64" | grep "\/$f\$" | head -n1 | cut -d: -f1)"
fi
done
echo ""
echo "dependencies are:"
echo "$pkgs" | tr ' ' '\n' | sort | uniq
- since AppImages are already compressed, it's recommended to not put them into a zip or tar archive, but instead provide downloads to the raw .AppImage files
- the older the system the binaries were build on, and the older the distribution set in the YAML file, the more downwards compatible are those AppImages
- the AppImage created on my system has a size of 59 MiB, only 10 MiB bigger than the original tarball
- the current build system only supports 64 bit x86 architecture (x86-64, amd64)