Created
September 4, 2016 12:23
-
-
Save aferrero2707/aea9aa96648078b306d6034daaf0372d to your computer and use it in GitHub Desktop.
AppImage Recipe for GIMP - full bundling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
wget -q https://github.com/probonopd/AppImages/raw/master/functions.sh -O ./functions.sh | |
. ./functions.sh | |
APP=gimp | |
VERSION=2.9.5 | |
LOWERAPP=${APP,,} | |
UPDATE=0 | |
REBUILD=0 | |
rm -rf out $APP | |
WD=$(pwd) | |
PREFIX=/zzz | |
export PATH=$PREFIX/bin:$PATH | |
export LD_LIBRARY_PATH=$PREFIX/lib:$LD_LIBRARY_PATH | |
export XDG_DATA_DIRS=$PREFIX/share:$XDG_DATA_DIRS | |
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH | |
mkdir checkout | |
cd checkout | |
if [ x"$UPDATE" = "x1" ]; then | |
if [ -e babl ]; then | |
(cd babl; git pull origin master) | |
if [ $? -ne 0 ]; then exit; fi | |
else | |
git clone https://github.com/GNOME/babl.git | |
fi | |
if [ -e gegl ]; then | |
(cd gegl; git pull origin master) | |
if [ $? -ne 0 ]; then exit; fi | |
else | |
git clone https://github.com/GNOME/gegl.git | |
fi | |
if [ -e libmypaint ]; then | |
(cd libmypaint; git pull origin master) | |
if [ $? -ne 0 ]; then exit; fi | |
else | |
git clone git://github.com/mypaint/libmypaint.git | |
fi | |
if [ -e mypaint ]; then | |
(cd mypaint; git pull origin master) | |
if [ $? -ne 0 ]; then exit; fi | |
else | |
git clone git://github.com/mypaint/mypaint.git | |
fi | |
if [ -e gimp ]; then | |
(cd gimp; git pull origin master) | |
if [ $? -ne 0 ]; then exit; fi | |
else | |
git clone https://github.com/GNOME/gimp.git -b master | |
fi | |
if [ -e resynthesizer ]; then | |
(cd resynthesizer; git pull origin master) | |
if [ $? -ne 0 ]; then exit; fi | |
else | |
git clone https://github.com/bootchk/resynthesizer.git | |
fi | |
if [ -e liblqr ]; then | |
(cd liblqr; git pull origin master) | |
else | |
git clone https://github.com/carlobaldassi/liblqr.git -b master | |
fi | |
if [ -e gimp-lqr-plugin ]; then | |
(cd gimp-lqr-plugin; git pull origin master) | |
else | |
git clone https://github.com/carlobaldassi/gimp-lqr-plugin.git -b master | |
fi | |
if [ ! -e PhotoFlow ]; then | |
git clone https://github.com/aferrero2707/PhotoFlow.git --branch stable --single-branch PhotoFlow | |
if [ $? -ne 0 ]; then exit; fi | |
else | |
(cd PhotoFlow; git pull origin stable) | |
fi | |
fi | |
if [ x"$REBUILD" = "x1" ]; then | |
cd babl | |
#./autogen.sh --prefix=$PREFIX --enable-mmx=no --enable-sse=no --enable-sse2=no --enable-sse4_1=no --enable-f16c=no --enable-altivec=no --disable-docs && make && make install | |
./autogen.sh --prefix=$PREFIX --disable-mmx --disable-sse --disable-docs && make && make install-strip | |
if [ $? -ne 0 ]; then exit; fi | |
cd .. | |
cd gegl | |
./autogen.sh --prefix=$PREFIX --disable-docs --enable-gtk-doc=no --enable-gtk-doc-html=no --enable-gtk-doc-pdf=no --enable-workshop --without-libv4l2 --without-libavformat --without-sdl && make && make install-strip | |
if [ $? -ne 0 ]; then exit; fi | |
cd .. | |
cd libmypaint | |
./autogen.sh --prefix=$PREFIX; ./configure --prefix=$PREFIX && make && make install-strip | |
if [ $? -ne 0 ]; then exit; fi | |
cd .. | |
cd gimp | |
./autogen.sh --prefix=$PREFIX --disable-gtk-doc --enable-debug=no --with-gimpdir="GIMP-AppImage" && make clean && make && make install-strip | |
#make && make install-strip | |
if [ $? -ne 0 ]; then exit; fi | |
cd .. | |
cd gmic-1.7.5 | |
rm -f CMakeLists.txt | |
rm -rf 2ae108dd19bba4a9406c8cd3167a4d2a | |
git clone https://gist.github.com/2ae108dd19bba4a9406c8cd3167a4d2a.git | |
cp 2ae108dd19bba4a9406c8cd3167a4d2a/CMakeLists.txt . | |
#wget https://gist.githubusercontent.com/aferrero2707/2ae108dd19bba4a9406c8cd3167a4d2a/raw/d117c6caca6ac1b4cb2519f8f3c81f6b82b4d621/CMakeLists.txt | |
mkdir -p build | |
cd build | |
rm -f CMakeCache.txt; cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_LIB=OFF -DBUILD_CLI=OFF -DBUILD_PLUGIN=ON -DCMAKE_INSTALL_PREFIX=/zzz .. && make VERBOSE=1 && make install | |
if [ $? -ne 0 ]; then exit; fi | |
cd ../.. | |
cd resynthesizer | |
./autogen.sh --prefix=$PREFIX && make clean && make && make install-strip | |
if [ $? -ne 0 ]; then exit; fi | |
cd .. | |
cd liblqr | |
./configure --prefix=$PREFIX && make clean && make && make install-strip | |
if [ $? -ne 0 ]; then exit; fi | |
cd .. | |
cd gimp-lqr-plugin | |
./configure --prefix=$PREFIX && make clean && make && make install-strip | |
if [ $? -ne 0 ]; then exit; fi | |
cd .. | |
mkdir -p phfbuild | |
cd phfbuild | |
cmake -DBABL_FLIPS_DISABLED=OFF -DBUNDLED_LENSFUN=ON -DBUNDLED_GEXIV2=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX -DINSTALL_PREFIX=$PREFIX $(pwd)/../PhotoFlow && make && make install | |
if [ $? -ne 0 ]; then exit; fi | |
cd .. | |
fi | |
#exit | |
cd "$WD" | |
pwd | |
mkdir -p $APP/$APP.AppDir | |
cd $APP/$APP.AppDir | |
mkdir -p usr | |
cp -rL $PREFIX/* usr | |
mv usr/bin/gimp-2.9 usr/bin/$LOWERAPP.bin | |
rm -r usr/bin/photoflow | |
rm -r usr/bin/pfbatch | |
#cp -a ../../$LOWERAPP.launcher usr/bin/$LOWERAPP | |
cat > usr/bin/$LOWERAPP <<\EOF | |
#! /bin/bash | |
HERE="$(dirname "$(readlink -f "${0}")")" | |
export GCONV_PATH=./lib/x86_64-linux-gnu/gconv | |
echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" | |
export GTK_PATH=$HERE/../lib/gtk-2.0:$GTK_PATH | |
echo "GTK_PATH=${GTK_PATH}" | |
export PF_DATA_DIR=$HERE/../share | |
export GIMP2_PLUGINDIR=$(readlink -f "$HERE/../lib/gimp/2.0") | |
echo "HERE: $HERE" | tee /tmp/gimp-appimage.log | |
echo "GIMP2_PLUGINDIR: $GIMP2_PLUGINDIR" | tee -a /tmp/gimp-appimage.log | |
echo "Input parameters: \"$@\"" | tee -a /tmp/gimp-appimage.log | |
echo "" | tee -a /tmp/gimp-appimage.log | |
echo "Input File: $1" | tee -a /tmp/gimp-appimage.log | |
ldd $HERE/LOWERAPP.bin | tee -a /tmp/gimp-appimage.log | |
echo "" | tee -a /tmp/gimp-appimage.log | |
echo "exec ../lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 --library-path ../lib:../lib/x86_64-linux-gnu:./lib:./lib/x86_64-linux-gnu $HERE/LOWERAPP.bin --pdb-compat-mode=on \"$@\"" | tee -a /tmp/gimp-appimage.log | |
exec ../lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 --library-path ../lib:../lib/x86_64-linux-gnu:./lib:./lib/x86_64-linux-gnu $HERE/LOWERAPP.bin --pdb-compat-mode=on "$@" | tee -a /tmp/gimp-appimage.log | |
EOF | |
sed -i -e "s|LOWERAPP|$LOWERAPP|g" usr/bin/$LOWERAPP | |
chmod u+x usr/bin/$LOWERAPP | |
rm -f usr/lib/gimp/2.0/plug-ins/file-darktable | |
#cp ./usr/share/applications/$LOWERAPP.desktop . | |
#sed -i -e "s|gimp-2.9|$LOWERAPP|g" $LOWERAPP.desktop | |
rm -rf ./usr/share/icons/48x48/apps || true | |
find ./usr/share/icons -path *256* -name gimp.png -exec cp {} $LOWERAPP.png \; || true | |
find ./usr/share/icons -path *512* -name gimp.png -exec cp {} $LOWERAPP.png \; || true | |
mkdir -p ./usr/lib/gtk-2.0/engines | |
echo "cp $(pkg-config --variable=libdir gtk+-2.0)/gtk-2.0/$(pkg-config --variable=gtk_binary_version gtk+-2.0)/engines/libpixmap.so ./usr/lib/gtk-2.0/engines" | |
cp $(pkg-config --variable=libdir gtk+-2.0)/gtk-2.0/$(pkg-config --variable=gtk_binary_version gtk+-2.0)/engines/libpixmap.so ./usr/lib/gtk-2.0/engines | |
get_apprun | |
# The original desktop file is a bit strange, hence we provide our own | |
cat > $LOWERAPP.desktop <<\EOF | |
[Desktop Entry] | |
Version=1.0 | |
Type=Application | |
Name=GIMP AppImage | |
GenericName=Image Editor | |
Comment=Create images and edit photographs | |
Exec=LOWERAPP %f | |
TryExec=LOWERAPP | |
Icon=LOWERAPP | |
Terminal=false | |
Categories=Graphics;2DGraphics;RasterGraphics;GTK; | |
StartupNotify=true | |
MimeType=image/bmp;image/g3fax;image/gif;image/x-fits;image/x-pcx;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-psd;image/x-sgi;image/x-tga;image/x-xbitmap;image/x-xwindowdump;image/x-xcf;image/x-compressed-xcf;image/x-gimp-gbr;image/x-gimp-pat;image/x-gimp-gih;image/tiff;image/jpeg;image/x-psp;image/png;image/x-icon;image/x-exr;image/svg+xml;image/x-wmf;image/jp2;image/jpeg2000;image/jpx;image/x-xcursor;image/x-3fr;image/x-adobe-dng;image/x-arw;image/x-bay;image/x-canon-cr2;image/x-canon-crw;image/x-cap;image/x-cr2;image/x-crw;image/x-dcr;image/x-dcraw;image/x-dcs;image/x-dng;image/x-drf;image/x-eip;image/x-erf;image/x-fff;image/x-fuji-raf;image/x-iiq;image/x-k25;image/x-kdc;image/x-mef;image/x-minolta-mrw;image/x-mos;image/x-mrw;image/x-nef;image/x-nikon-nef;image/x-nrw;image/x-olympus-orf;image/x-orf;image/x-panasonic-raw;image/x-pef;image/x-pentax-pef;image/x-ptx;image/x-pxn;image/x-r3d;image/x-raf;image/x-raw;image/x-rw2;image/x-rwl;image/x-rwz;image/x-sigma-x3f;image/x-sony-arw;image/x-sony-sr2;image/x-sony-srf;image/x-sr2;image/x-srf;image/x-x3f; | |
EOF | |
sed -i -e "s|LOWERAPP|$LOWERAPP|g" $LOWERAPP.desktop | |
# Copy in the indirect dependencies | |
copy_deps ; copy_deps ; copy_deps # Three runs to ensure we catch indirect ones | |
cp -a zzz/lib/* usr/lib | |
cp -a zzz/lib64/* usr/lib64 | |
rm -rf zzz | |
move_lib | |
#delete_blacklisted | |
mkdir -p lib/x86_64-linux-gnu | |
cp /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 lib/x86_64-linux-gnu | |
mkdir -p usr/lib/x86_64-linux-gnu | |
cp /usr/lib/x86_64-linux-gnu/gconv usr/lib/x86_64-linux-gnu | |
mkdir -p usr/share/mypaint/brushes | |
for brush in classic deevad experimental kaerhon_v1 ramon tanda; do | |
cp -r ../../checkout/mypaint/brushes/$brush usr/share/mypaint/brushes | |
done | |
# patch_usr | |
# Patching only the executable files seems not to be enough for darktable | |
find usr/ -type f -exec sed -i -e "s|$PREFIX|././|g" {} \; | |
find usr/ -type f -exec sed -i -e "s|/usr|././|g" {} \; | |
# patch for using system-supplied python interpreter | |
cp $PREFIX/lib/gimp/2.0/interpreters/pygimp.interp usr/lib/gimp/2.0/interpreters/pygimp.interp | |
# Workaround for: | |
# GLib-GIO-ERROR **: Settings schema 'org.gtk.Settings.FileChooser' is not installed | |
# when trying to use the file open dialog | |
# AppRun exports usr/share/glib-2.0/schemas/ which might be hurting us here | |
( mkdir -p usr/share/glib-2.0/schemas/ ; cd usr/share/glib-2.0/schemas/ ; ln -s /usr/share/glib-2.0/schemas/gschemas.compiled . ) | |
# Workaround for: | |
# ImportError: /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0: undefined symbol: XRRGetMonitors | |
cp $(ldconfig -p | grep libgdk-x11-2.0.so.0 | cut -d ">" -f 2 | xargs) ./usr/lib/ | |
cp $(ldconfig -p | grep libgtk-x11-2.0.so.0 | cut -d ">" -f 2 | xargs) ./usr/lib/ | |
VER1=$(pkg-config --modversion gimp-2.0)-$(date +%Y%m%d)-full | |
GLIBC_NEEDED=$(glibc_needed) | |
VERSION=$VER1.glibc$GLIBC_NEEDED | |
echo $VERSION | |
get_desktopintegration $LOWERAPP | |
#cp -a ../../desktopintegration ./usr/bin/$LOWERAPP.wrapper | |
#chmod a+x ./usr/bin/$LOWERAPP.wrapper | |
#sed -i -e "s|Exec=$LOWERAPP|Exec=$LOWERAPP.wrapper|g" $LOWERAPP.desktop | |
# Go out of AppImage | |
cd .. | |
ARCH="x86_64" | |
generate_appimage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment