AppImage recipe for Hugin
#! /bin/bash | |
UPDATE=0 | |
REBUILD=1 | |
PREFIX=/xxx | |
# Move blacklisted files to a special folder | |
move_blacklisted() | |
{ | |
mkdir -p ./usr/lib-blacklisted | |
if [ x"$FULL_BUNDLING" = "x1" ]; then | |
BLACKLISTED_FILES=$(cat $APPIMAGEBASE/AppImages/excludelist | sed '/^\s*$/d' | sed '/^#.*$/d') | |
else | |
BLACKLISTED_FILES=$(wget -q https://github.com/probonopd/AppImages/raw/master/excludelist -O - | sed '/^\s*$/d' | sed '/^#.*$/d') | |
fi | |
#echo $BLACKLISTED_FILES | |
for FILE in $BLACKLISTED_FILES ; do | |
FOUND=$(find . -type f -name "${FILE}" 2>/dev/null) | |
if [ ! -z "$FOUND" ] ; then | |
echo "Moving blacklisted ${FOUND}" | |
#rm -f "${FOUND}" | |
mv "${FOUND}" ./usr/lib-blacklisted | |
fi | |
done | |
} | |
export APPIMAGEBASE=$(pwd)/.. | |
wget -q https://github.com/probonopd/AppImages/raw/master/functions.sh -O ./functions.sh | |
. ./functions.sh | |
APP=Hugin | |
LOWERAPP=${APP,,} | |
#sudo add-apt-repository -y ppa:pmjdebruijn/darktable-unstable | |
# sudo add-apt-repository -y ppa:pmjdebruijn/darktable-release | |
#sudo apt-get update | |
rm -rf out $APP | |
WD=$(pwd) | |
#sudo apt-get -y install $LOWERAPP | |
if [ x"$REBUILD" = "x1" ]; then | |
rm -r $PREFIX/* | |
mkdir -p build/hugin | |
cd build/hugin | |
cmake -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_BUILD_TYPE=Release -DBUILD_HSI:BOOL=OFF ../../checkout/hugin-2016.2.0 && make && make install | |
fi | |
#exit | |
cd "$WD" | |
pwd | |
mkdir -p $APP/$APP.AppDir | |
cd $APP/$APP.AppDir | |
#find /var/cache/apt/archives/*$LOWERAPP* -exec dpkg -x {} . \; || true | |
#find /var/cache/apt/archives/*-data* -exec dpkg -x {} . \; || true | |
mkdir -p usr | |
cp -rL $PREFIX/* usr | |
mv usr/bin/$LOWERAPP usr/bin/$LOWERAPP.bin | |
cat > usr/bin/$LOWERAPP <<\EOF | |
#! /bin/bash | |
pwd | |
HERE="$(dirname "$(readlink -f "${0}")")" | |
ldd $HERE/LOWERAPP.bin | |
export PATH=$HERE:$PATH | |
export LD_LIBRARY_PATH=$HERE/../lib:$HERE/../lib/hugin:$HERE/../lib64:$LD_LIBRARY_PATH | |
echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" | |
export XDG_DATA_DIRS=$HERE/../share-mime:$XDG_DATA_DIRS | |
echo "XDG_DATA_DIRS=$XDG_DATA_DIRS" | |
echo "Input parameters: \"$@\"" | |
echo "" | |
echo "Input File: $1" | |
echo "" | |
cpfind | |
echo "" | |
echo "$HERE/LOWERAPP.bin \"$@\"" | |
$HERE/LOWERAPP.bin "$@" | |
EOF | |
sed -i -e "s|LOWERAPP|$LOWERAPP|g" usr/bin/$LOWERAPP | |
chmod u+x usr/bin/$LOWERAPP | |
cp ./usr/share/applications/$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 | |
get_apprun | |
# Copy in the indirect dependencies | |
copy_deps ; copy_deps ; copy_deps # Three runs to ensure we catch indirect ones | |
cp -a xxx/lib/* usr/lib | |
cp -a xxx/lib64/* usr/lib64 | |
rm -rf xxx | |
move_lib | |
delete_blacklisted | |
# 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" {} \; | |
# 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=$(find /var/cache/apt/archives/ -name $LOWERAPP"*" | head -n 1 | cut -d "~" -f 1 | cut -d "+" -f 2 | cut -d "-" -f 1 | sed -e 's|1%3a||g' ) | |
#VER1=$(find /var/cache/apt/archives/ -name $LOWERAPP"*" | head -n 1 | cut -d "~" -f 1 | cut -d "+" -f 2 | cut -d "-" -f 1 ) | |
GLIBC_NEEDED=$(glibc_needed) | |
VERSION=2016.2.0.be8da0221960.glibc$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