linux installer changes

This commit is contained in:
Michel Mastriani 2019-05-07 21:29:49 -03:00
parent b4ba6d6a82
commit abbbd1de87
7 changed files with 452 additions and 0 deletions

184
Data/AppRun Executable file
View File

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

41
Data/Fractorium.spec Normal file
View File

@ -0,0 +1,41 @@
%define _topdir %(pwd)
%define buildroot %{_topdir}/BUILDROOT
Name: Fractorium
Version: 1.0.0.15
Release: 1
Summary: A fractal flame editor with GPU support
Group: Graphics
BuildArch: x86_64
License: GPL
URL: https://mfeemster@bitbucket.org/mfeemster/fractorium.git
BuildRoot: %{buildroot}
%description
Fractorium
A fractal flame editor with GPU support.
http://fractorium.com/
The project is maintained on Bitbucket:
https://bitbucket.org/mfeemster/fractorium
News and updates at the above or on Matt Feemster's DeviantArt page:
http://mfeemster.deviantart.com/
%files
%attr(0755, root, root) "/usr/bin/Fractorium-x86_64.AppImage"
/usr/bin/emberanimate
/usr/bin/embergenome
/usr/bin/emberrender
/usr/bin/fractorium
%attr(0644, root, root) "/usr/share/applications/fractorium.desktop"
%attr(0644, root, root) "/usr/share/fractorium/fractorium.png"
%changelog

26
Data/control.package Normal file
View File

@ -0,0 +1,26 @@
Source: Fractorium
Section: graphics
Priority: optional
Maintainer: Gambhiro Bhikkhu <matt.feemster@gmail.com>
Build-Depends: debhelper (>= 9)
Standards-Version: 3.9.5
Homepage: http://fractorium.com/
Vcs-Git: https://bitbucket.org/mfeemster/fractorium
Vcs-Browser: https://bitbucket.org/mfeemster/fractorium
Package: Fractorium
Version: 1.0.0.15
Architecture: amd64
Description: A fractal flame editor with GPU support
Fractorium
.
A fractal flame editor with GPU support.
.
http://fractorium.com/
.
The project is maintained on Bitbucket:
.
https://bitbucket.org/mfeemster/fractorium
.
News and updates at the above or on Matt Feemster's DeviantArt page:
.
http://mfeemster.deviantart.com/

View File

@ -0,0 +1,12 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=Fractorium
GenericName=Fractal flame editor
Comment=Fractal flame editor
Exec=fractorium
TryExec=fractorium
Icon=fractorium
Terminal=false
Categories=Graphics;
MimeType=

View File

@ -0,0 +1,12 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=Fractorium
GenericName=Fractal flame editor
Comment=Fractal flame editor
Exec=fractorium
TryExec=fractorium
Icon=/usr/share/fractorium/fractorium.png
Terminal=false
Categories=Graphics;
MimeType=

1
archive/build.sh Normal file → Executable file
View File

@ -49,6 +49,7 @@ cd $OSX_BUILD_PATH
cd ../Data
cp dark_mac.qss $FRACTORIUM_FINAL_ROOT
cp lightdark.qss $FRACTORIUM_FINAL_ROOT
cp flam3-palettes.xml $FRACTORIUM_FINAL_ROOT
cp *.gradient $FRACTORIUM_FINAL_ROOT
cp *.ugr $FRACTORIUM_FINAL_ROOT

176
archive/build_linux.sh Executable file
View File

