Fixed linux build

This commit is contained in:
Michel Mastriani 2023-08-14 15:01:58 -03:00
parent adad1363c0
commit eec0be66b6
2 changed files with 204 additions and 204 deletions

View File

@ -1,203 +1,203 @@
#!/bin/bash #!/bin/bash
# The purpose of this custom AppRun script is # The purpose of this custom AppRun script is
# to allow symlinking the AppImage and invoking # to allow symlinking the AppImage and invoking
# the corresponding binary depending on which # the corresponding binary depending on which
# symlink was used to invoke the AppImage # symlink was used to invoke the AppImage
set -e set -e
if [ ! -z "$DEBUG" ] ; then if [ ! -z "$DEBUG" ] ; then
env env
set -x set -x
fi fi
THIS="$0" THIS="$0"
# http://stackoverflow.com/questions/3190818/ # http://stackoverflow.com/questions/3190818/
args=("$@") args=("$@")
NUMBER_OF_ARGS="$#" NUMBER_OF_ARGS="$#"
CONFIG_PATH=~/.config/fractorium CONFIG_PATH=~/.config/fractorium
DARK_LINUX=~/.config/fractorium/dark_linux.qss DARK_LINUX=~/.config/fractorium/dark_linux.qss
LIGHT_DARK=~/.config/fractorium/lightdark.qss LIGHT_DARK=~/.config/fractorium/lightdark.qss
URANIUM=~/.config/fractorium/uranium.qss URANIUM=~/.config/fractorium/uranium.qss
# please do not change $VENDORPREFIX as it will allow for desktop files # please do not change $VENDORPREFIX as it will allow for desktop files
# belonging to AppImages to be recognized by future AppImageKit components # belonging to AppImages to be recognized by future AppImageKit components
# such as desktop integration daemons # such as desktop integration daemons
VENDORPREFIX=appimagekit VENDORPREFIX=appimagekit
if [ -z $APPDIR ] ; then if [ -z $APPDIR ] ; then
# Find the AppDir. It is the directory that contains AppRun. # Find the AppDir. It is the directory that contains AppRun.
# This assumes that this script resides inside the AppDir or a subdirectory. # This assumes that this script resides inside the AppDir or a subdirectory.
# If this script is run inside an AppImage, then the AppImage runtime likely has already set $APPDIR # If this script is run inside an AppImage, then the AppImage runtime likely has already set $APPDIR
path="$(dirname "$(readlink -f "${THIS}")")" path="$(dirname "$(readlink -f "${THIS}")")"
while [[ "$path" != "" && ! -e "$path/$1" ]]; do while [[ "$path" != "" && ! -e "$path/$1" ]]; do
path=${path%/*} path=${path%/*}
done done
APPDIR="$path" APPDIR="$path"
fi fi
#export PATH="${APPDIR}:${APPDIR}/usr/sbin:${PATH}" #export PATH="${APPDIR}:${APPDIR}/usr/sbin:${PATH}"
#export XDG_DATA_DIRS="./share/:/usr/share/gnome:/usr/local/share/:/usr/share/:${XDG_DATA_DIRS}" #export XDG_DATA_DIRS="./share/:/usr/share/gnome:/usr/local/share/:/usr/share/:${XDG_DATA_DIRS}"
#export XDG_DATA_DIRS="${APPDIR}"/usr/share/:"${XDG_DATA_DIRS}":/usr/share/gnome/:/usr/local/share/:/usr/share/ #export XDG_DATA_DIRS="${APPDIR}"/usr/share/:"${XDG_DATA_DIRS}":/usr/share/gnome/:/usr/local/share/:/usr/share/
#export GSETTINGS_SCHEMA_DIR="${APPDIR}/usr/share/glib-2.0/schemas:${GSETTINGS_SCHEMA_DIR}" #export GSETTINGS_SCHEMA_DIR="${APPDIR}/usr/share/glib-2.0/schemas:${GSETTINGS_SCHEMA_DIR}"
export LD_LIBRARY_PATH="${APPDIR}/usr/lib:${LD_LIBRARY_PATH}" export LD_LIBRARY_PATH="${APPDIR}/usr/lib:${LD_LIBRARY_PATH}"
DESKTOP_FILE="$APPDIR/fractorium.desktop" DESKTOP_FILE="$APPDIR/fractorium.desktop"
if [ -z "$APPIMAGE_EXIT_AFTER_INSTALL" ] ; then if [ -z "$APPIMAGE_EXIT_AFTER_INSTALL" ] ; then
trap atexit EXIT trap atexit EXIT
fi fi
atexit() atexit()
{ {
if [ ! -z $APPIMAGE ] ; then if [ ! -z $APPIMAGE ] ; then
BINARY_NAME=$(basename "$ARGV0") BINARY_NAME=$(basename "$ARGV0")
if [ $NUMBER_OF_ARGS -eq 0 ] ; then if [ $NUMBER_OF_ARGS -eq 0 ] ; then
FINAL_ARGS="" FINAL_ARGS=""
else else
FINAL_ARGS="${args[@]}" FINAL_ARGS="${args[@]}"
fi fi
#echo "args: " $FINAL_ARGS #echo "args: " $FINAL_ARGS
if [ -e "$APPDIR/usr/bin/$BINARY_NAME" ] ; then if [ -e "$APPDIR/usr/bin/$BINARY_NAME" ] ; then
exec "$APPDIR/usr/bin/$BINARY_NAME" $FINAL_ARGS exec "$APPDIR/usr/bin/$BINARY_NAME" $FINAL_ARGS
else else
exec "$APPDIR/usr/bin/fractorium" $FINAL_ARGS exec "$APPDIR/usr/bin/fractorium" $FINAL_ARGS
fi fi
else else
exec "$APPDIR/usr/bin/fractorium" exec "$APPDIR/usr/bin/fractorium"
fi fi
} }
if [ ! -z $APPIMAGE ] ; then if [ ! -z $APPIMAGE ] ; then
BINARY_NAME=$(basename "$ARGV0") BINARY_NAME=$(basename "$ARGV0")
if [[ ("$BINARY_NAME" == "emberrender") || ("$BINARY_NAME" == "embergenome") || ("$BINARY_NAME" == "emberanimate") ]] ; then if [[ ("$BINARY_NAME" == "emberrender") || ("$BINARY_NAME" == "embergenome") || ("$BINARY_NAME" == "emberanimate") ]] ; then
exit 0 exit 0
fi fi
fi fi
if [ ! -e "$DARK_LINUX" ] ; then if [ ! -e "$DARK_LINUX" ] ; then
mkdir -p $CONFIG_PATH mkdir -p $CONFIG_PATH
cp $APPDIR/usr/bin/dark_linux.qss $CONFIG_PATH cp $APPDIR/usr/bin/dark_linux.qss $CONFIG_PATH
fi fi
if [ ! -e "$LIGHT_DARK" ] ; then if [ ! -e "$LIGHT_DARK" ] ; then
mkdir -p $CONFIG_PATH mkdir -p $CONFIG_PATH
cp $APPDIR/usr/bin/lightdark.qss $CONFIG_PATH cp $APPDIR/usr/bin/lightdark.qss $CONFIG_PATH
fi fi
if [ ! -e "$URANIUM" ] ; then if [ ! -e "$URANIUM" ] ; then
mkdir -p $CONFIG_PATH mkdir -p $CONFIG_PATH
cp $APPDIR/usr/bin/uranium.qss $CONFIG_PATH cp $APPDIR/usr/bin/uranium.qss $CONFIG_PATH
fi fi
check_prevent() check_prevent()
{ {
FILE=$1 FILE=$1
if [ -e "$FILE" ] ; then if [ -e "$FILE" ] ; then
exit 0 exit 0
fi fi
} }
# exit immediately of one of these files is present # exit immediately of one of these files is present
# (e.g., because the desktop environment wants to handle desktop integration itself) # (e.g., because the desktop environment wants to handle desktop integration itself)
check_prevent "$HOME/.local/share/$VENDORPREFIX/no_desktopintegration" check_prevent "$HOME/.local/share/$VENDORPREFIX/no_desktopintegration"
check_prevent "/usr/share/$VENDORPREFIX/no_desktopintegration" check_prevent "/usr/share/$VENDORPREFIX/no_desktopintegration"
check_prevent "/etc/$VENDORPREFIX/no_desktopintegration" check_prevent "/etc/$VENDORPREFIX/no_desktopintegration"
check_prevent "/usr/share/applications/Fractorium.desktop" check_prevent "/usr/share/applications/Fractorium.desktop"
check_prevent "/usr/share/applications/fractorium.desktop" check_prevent "/usr/share/applications/fractorium.desktop"
# exit immediately if appimaged is running # exit immediately if appimaged is running
pidof appimaged 2>/dev/null && exit 0 pidof appimaged 2>/dev/null && exit 0
# exit immediately if $DESKTOPINTEGRATION is not empty # exit immediately if $DESKTOPINTEGRATION is not empty
if [ ! -z "$DESKTOPINTEGRATION" ] ; then if [ ! -z "$DESKTOPINTEGRATION" ] ; then
echo "no desktop integration." echo "no desktop integration."
exit 0 exit 0
fi fi
check_dep() check_dep()
{ {
DEP=$1 DEP=$1
if [ -z $(which $DEP) ] ; then if [ -z $(which $DEP) ] ; then
echo "$DEP is missing. Skipping ${THIS}." echo "$DEP is missing. Skipping ${THIS}."
exit 0 exit 0
fi fi
} }
if [ ! -f "$DESKTOP_FILE" ] ; then if [ ! -f "$DESKTOP_FILE" ] ; then
echo "Desktop file is missing. Please run ${THIS} from within an AppImage." echo "Desktop file is missing. Please run ${THIS} from within an AppImage."
exit 0 exit 0
fi fi
if [ -z "$APPIMAGE" ] ; then if [ -z "$APPIMAGE" ] ; then
APPIMAGE="$APPDIR/AppRun" APPIMAGE="$APPDIR/AppRun"
# not running from within an AppImage; hence using the AppRun for Exec= # not running from within an AppImage; hence using the AppRun for Exec=
fi fi
# determine where the desktop file should be installed # determine where the desktop file should be installed
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
DESTINATION_DIR_DESKTOP="$HOME/.local/share/applications" DESTINATION_DIR_DESKTOP="$HOME/.local/share/applications"
SYSTEM_WIDE="" SYSTEM_WIDE=""
else else
DESTINATION_DIR_DESKTOP="/usr/local/share/applications" DESTINATION_DIR_DESKTOP="/usr/local/share/applications"
# for xdg-mime and xdg-icon-resource # for xdg-mime and xdg-icon-resource
SYSTEM_WIDE="--mode system" SYSTEM_WIDE="--mode system"
fi fi
desktopFilePath="$DESTINATION_DIR_DESKTOP/$VENDORPREFIX-fractorium.desktop" desktopFilePath="$DESTINATION_DIR_DESKTOP/$VENDORPREFIX-fractorium.desktop"
# check if the desktop file is already there and if so, whether it points to the same AppImage # check if the desktop file is already there and if so, whether it points to the same AppImage
if [ -e "$desktopFilePath" ] ; then if [ -e "$desktopFilePath" ] ; then
INSTALLED_PATH=$(grep "^Exec=" "$DESTINATION_DIR_DESKTOP/$VENDORPREFIX-fractorium.desktop" | head -n 1 | cut -d= -f2) INSTALLED_PATH=$(grep "^Exec=" "$DESTINATION_DIR_DESKTOP/$VENDORPREFIX-fractorium.desktop" | head -n 1 | cut -d= -f2)
RUNING_PATH=${APPIMAGE} RUNING_PATH=${APPIMAGE}
#echo "installed: $INSTALLED_APP_VERSION image: $APP_VERSION" #echo "installed: $INSTALLED_APP_VERSION image: $APP_VERSION"
if [ "$INSTALLED_PATH" == "$RUNING_PATH" ] ; then if [ "$INSTALLED_PATH" == "$RUNING_PATH" ] ; then
#echo "INSTALLED_PATH nothing to do" #echo "INSTALLED_PATH nothing to do"
exit 0 exit 0
fi fi
fi fi
# check whether dependencies are present in base system (we do not bundle these) # check whether dependencies are present in base system (we do not bundle these)
# http://cgit.freedesktop.org/xdg/desktop-file-utils/ # http://cgit.freedesktop.org/xdg/desktop-file-utils/
check_dep desktop-file-install check_dep desktop-file-install
check_dep xdg-icon-resource check_dep xdg-icon-resource
check_dep xdg-mime check_dep xdg-mime
check_dep xdg-desktop-menu check_dep xdg-desktop-menu
desktop-file-install --rebuild-mime-info-cache \ desktop-file-install --rebuild-mime-info-cache \
--vendor=$VENDORPREFIX --set-key=Exec --set-value=${APPIMAGE} \ --vendor=$VENDORPREFIX --set-key=Exec --set-value=${APPIMAGE} \
--set-key=X-AppImage-Comment --set-value="Generated by ${THIS}" \ --set-key=X-AppImage-Comment --set-value="Generated by ${THIS}" \
--set-icon="appimagekit-fractorium" --set-key=TryExec --set-value=${APPIMAGE// /\\s} "$DESKTOP_FILE" \ --set-icon="appimagekit-fractorium" --set-key=TryExec --set-value=${APPIMAGE// /\\s} "$DESKTOP_FILE" \
--dir "$DESTINATION_DIR_DESKTOP" \ --dir "$DESTINATION_DIR_DESKTOP" \
--mode=755 --mode=755
# uninstall previous icons # uninstall previous icons
xdg-icon-resource uninstall --noupdate --size 256 "appimagekit-fractorium" xdg-icon-resource uninstall --noupdate --size 256 "appimagekit-fractorium"
# install the icon files # install the icon files
xdg-icon-resource install --noupdate --context apps --size 256 "$APPDIR/usr/share/icons/hicolor/256x256/apps/fractorium.png" "appimagekit-fractorium" xdg-icon-resource install --noupdate --context apps --size 256 "$APPDIR/usr/share/icons/hicolor/256x256/apps/fractorium.png" "appimagekit-fractorium"
xdg-icon-resource forceupdate xdg-icon-resource forceupdate
# Install the icon files for the mime type # Install the icon files for the mime type
ICONS=$(find "${APPDIR}/usr/share/icons/" -wholename "*/mimetypes/*.png" 2>/dev/null || true) ICONS=$(find "${APPDIR}/usr/share/icons/" -wholename "*/mimetypes/*.png" 2>/dev/null || true)
for ICON in $ICONS ; do for ICON in $ICONS ; do
ICON_SIZE=$(echo "${ICON}" | rev | cut -d "/" -f 3 | rev | cut -d "x" -f 1) ICON_SIZE=$(echo "${ICON}" | rev | cut -d "/" -f 3 | rev | cut -d "x" -f 1)
xdg-icon-resource install --context mimetypes --size ${ICON_SIZE} "${ICON}" $(basename $ICON | sed -e 's/.png//g') xdg-icon-resource install --context mimetypes --size ${ICON_SIZE} "${ICON}" $(basename $ICON | sed -e 's/.png//g')
done done
xdg-desktop-menu forceupdate xdg-desktop-menu forceupdate
# for MIME # for MIME
gtk-update-icon-cache gtk-update-icon-cache

View File

@ -113,7 +113,7 @@ cd ../
# -unsupported-allow-new-glibc: Allows linuxdeployqt to run on distributions newer than the oldest still-supported Ubuntu LTS release. This will result in AppImages that will not run on all still-supported distributions, and is neither recommended nor tested or supported # -unsupported-allow-new-glibc: Allows linuxdeployqt to run on distributions newer than the oldest still-supported Ubuntu LTS release. This will result in AppImages that will not run on all still-supported distributions, and is neither recommended nor tested or supported
$LINUX_DEPLOY_QT $APP_DIR/usr/share/applications/fractorium.desktop -executable=Fractorium.AppDir/usr/bin/emberrender -executable=Fractorium.AppDir/usr/bin/embergenome -executable=Fractorium.AppDir/usr/bin/emberanimate -always-overwrite #-unsupported-allow-new-glibc $LINUX_DEPLOY_QT $APP_DIR/usr/share/applications/fractorium.desktop -executable=Fractorium.AppDir/usr/bin/emberrender -executable=Fractorium.AppDir/usr/bin/embergenome -executable=Fractorium.AppDir/usr/bin/emberanimate -always-overwrite -bundle-non-qt-libs #-unsupported-allow-new-glibc
rm $APP_DIR/AppRun rm $APP_DIR/AppRun