-
-
Save probonopd/02289de9ad82c41d802ac3b0a665899d to your computer and use it in GitHub Desktop.
AppImage recipe for building GIMP from git
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=1 | |
REBUILD=1 | |
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) | |
else | |
git clone https://github.com/GNOME/babl.git | |
fi | |
if [ -e gegl ]; then | |
(cd gegl; git pull origin master) | |
else | |
git clone https://github.com/GNOME/gegl.git | |
fi | |
if [ -e libmypaint ]; then | |
(cd libmypaint; git pull origin master) | |
else | |
git clone git://github.com/mypaint/libmypaint.git | |
fi | |
if [ -e mypaint ]; then | |
(cd mypaint; git pull origin master) | |
else | |
git clone git://github.com/mypaint/mypaint.git | |
fi | |
if [ -e gimp ]; then | |
(cd gimp; git pull origin master) | |
else | |
git clone https://github.com/GNOME/gimp.git | |
fi | |
if [ ! -e PhotoFlow ]; then | |
git clone https://github.com/aferrero2707/PhotoFlow.git --branch stable --single-branch PhotoFlow | |
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 | |
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 | |
if [ $? -ne 0 ]; then exit; fi | |
cd .. | |
cd libmypaint | |
./autogen.sh --prefix=$PREFIX; ./configure --prefix=$PREFIX && make && make install | |
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 | |
if [ $? -ne 0 ]; then exit; fi | |
cd .. | |
cd gmic-1.7.5_pre | |
rm -f CMakeLists.txt | |
wget https://gist.githubusercontent.com/aferrero2707/2ae108dd19bba4a9406c8cd3167a4d2a/raw/d117c6caca6ac1b4cb2519f8f3c81f6b82b4d621/CMakeLists.txt | |
mkdir -p build | |
cd build | |
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_CLI=OFF -DBUILD_PLUGIN=ON -DCMAKE_INSTALL_PREFIX=/zzz .. && make && make install | |
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 | |
cp -a ../../$LOWERAPP.launcher 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 $LOWERAPP.png -exec cp {} . \; || true | |
find ./usr/share/icons -path *512* -name $LOWERAPP.png -exec cp {} . \; || 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 | |
# 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 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) | |
GLIBC_NEEDED=$(glibc_needed) | |
VERSION=$VER1.glibc$GLIBC_NEEDED | |
echo $VERSION | |
get_desktopintegration $LOWERAPP | |
# 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