@ -0,0 +1,176 @@
#!/bin/bash
echo "Creating the AppImage."
BUILD_PATH=$PWD
FRACTORIUM_RELEASE_ROOT=$PWD/../Bin/release
DATA_PATH=$BUILD_PATH/../Data
ICON_PATH=$BUILD_PATH/../Source/Fractorium/Icons
APP_DIR=$PWD/../Bin/Fractorium.AppDir
FRACTORIUM_PACKAGE=$BUILD_PATH/../Bin/Fractorium
FRACTORIUM_RPM_PACKAGE=$BUILD_PATH/../Bin/rpmbuild
EXTRA_LIBS=/usr/lib/x86_64-linux-gnu
#######################
#simple check
if [ ! -d "$FRACTORIUM_RELEASE_ROOT" ]; then
echo "release foulder not found. Please, build the project."
exit 2
fi
if [ -d "$APP_DIR" ]; then
echo "Fractorium.AppDir folder already exists in Bin: $APP_DIR"
echo "Move this folder aside or remove it."
exit 2
fi
if [ -d "$FRACTORIUM_PACKAGE" ]; then
echo "Fractorium folder already exists in Bin: $FRACTORIUM_PACKAGE"
echo "Move this folder aside or remove it."
exit 2
fi
if [ -d "$FRACTORIUM_RPM_PACKAGE" ]; then
echo "rpmbuild folder already exists in Bin: $FRACTORIUM_RPM_PACKAGE"
echo "Move this folder aside or remove it."
exit 2
fi
#######################
# replace 5.12.2 by your QT version, and check if the instation path is the same
export PATH=/home/$USER/Qt/5.12.2/gcc_64/bin:$PATH
LINUX_DEPLOY_QT=/home/$USER/Qt/linuxdeployqt-6-x86_64.AppImage
APP_IMAGE_TOOL=/home/$USER/Qt/appimagetool-x86_64.AppImage
cd $FRACTORIUM_RELEASE_ROOT
FRACTORIUM_BIN=usr/bin
FRACTORIUM_LIB=usr/lib
FRACTORIUM_SHR=usr/share/applications
FRACTORIUM_ICO=usr/share/icons/hicolor/256x256/apps
mkdir -p $FRACTORIUM_BIN
mkdir -p $FRACTORIUM_LIB
mkdir -p $FRACTORIUM_SHR
mkdir -p $FRACTORIUM_ICO
mv ember* $FRACTORIUM_BIN
mv fractorium $FRACTORIUM_BIN
mv lib* $FRACTORIUM_LIB
cp $EXTRA_LIBS/libHalf.so.12 $FRACTORIUM_LIB
cp $EXTRA_LIBS/libIex-2_2.so.12 $FRACTORIUM_LIB
cp $EXTRA_LIBS/libIexMath-2_2.so.12 $FRACTORIUM_LIB
cp $EXTRA_LIBS/libIlmImf-2_2.so.22 $FRACTORIUM_LIB
cp $EXTRA_LIBS/libIlmThread-2_2.so.12 $FRACTORIUM_LIB
cp $EXTRA_LIBS/libImath-2_2.so.12 $FRACTORIUM_LIB
cp $EXTRA_LIBS/libjpeg.so.8 $FRACTORIUM_LIB
cp $EXTRA_LIBS/libpng16.so.16 $FRACTORIUM_LIB
cp $EXTRA_LIBS/libOpenCL.so.1 $FRACTORIUM_LIB
cp $EXTRA_LIBS/libtbb.so.2 $FRACTORIUM_LIB
cp $DATA_PATH/dark_linux.qss $FRACTORIUM_BIN
cp $DATA_PATH/lightdark.qss $FRACTORIUM_BIN
cp $DATA_PATH/flam3-palettes.xml $FRACTORIUM_BIN
cp $DATA_PATH/*.gradient $FRACTORIUM_BIN
cp $DATA_PATH/*.ugr $FRACTORIUM_BIN
cp $ICON_PATH/Fractorium.png $FRACTORIUM_ICO
mv $FRACTORIUM_ICO/Fractorium.png $FRACTORIUM_ICO/fractorium.png
cp $DATA_PATH/fractorium.appimage.desktop $FRACTORIUM_SHR
mv $FRACTORIUM_SHR/fractorium.appimage.desktop $FRACTORIUM_SHR/fractorium.desktop
cd ../
mv release Fractorium.AppDir
# LINUX_DEPLOY_QT OPTIONS
# -unsupported-bundle-everything: Bundles ALL dependency libraries, down to and including the ld-linux.so loader and glibc. This will allow applications built on newer systems to run on older target systems, but it is not recommended since it leads to bundles that are larger than necessary
# -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
rm $APP_DIR/AppRun
cp $DATA_PATH/AppRun $APP_DIR
$APP_IMAGE_TOOL $APP_DIR
echo ""
echo "Creating the DEB package."
echo ""
mkdir -p Fractorium
mkdir -p Fractorium/DEBIAN
mkdir -p Fractorium/usr/bin
mkdir -p Fractorium/usr/share/applications
mkdir -p Fractorium/usr/share/fractorium
cp Fractorium-x86_64.AppImage Fractorium/usr/bin
cp $DATA_PATH/fractorium.package.desktop Fractorium/usr/share/applications
mv Fractorium/usr/share/applications/fractorium.package.desktop Fractorium/usr/share/applications/fractorium.desktop
cp $ICON_PATH/Fractorium.png Fractorium/usr/share/fractorium
mv Fractorium/usr/share/fractorium/Fractorium.png Fractorium/usr/share/fractorium/fractorium.png
cp $DATA_PATH/control.package Fractorium/DEBIAN
mv Fractorium/DEBIAN/control.package Fractorium/DEBIAN/control
#creating symbolic links
cd ./Fractorium/usr/bin
ln -s Fractorium-x86_64.AppImage fractorium
ln -s Fractorium-x86_64.AppImage emberrender
ln -s Fractorium-x86_64.AppImage embergenome
ln -s Fractorium-x86_64.AppImage emberanimate
cd ../../../
dpkg --build Fractorium
echo ""
echo "Creating RPM package"
echo ""
mkdir -p rpmbuild
mkdir -p rpmbuild/BUILD
mkdir -p rpmbuild/BUILDROOT
mkdir -p rpmbuild/RPMS
mkdir -p rpmbuild/SOURCES
mkdir -p rpmbuild/SPECS
mkdir -p rpmbuild/SRPMS
mkdir -p rpmbuild/tmp
cp $DATA_PATH/Fractorium.spec rpmbuild/SPECS
cd Fractorium
cp -r usr ../rpmbuild/BUILDROOT
cd ../rpmbuild
rpmbuild -v -bb SPECS/Fractorium.spec
cd ../
mv rpmbuild/RPMS/x86_64/* ./
emberVersion=$(grep '#define EMBER_VERSION' ../Source/Ember/EmberDefines.h | sed 's/^.*EMBER_VERSION "\([^"]\+\)".*/\1/')
mv Fractorium.deb Fractorium-$emberVersion-.x86_64.deb
mv Fractorium-$emberVersion-1.x86_64.rpm Fractorium-$emberVersion.x86_64.rpm
tar -czvf Fractorium-$emberVersion.x86_64.AppImage.tar.gz Fractorium-x86_64.AppImage
#cleaning
rm -rf Fractorium
rm -rf Fractorium.AppDir
rm -rf rpmbuild
rm -rf Fractorium-x86_64.AppImage