File indexing completed on 2022-09-27 15:18:55

0001 #!/bin/bash
0002 #
0003 # Copyright (C) 2016 Scarlett Clark <sgclark@kde.org>
0004 #
0005 # This library is free software; you can redistribute it and/or
0006 # modify it under the terms of the GNU Lesser General Public
0007 # License as published by the Free Software Foundation; either
0008 # version 2.1 of the License, or (at your option) version 3, or any
0009 # later version accepted by the membership of KDE e.V. (or its
0010 # successor approved by the membership of KDE e.V.), which shall
0011 # act as a proxy defined in Section 6 of version 3 of the license.
0012 #
0013 # This library is distributed in the hope that it will be useful,
0014 # but WITHOUT ANY WARRANTY; without even the implied warranty of
0015 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016 # Lesser General Public License for more details.
0017 #
0018 # You should have received a copy of the GNU Lesser General Public
0019 # License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0020 
0021 cd /
0022 # Get helper functions
0023 wget -q https://github.com/probonopd/AppImages/raw/master/functions.sh -O ./functions.sh
0024 . ./functions.sh
0025 rm -f functions.sh
0026 
0027 cd /app.Dir
0028 #Move binary/desktop/icon into AppDir
0029 mv /app.Dir/usr/bin/<%= binary %> .
0030 mv /app.Dir/usr/share/applications/cx.ring.ring-kde.desktop <%= binary %>.desktop
0031 cp /app.Dir/usr/share/icons/hicolor/48x48/apps/*<%= name %>* .
0032 
0033 mkdir ./etc; cp /etc/mime.types $_
0034 
0035 cp -rfv /usr/share/mime ./usr/share/
0036 update-mime-database ./usr/share/mime
0037 
0038 # Run appimage once with QT_DEBUG_PLUGINS=1 to add missing ( linuxdeployqt should install correctly)
0039 mkdir -p ./plugins; cp -r /opt/usr/plugins/{bearer,generic} $_
0040 # Bring in kf5 plugins
0041 mv /opt/usr/plugins/kf5/* ./plugins/ || true
0042 
0043 #move arch libs into same dir as rest
0044 mv /opt/usr/lib/x86_64-linux-gnu/pkgconfig/* /opt/usr/lib/pkgconfig/
0045 rmdir /opt/usr/lib/x86_64-linux-gnu/pkgconfig
0046 mv /opt/usr/lib/x86_64-linux-gnu/cmake/* /opt/usr/lib/cmake/
0047 rmdir /opt/usr/lib/x86_64-linux-gnu/cmake
0048 mv /opt/usr/lib/x86_64-linux-gnu/* /opt/usr/lib/
0049 
0050 mkdir ./lib
0051 #Uncomment for sound
0052 cp -rfv /opt/usr/lib/qt5/plugins/phonon4qt5_backend  ./plugins/
0053 cp /opt/usr/bin/gst* ./usr/bin/
0054 rm -rfv /opt/usr/lib/gstreamer-1.0/include
0055 cp /opt/usr/lib/gstreamer-1.0/* ./lib/
0056 cp /opt/usr/lib/pulseaudio/* ./lib/
0057 mv /opt/usr/libexec/gstreamer-1.0/* ./usr/bin || true
0058 
0059 rsync -aruxv --progress /opt/usr/resources/ ./usr/bin/
0060 rsync -aruxv --progress /opt/usr/translations/ ./usr/bin/
0061 
0062 
0063 mv /opt/usr/libexec/Qt* ./usr/bin/ || true
0064 
0065 unset LD_LIBRARY_PATH
0066 ~/./linuxdeployqt-1-x86_64.AppImage <%= name %> -verbose=3 -bundle-non-qt-libs -qmldir=/opt/usr/qml
0067 
0068 patch_usr
0069 glibc_needed
0070 delete_blacklisted
0071 #Cleanup
0072 # We don't bundle the developer stuff
0073 rm -rf ./usr/include || true
0074 rm -rf ./usr/lib/cmake || true
0075 rm -rf ./lib/cmake || true
0076 rm -rf ./usr/lib/pkgconfig || true
0077 rm -rf ./usr/share/ECM/ || true
0078 rm -rf ./usr/share/gettext || true
0079 rm -rf ./usr/share/pkgconfig || true
0080 rm -rf ./usr/mkspecs/ || true
0081 rm -rf ./usr/gettext-* || true
0082 rm -rf ./usr/autoconf-* || true
0083 rm -rf ./usr/automake-* || true
0084 rm -rf ./usr/libtool-* || true
0085 rm -rf ./libexec || true
0086 rm -rf ./usr/share/cmake-3.8 || true
0087 rm -rf ./usr/share/man || true
0088 rm -rf ./usr/share/doc/ECM || true
0089 rm -rf ./usr/share/doc/libdbusmenu-qt5-doc || true
0090 rm -rf ./usr/share/gtk-doc || true
0091 rm -rf ./usr/share/wallpapers || true
0092 rm -rf ./usr/share/aclocal || true
0093 rm -rf ./usr/share/bash-completion || true
0094 rm -rf ./usr/share/common-lisp || true
0095 rm -rf ./usr/share/cups || true
0096 rm -rf ./usr/share/doc/{cups,gettext,gnupg,libasprintf,pcre} || true
0097 rm -rf ./usr/share/gir-1.0 || true
0098 rm -rf ./usr/share/gnupg || true
0099 rm -rf ./usr/share/gobject-introspection-1.0 || true
0100 rm -rf ./usr/share/util-macros || true
0101 find . -name '*.a' -exec rm {} \;
0102 strip -g $(find . -type f -exec) || true
0103 find . -type f -exec file {} \; | grep "not stripped"
0104 #Add back libkrb5
0105 cp /usr/lib/x86_64-linux-gnu/libkrb5* ./lib/
0106 get_desktopintegration <%= name %>
0107 cd /source/
0108 rm -rfv appimage-exec-wrapper || true
0109 git clone git://anongit.kde.org/scratch/brauch/appimage-exec-wrapper
0110 cd /source//appimage-exec-wrapper/
0111 make clean
0112 make
0113 cp -v exec.so /app.Dir//exec_wrapper.so
0114 rm -rfv  /app/src/appimage-exec-wrapper
0115 cd /app.Dir/
0116 rm AppRun
0117 #Create AppRun
0118 cat > AppRun << EOF
0119 #!/bin/bash
0120 DIR="\`dirname \"\$0\"\`"
0121 HERE="\`( cd \"\$DIR\" && pwd )\`"
0122 export LD_PRELOAD=\$HERE/exec_wrapper.so
0123 export QML2_IMPORT_PATH=\$HERE/qml
0124 export QT_PLUGIN_PATH=\$HERE/plugins
0125 export GRANTLEE_PLUGIN_PATH=\$HERE/plugins
0126 export PATH=\$HERE/usr/bin/:\$HERE/usr/sbin/:\$HERE/usr/games/:\$HERE/bin/:\$HERE/sbin/:\$PATH
0127 export LD_LIBRARY_PATH=\$HERE/usr/lib/:\$HERE/usr/lib/x86_64-linux-gnu/:\$HERE/usr/lib64/:\$HERE/lib/:\$HERE/lib/x86_64-linux-gnu/:\$HERE/lib64/:\$LD_LIBRARY_PATH
0128 export XDG_DATA_DIRS=\$HERE/usr/share:\$HOME/.local/share:\$HERE/share:/usr/local/share/:/usr/share:\$XDG_DATA_DIRS
0129 export XDG_DATA_HOME=\$HOME/.local/share
0130 export XDG_CONFIG_DIRS=\$HERE/.config:\$HERE/etc/xdg:\$XDG_CONFIG_DIRS
0131 export KDE_FORK_SLAVES=1
0132 export KF5_LIBEXEC_DIR=\$HERE/usr/bin
0133 export GST_PLUGIN_PATH=\$HERE/lib
0134 export GST_PLUGIN_SCANNER=\$HERE/bin
0135 export QT_STYLE_OVERRIDE=
0136 dring &
0137 PID=$!
0138 <%= binary %> $@
0139 kill $PID
0140 EOF
0141 chmod +x AppRun
0142 mv <%= binary %> ./usr/bin/
0143 cp <%= binary %>.desktop ./usr/share/applications/
0144 cd ~
0145 
0146 
0147 #Appstream support for appimagetool
0148 rm -rfv /source/*
0149 
0150 
0151 
0152 #Re set LD_LIBRARY_PATH
0153 export LD_LIBRARY_PATH=/opt/usr/lib:/opt/usr/lib/x86_64-linux-gnu:/usr/lib:/usr/lib64:/lib