File indexing completed on 2022-11-29 19:42: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 
0023 # Get helper functions
0024 wget -q https://github.com/probonopd/AppImages/raw/master/functions.sh -O ./functions.sh
0025 . ./functions.sh
0026 rm -f functions.sh
0027 
0028 mkdir /<%= name %>.AppDir/
0029 
0030 cd /
0031 wget https://github.com/probonopd/linuxdeployqt/releases/download/1/linuxdeployqt-1-x86_64.AppImage
0032 chmod a+x linuxdeployqt-1-x86_64.AppImage
0033 
0034 cd /<%= name %>.AppDir
0035 
0036 #Move binary/desktop/icon into AppDir
0037 mv /opt/usr/bin/<%= binary %> .
0038 mv /opt/usr/share/applications/org.kde.<%= binary %>.desktop <%= binary %>.desktop
0039 cp /opt/usr/share/icons/hicolor/48x48/apps/*<%= name %>* .
0040 
0041 
0042 #All the plugins do not seem to be getting in. Manual copy.
0043 mkdir -p ./plugins
0044 mkdir -p ./usr/{share,bin,sbin,lib}
0045 mkdir ./etc
0046 rsync -aruxv --progress /opt/usr/plugins/ ./plugins/
0047 rsync -aruxv --progress /opt/usr/share/ ./usr/share/
0048 rsync -aruxv --progress /opt/etc/ ./etc/
0049 rsync -aruxv --progress /opt/usr/qml/ ./qml/
0050 rsync -aruxv --progress /opt/usr/resources/ ./usr/bin/
0051 rsync -aruxv --progress /opt/usr/translations/ ./usr/bin/
0052 
0053 mv /opt/usr/lib/mlt ./usr/lib/
0054 mv /usr/lib/frei0r-1/ ./usr/lib/
0055 cp /opt/usr/bin/gst* ./usr/bin/
0056 cp /usr/bin/dbus-launch ./usr/bin/
0057 cp /bin/dbus-daemon ./usr/bin/
0058 cp /opt/usr/bin/k* ./usr/bin/
0059 mkdir ./lib
0060 rm -rfv /opt/usr/lib/gstreamer-1.0/include
0061 cp -rfv /opt/usr/lib/gstreamer-1.0 ./lib/
0062 mv /opt/usr/lib/qt5/plugins/phonon4qt5_backend ./usr/lib/
0063 cp /usr/lib/x86_64-linux-gnu/pulseaudio/*.so* ./lib/
0064 cp /lib/x86_64-linux-gnu/libdbus-1.so.3* ./lib/
0065 cp -rfv /usr/share/mime ./usr/share/
0066 cp /etc/mime.types ./etc/
0067 update-mime-database ./usr/share/mime
0068 
0069 mv /opt/usr/libexec/Qt* ./usr/bin/ || true
0070 mv /opt/usr/lib/x86_64-linux-gnu/libexec/kf5/* ./usr/bin/ || true
0071 mv /opt/usr/libexec/gstreamer-1.0/* ./usr/bin/ || true
0072 cp -rfv /opt/usr/lib/x86_64-linux-gnu/* /opt/usr/lib/
0073 unset LD_LIBRARY_PATH
0074 ../linuxdeployqt-1-x86_64.AppImage <%= name %> -verbose=3 -bundle-non-qt-libs -qmldir=/opt/usr/qml
0075 
0076 patch_usr
0077 glibc_needed
0078 delete_blacklisted
0079 #Cleanup
0080 # We don't bundle the developer stuff
0081 rm -rf ./usr/include || true
0082 rm -rf ./usr/lib/cmake || true
0083 rm -rf ./lib/cmake || true
0084 rm -rf ./usr/lib/pkgconfig || true
0085 rm -rf ./usr/share/ECM/ || true
0086 rm -rf ./usr/share/gettext || true
0087 rm -rf ./usr/share/pkgconfig || true
0088 rm -rf ./usr/mkspecs/ || true
0089 rm -rf ./usr/gettext-* || true
0090 rm -rf ./usr/autoconf-* || true
0091 rm -rf ./usr/automake-* || true
0092 rm -rf ./usr/libtool-* || true
0093 rm -rf ./libexec || true
0094 rm -rf ./usr/share/cmake-3.8 || true
0095 rm -rf ./usr/share/man || true
0096 rm -rf ./usr/share/doc/ECM || true
0097 rm -rf ./usr/share/doc/libdbusmenu-qt5-doc || true
0098 rm -rf ./usr/share/gtk-doc || true
0099 rm -rf ./usr/share/wallpapers || true
0100 rm -rf ./usr/share/aclocal || true
0101 rm -rf ./usr/share/bash-completion || true
0102 rm -rf ./usr/share/common-lisp || true
0103 rm -rf ./usr/share/cups || true
0104 rm -rf ./usr/share/doc/{cups,gettext,gnupg,libasprintf,pcre} || true
0105 rm -rf ./usr/share/gir-1.0 || true
0106 rm -rf ./usr/share/gnupg || true
0107 rm -rf ./usr/share/gobject-introspection-1.0 || true
0108 rm -rf ./usr/share/util-macros || true
0109 find . -name '*.a' -exec rm {} \;
0110 find . -type f -executable -exec strip {} \;
0111 find . -type f -exec file {} \; | grep "not stripped"
0112 
0113 # Crash because KFileMetadata is linked to older FFmpeg version
0114 rm -f ./lib/libavutil.so.52
0115 rm -f ./lib/libavformat.so.54
0116 rm -f ./lib/libavcodec.so.54
0117 
0118 # libEGL crash on non debian platforms
0119 rm -f ./lib/libEGL*
0120 # libmirclient error?
0121 rm -f ./lib/libxkbcommon*
0122 #Add back libkrb5
0123 cp /usr/lib/x86_64-linux-gnu/libkrb5* ./lib/
0124 get_desktopintegration <%= name %>
0125 cd /app/src
0126 git clone git://anongit.kde.org/scratch/brauch/appimage-exec-wrapper
0127 cd /app/src/appimage-exec-wrapper/
0128 make clean
0129 make
0130 cp -v exec.so /<%= name %>.AppDir/exec_wrapper.so
0131 rm -rfv  /app/src/appimage-exec-wrapper
0132 cd /<%= name %>.AppDir
0133 rm AppRun
0134 #Create AppRun
0135 cat > AppRun << EOF
0136 #!/bin/bash
0137 DIR="\`dirname \"\$0\"\`"
0138 HERE="\`( cd \"\$DIR\" && pwd )\`"
0139 export LD_PRELOAD=\$HERE/exec_wrapper.so
0140 export QML2_IMPORT_PATH=\$HERE/qml
0141 export QT_PLUGIN_PATH=\$HERE/plugins
0142 export PATH=\$HERE/usr/bin/:\$HERE/usr/sbin/:\$HERE/usr/games/:\$HERE/bin/:\$HERE/sbin/:\$PATH
0143 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
0144 export XDG_DATA_DIRS=\$HERE/usr/share:\$HOME/.local/share:\$HERE/share:/usr/local/share/:/usr/share:\$XDG_DATA_DIRS
0145 export XDG_DATA_HOME=\$HOME/.local/share
0146 export XDG_CONFIG_DIRS=\$HERE/.config:\$HERE/etc/xdg:\$XDG_CONFIG_DIRS
0147 export KDE_FORK_SLAVES=1
0148 export KF5_LIBEXEC_DIR=\$HERE/usr/bin
0149 export GST_PLUGIN_SYSTEM_PATH=\$HERE/lib/gstreamer-1.0
0150 export GST_PLUGIN_SCANNER=\$HERE/usr/bin
0151 export MLT_REPOSITORY=\$HERE/usr/lib/mlt
0152 export MLT_DATA=\$HERE/usr/share/mlt
0153 export MLT_ROOT_DIR=\$HERE/usr
0154 export FREI0R_PATH=\$HERE/usr/lib/frei0r-1
0155 export MLT_PROFILES_PATH=\$HERE/usr/share/mlt/profiles
0156 export MLT_PRESETS_PATH=\$HERE/usr/share/mlt/presets
0157 export XDG_RUNTIME_DIR=/run/user/\$UID
0158 export SDL_AUDIODRIVER=alsa
0159 export XDG_CURRENT_DESKTOP=
0160 export QT_STYLE_OVERRIDE=
0161 
0162 kdenlive --config kdenlive-appimagerc \$@
0163 
0164 EOF
0165 chmod +x AppRun
0166 mv <%= binary %> ./usr/bin/
0167 mv /opt/usr/bin/ff* ./usr/bin/
0168 mv /usr/bin/vlc ./usr/bin/
0169 mv /opt/usr/bin/melt ./usr/bin/
0170 mv /usr/bin/{dvdauthor,mkisofs} ./usr/bin/
0171 
0172 cp <%= binary %>.desktop ./usr/share/applications/
0173 cd /
0174 wget "https://github.com/probonopd/AppImageKit/releases/download/knowngood/appimagetool-x86_64.AppImage"
0175 chmod a+x appimagetool-x86_64.AppImage
0176 
0177 ARCH=$(arch)
0178 DATE=$(date +"%Y%m%d")
0179 
0180 APPIMAGEFILENAME="<%= name %>-git$DATE-$ARCH.AppImage"
0181 
0182 #Re set LD_LIBRARY_PATH
0183 export LD_LIBRARY_PATH=/opt/usr/lib:/opt/usr/lib/x86_64-linux-gnu:/usr/lib:/usr/lib64
0184 gpg2 --import /root/.gnupg/appimage.key
0185 ./appimagetool-x86_64.AppImage -v -s -u "zsync|$APPIMAGEFILENAME" /<%= name %>.AppDir /appimage/$APPIMAGEFILENAME
0186 zsyncmake -u "https://s3-eu-central-1.amazonaws.com/ds9-apps/<%= name %>-appimage/master/$APPIMAGEFILENAME" -o /appimage/$APPIMAGEFILENAME.zsync /appimage/$APPIMAGEFILENAME
0187 ./appimagetool-x86_64.AppImage -v -s -u "zsync|<%= name %>-latest-$ARCH.AppImage" /<%= name %>.AppDir /appimage/<%= name %>-latest-$ARCH.AppImage
0188 zsyncmake -u "https://s3-eu-central-1.amazonaws.com/ds9-apps/<%= name %>-appimage/master/$APPIMAGEFILENAME" -o /appimage/<%= name %>_latestversion.zsync /appimage/$APPIMAGEFILENAME