File indexing completed on 2024-04-21 04:36:23

0001 #!/bin/bash
0002 
0003 # Halt on errors
0004 set -e
0005 
0006 # Be verbose
0007 set -x
0008 
0009 # Now we are inside CentOS 6
0010 grep -r "CentOS release 6" /etc/redhat-release || exit 1
0011 
0012 git_pull_rebase_helper()
0013 {
0014     git fetch
0015     git stash || true
0016     git rebase $(git rev-parse --abbrev-ref --symbolic-full-name @{u}) || true
0017     git stash pop || true
0018 }
0019 
0020 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
0021 
0022 QTDIR=/opt/qt5
0023 
0024 if [ -z "$KDEVELOP_VERSION" ]; then
0025     KDEVELOP_VERSION=5.6
0026 fi
0027 if [ -z "$KDEV_PG_QT_VERSION" ]; then
0028     KDEV_PG_QT_VERSION=v2.2.1
0029 fi
0030 KF5_VERSION=v5.73.0
0031 LIBKSYSGUARD_VERSION=v5.18.5 # 5.19 needs Qt 5.14
0032 BREEZESTYLE_VERSION=v5.19.5
0033 KDE_RELEASESERVICE_VERSION=v20.08.1
0034 GRANTLEE_VERSION=v5.2.0
0035 OKTETA_VERSION=v0.26.4
0036 
0037 export LLVM_ROOT=/opt/llvm/
0038 export PATH=/opt/rh/python27/root/usr/bin/:$PATH
0039 export LD_LIBRARY_PATH=/opt/rh/python27/root/usr/lib64:$LD_LIBRARY_PATH
0040 
0041 # qjsonparser, used to add metadata to the plugins needs to work in a en_US.UTF-8 environment. That's
0042 # not always set correctly in CentOS 6.7
0043 export LANG=en_US.UTF-8
0044 
0045 # Determine which architecture should be built
0046 if [[ "$(arch)" = "i686" || "$(arch)" = "x86_64" ]] ; then
0047   ARCH=$(arch)
0048 else
0049   echo "Architecture could not be determined"
0050   exit 1
0051 fi
0052 
0053 # Make sure we build from the /, parts of this script depends on that. We also need to run as root...
0054 cd  /
0055 
0056 # Use the new compiler
0057 . /opt/rh/devtoolset-6/enable
0058 
0059 # TODO: Use these vars more
0060 export FAKEROOT=/kdevelop.appdir
0061 export PREFIX=/kdevelop.appdir/usr/
0062 export SRC=$HOME/src/
0063 export BUILD=$HOME/build
0064 export CMAKE_PREFIX_PATH=$QTDIR:/kdevelop.appdir/share/llvm/
0065 
0066 # if the library path doesn't point to our usr/lib, linking will be broken and we won't find all deps either
0067 export LD_LIBRARY_PATH=/usr/lib64/:/usr/lib:/kdevelop.appdir/usr/lib:$QTDIR/lib/:/opt/python3.6/lib/:$LD_LIBRARY_PATH
0068 
0069 # Workaround for: On CentOS 6, .pc files in /usr/lib/pkgconfig are not recognized
0070 # However, this is where .pc files get installed when bulding libraries... (FIXME)
0071 # I found this by comparing the output of librevenge's "make install" command
0072 # between Ubuntu and CentOS 6
0073 ln -sf /usr/share/pkgconfig /usr/lib/pkgconfig
0074 
0075 # Prepare the install location
0076 if [ -z "$SKIP_PRUNE" ]; then
0077     rm -rf /kdevelop.appdir/ || true
0078     mkdir -p /kdevelop.appdir/usr
0079 
0080     # refresh ldconfig cache
0081     ldconfig
0082 
0083     # make sure lib and lib64 are the same thing
0084     mkdir -p /kdevelop.appdir/usr/lib
0085     cd  /kdevelop.appdir/usr
0086     ln -s lib lib64
0087 fi
0088 
0089 # start building the deps
0090 # usage: build_project <repourl> <repodirectory> <branch/tag>
0091 function build_project
0092 { (
0093     REPOURL=$1
0094     PROJECT=$2
0095     VERSION=$3
0096     shift
0097     shift
0098     shift
0099 
0100     # clone if not there
0101     mkdir -p $SRC
0102     cd $SRC
0103     if ( test -d $PROJECT )
0104     then
0105         echo "$PROJECT already cloned"
0106         cd $PROJECT
0107         git stash
0108         git reset --hard
0109         git fetch
0110         git fetch --tags
0111         cd ..
0112     else
0113         git clone $REPOURL $PROJECT
0114     fi
0115 
0116     cd $PROJECT
0117     git checkout $VERSION
0118     git rebase $(git rev-parse --abbrev-ref --symbolic-full-name @{u}) || true # git rebase will fail if a tag is checked out
0119     git stash pop || true
0120     cd ..
0121 
0122     if [ ! -z "$PATCH_FILE" ]; then
0123         pushd $PROJECT
0124         echo "Patching $PROJECT with $PATCH_FILE"
0125         git reset --hard
0126         patch -p1 < $PATCH_FILE
0127         popd
0128     fi
0129 
0130     # create build dir
0131     mkdir -p $BUILD/$PROJECT
0132 
0133     # go there
0134     cd $BUILD/$PROJECT
0135 
0136     # cmake it
0137     cmake3 $SRC/$PROJECT -G Ninja -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX $@
0138 
0139     # make
0140     ninja
0141 
0142     # install
0143     ninja install
0144 ) }
0145 
0146 function build_kde_project
0147 { (
0148     REPOPATH=$1
0149     PROJECT=${1#*/}
0150     shift
0151     build_project https://invent.kde.org/$REPOPATH.git $PROJECT $@
0152 ) }
0153 
0154 function build_framework
0155 { (
0156     PROJECT=$1
0157     shift
0158     build_kde_project frameworks/$PROJECT $KF5_VERSION $@
0159 ) }
0160 
0161 # KDE Frameworks
0162 if [ -z "$SKIP_FRAMEWORKS" ]; then
0163 build_framework extra-cmake-modules -DBUILD_HTML_DOCS=OFF -DBUILD_MAN_DOCS=OFF
0164 
0165 build_framework kconfig
0166 build_framework kguiaddons
0167 build_framework ki18n
0168 build_framework kitemviews -DBUILD_DESIGNERPLUGIN=OFF
0169 build_framework sonnet -DBUILD_DESIGNERPLUGIN=OFF
0170 build_framework kwindowsystem
0171 build_framework kwidgetsaddons -DBUILD_DESIGNERPLUGIN=OFF
0172 build_framework kcompletion -DBUILD_DESIGNERPLUGIN=OFF
0173 build_framework kdbusaddons
0174 build_framework karchive
0175 build_framework kcoreaddons
0176 build_framework kjobwidgets
0177 build_framework kcrash
0178 build_framework kservice
0179 build_framework kcodecs
0180 build_framework kauth
0181 build_framework kconfigwidgets -DBUILD_DESIGNERPLUGIN=OFF
0182 build_framework kiconthemes -DBUILD_DESIGNERPLUGIN=OFF
0183 build_framework ktextwidgets -DBUILD_DESIGNERPLUGIN=OFF
0184 build_framework kglobalaccel
0185 build_framework kxmlgui -DBUILD_DESIGNERPLUGIN=OFF
0186 build_framework kbookmarks
0187 build_framework solid
0188 build_framework kio -DBUILD_DESIGNERPLUGIN=OFF
0189 build_framework kparts
0190 build_framework kitemmodels
0191 build_framework threadweaver
0192 build_framework attica
0193 build_framework kpackage
0194 build_framework knewstuff
0195 build_framework syntax-highlighting
0196 build_framework ktexteditor
0197 build_framework kdeclarative
0198 build_framework kcmutils
0199 (PATCH_FILE=$SCRIPT_DIR/knotifications_no_phonon.patch build_framework knotifications)
0200 (PATCH_FILE=$SCRIPT_DIR/knotifyconfig_no_phonon.patch build_framework knotifyconfig)
0201 build_framework kdoctools
0202 build_framework breeze-icons -DBINARY_ICONS_RESOURCE=1
0203 build_framework kpty
0204 build_framework kinit 
0205 fi
0206 
0207 # KDE Plasma
0208 build_kde_project plasma/libksysguard $LIBKSYSGUARD_VERSION
0209 (PATCH_FILE=$SCRIPT_DIR/breeze-noconstexpr.patch build_kde_project plasma/breeze $BREEZESTYLE_VERSION -DWITH_DECORATIONS=OFF -DWITH_WALLPAPERS=OFF)
0210 
0211 # KDE Applications
0212 build_kde_project sdk/libkomparediff2 $KDE_RELEASESERVICE_VERSION
0213 build_kde_project utilities/kate $KDE_RELEASESERVICE_VERSION -DDISABLE_ALL_OPTIONAL_SUBDIRECTORIES=TRUE -DBUILD_addons=TRUE -DBUILD_snippets=TRUE -DBUILD_kate-ctags=TRUE
0214 build_kde_project utilities/konsole $KDE_RELEASESERVICE_VERSION
0215 build_kde_project utilities/okteta $OKTETA_VERSION -DBUILD_DESIGNERPLUGIN=OFF -DBUILD_OKTETAKASTENLIBS=OFF
0216 
0217 # Extra
0218 build_project https://github.com/steveire/grantlee.git  grantlee $GRANTLEE_VERSION -DBUILD_TESTS=OFF
0219 
0220 # KDevelop
0221 build_kde_project kdevelop/kdevelop-pg-qt $KDEV_PG_QT_VERSION
0222 build_kde_project kdevelop/kdevelop $KDEVELOP_VERSION
0223 build_kde_project kdevelop/kdev-php $KDEVELOP_VERSION
0224 
0225 # Build kdev-python
0226 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH/kdevelop.appdir/usr/lib/
0227 build_kde_project kdevelop/kdev-python $KDEVELOP_VERSION
0228 
0229 # Install some colorschemes
0230 cd $BUILD
0231 $SRC/kdevelop/release-scripts/install_colorschemes.py /kdevelop.appdir/usr/share
0232 
0233 cd /kdevelop.appdir
0234 
0235 # FIXME: How to find out which subset of plugins is really needed? I used strace when running the binary
0236 mkdir -p ./usr/lib/qt5/plugins/
0237 
0238 PLUGINS=$($QTDIR/bin/qmake -query QT_INSTALL_PLUGINS)
0239 
0240 echo "Using plugin dir: $PLUGINS"
0241 cp -r $PLUGINS/bearer ./usr/lib/qt5/plugins/
0242 cp -r $PLUGINS/generic ./usr/lib/qt5/plugins/
0243 cp -r $PLUGINS/imageformats ./usr/lib/qt5/plugins/
0244 cp -r $PLUGINS/platforms ./usr/lib/qt5/plugins/
0245 cp -r $PLUGINS/iconengines ./usr/lib/qt5/plugins/
0246 cp -r $PLUGINS/platforminputcontexts ./usr/lib/qt5/plugins/
0247 # cp -r $PLUGINS/platformthemes ./usr/lib/qt5/plugins/
0248 cp -r $PLUGINS/sqldrivers ./usr/lib/qt5/plugins/ # qsqlite is required for the Welcome Page plugin and for QtHelp
0249 cp -r $PLUGINS/xcbglintegrations ./usr/lib/qt5/plugins/
0250 
0251 mkdir -p ./usr/lib/qt5/qml
0252 QML_DIR=$QTDIR/qml
0253 # for the Welcome Page plugin
0254 cp -r $QML_DIR/QtQuick ./usr/lib/qml
0255 cp -r $QML_DIR/QtQuick.2 ./usr/lib/qml
0256 
0257 cp -R /kdevelop.appdir/usr/lib/grantlee/ /kdevelop.appdir/usr/lib/qt5/plugins/
0258 rm -Rf /kdevelop.appdir/usr/lib/grantlee
0259 
0260 mkdir -p /kdevelop.appdir/$LLVM_ROOT/lib/
0261 cp -r $LLVM_ROOT/lib/clang /kdevelop.appdir/$LLVM_ROOT/lib
0262 
0263 cp -ru /usr/share/mime/* /kdevelop.appdir/usr/share/mime
0264 update-mime-database /kdevelop.appdir/usr/share/mime/
0265 
0266 cp -R ./usr/lib/plugins/* ./usr/lib/qt5/plugins/
0267 rm -Rf ./usr/lib/plugins/
0268 
0269 cp $(ldconfig -p | grep libsasl2.so.2 | cut -d ">" -f 2 | xargs) ./usr/lib/
0270 # Fedora 23 seemed to be missing SOMETHING from the Centos 6.7. The only message was:
0271 # This application failed to start because it could not find or load the Qt platform plugin "xcb".
0272 # Setting export QT_DEBUG_PLUGINS=1 revealed the cause.
0273 # QLibraryPrivate::loadPlugin failed on "/usr/lib64/qt5/plugins/platforms/libqxcb.so" : 
0274 # "Cannot load library /usr/lib64/qt5/plugins/platforms/libqxcb.so: (/lib64/libEGL.so.1: undefined symbol: drmGetNodeTypeFromFd)"
0275 # Which means that we have to copy libEGL.so.1 in too
0276 cp $(ldconfig -p | grep libEGL.so.1 | cut -d ">" -f 2 | xargs) ./usr/lib/ # Otherwise F23 cannot load the Qt platform plugin "xcb"
0277 cp $(ldconfig -p | grep libxcb.so.1 | cut -d ">" -f 2 | xargs) ./usr/lib/ 
0278 
0279 ldd usr/bin/kdevelop | grep "=>" | awk '{print $3}' | xargs -I '{}' cp -v '{}' ./usr/lib || true
0280 #ldd usr/lib64/kdevelop/*.so  | grep "=>" | awk '{print $3}' | xargs -I '{}' cp -v '{}' ./usr/lib || true
0281 #ldd usr/lib64/plugins/imageformats/*.so  | grep "=>" | awk '{print $3}' | xargs -I '{}' cp -v '{}' ./usr/lib || true
0282 
0283 ldd usr/lib/qt5/plugins/platforms/libqxcb.so | grep "=>" | awk '{print $3}'  |  xargs -I '{}' cp -v '{}' ./usr/lib || true
0284 
0285 # Copy in the indirect dependencies
0286 FILES=$(find . -type f -executable)
0287 
0288 for FILE in $FILES ; do
0289     echo "*** Processing:" $FILE
0290     ldd "${FILE}" | grep "=>" | awk '{print $3}' | xargs -I '{}' cp -vu '{}' usr/lib || true
0291 done
0292 
0293 # The following are assumed to be part of the base system
0294 rm -f usr/lib/libcom_err.so.2 || true
0295 rm -f usr/lib/libcrypt.so.1 || true
0296 rm -f usr/lib/libdl.so.2 || true
0297 rm -f usr/lib/libexpat.so.1 || true
0298 rm -f usr/lib/libfontconfig.so.1 || true
0299 rm -f usr/lib/libfreetype.so.6 || true
0300 rm -f usr/lib/libgcc_s.so.1 || true
0301 rm -f usr/lib/libglib-2.0.so.0 || true
0302 rm -f usr/lib/libgpg-error.so.0 || true
0303 rm -f usr/lib/libgssapi_krb5.so.2 || true
0304 rm -f usr/lib/libgssapi.so.3 || true
0305 rm -f usr/lib/libhcrypto.so.4 || true
0306 rm -f usr/lib/libheimbase.so.1 || true
0307 rm -f usr/lib/libheimntlm.so.0 || true
0308 rm -f usr/lib/libhx509.so.5 || true
0309 rm -f usr/lib/libICE.so.6 || true
0310 rm -f usr/lib/libidn.so.11 || true
0311 rm -f usr/lib/libk5crypto.so.3 || true
0312 rm -f usr/lib/libkeyutils.so.1 || true
0313 rm -f usr/lib/libkrb5.so.26 || true
0314 rm -f usr/lib/libkrb5.so.3 || true
0315 rm -f usr/lib/libkrb5support.so.0 || true
0316 # rm -f usr/lib/liblber-2.4.so.2 || true # needed for debian wheezy
0317 # rm -f usr/lib/libldap_r-2.4.so.2 || true # needed for debian wheezy
0318 rm -f usr/lib/libm.so.6 || true
0319 rm -f usr/lib/libp11-kit.so.0 || true
0320 rm -f usr/lib/libpcre.so.3 || true
0321 rm -f usr/lib/libpthread.so.0 || true
0322 rm -f usr/lib/libresolv.so.2 || true
0323 rm -f usr/lib/libroken.so.18 || true
0324 rm -f usr/lib/librt.so.1 || true
0325 rm -f usr/lib/libSM.so.6 || true
0326 rm -f usr/lib/libusb-1.0.so.0 || true
0327 rm -f usr/lib/libuuid.so.1 || true
0328 rm -f usr/lib/libwind.so.0 || true
0329 
0330 # Remove these libraries, we need to use the system versions; this means 11.04 is not supported (12.04 is our baseline)
0331 rm -f usr/lib/libGL.so.* || true
0332 rm -f usr/lib/libdrm.so.* || true
0333 
0334 # see https://github.com/AppImage/AppImageKit/issues/629#issuecomment-359013844 -- we assume this to be present on all systems
0335 rm -f usr/lib/libz.so.1 || true
0336 
0337 # These seem to be available on most systems but not Ubuntu 11.04
0338 # rm -f usr/lib/libffi.so.6 usr/lib/libGL.so.1 usr/lib/libglapi.so.0 usr/lib/libxcb.so.1 usr/lib/libxcb-glx.so.0 || true
0339 
0340 # Delete potentially dangerous libraries
0341 rm -f usr/lib/libstdc* usr/lib/libgobject* usr/lib/libc.so.* || true
0342 # Do NOT delete libX* because otherwise on Ubuntu 11.04:
0343 # loaded library "Xcursor" malloc.c:3096: sYSMALLOc: Assertion (...) Aborted
0344 
0345 # We don't bundle the developer stuff
0346 rm -rf usr/include || true
0347 rm -rf usr/lib/cmake || true
0348 rm -rf usr/lib/pkgconfig || true
0349 rm -rf usr/mkspecs || true
0350 rm -rf usr/share/ECM/ || true
0351 rm -rf usr/share/gettext || true
0352 rm -rf usr/share/pkgconfig || true
0353 rm -rf usr/etc/xdg/*.categories || true
0354 
0355 strip -g $(find usr/bin usr/lib -type f) || true
0356 
0357 # We do not bundle this, so let's not search that inside the AppImage. 
0358 # Fixes "Qt: Failed to create XKB context!" and lets us enter text
0359 #sed -i -e 's|././/share/X11/|/usr/share/X11/|g' ./usr/lib/qt5/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so
0360 #sed -i -e 's|././/share/X11/|/usr/share/X11/|g' ./usr/lib/libQt5XcbQpa.so.5
0361 
0362 # Workaround for:
0363 # D-Bus library appears to be incorrectly set up;
0364 # failed to read machine uuid: Failed to open
0365 # The file is more commonly in /etc/machine-id
0366 # sed -i -e 's|/var/lib/dbus/machine-id|//././././etc/machine-id|g' ./usr/lib/libdbus-1.so.3
0367 # or
0368 rm -f ./usr/lib/libdbus-1.so.3 || true
0369 
0370 # Remove python
0371 rm -f ./usr/bin/python*
0372 rm -f ./usr/bin/pydoc*
0373 rm -f ./usr/bin/pyenv*
0374 
0375 # remove big execs
0376 rm -f ./usr/bin/verify-uselistorder
0377 rm -f ./usr/bin/obj2yaml ./usr/bin/yaml2obj
0378 rm -f ./usr/bin/kwrite ./usr/bin/kate
0379 
0380 # remove unused registration data
0381 rm -rf ./usr/share/applications/ || true
0382 
0383 # remove all appdata besides kdevelop one
0384 rm -f ./usr/share/metainfo/org.kde.{breezedark.desktop,kate,kwrite,konsole}.appdata.xml
0385 rm -f ./usr/share/metainfo/org.kde.kdev-{php,python}.metainfo.xml
0386 
0387 cp /kdevelop.appdir/usr/lib/libexec/kf5/* /kdevelop.appdir/usr/bin/
0388 
0389 cd /
0390 if [ ! -d appimage-exec-wrapper ]; then
0391     git clone https://invent.kde.org/brauch/appimage-exec-wrapper.git
0392 fi;
0393 cd /appimage-exec-wrapper/
0394 make clean
0395 make
0396 
0397 cd /kdevelop.appdir
0398 cp -v /appimage-exec-wrapper/exec.so exec_wrapper.so
0399 
0400 # Disabled plugins (yet build and bundled, as more complicated to remove from build):
0401 # * KDevWelcomePage - issues with Qt failing to load SSL during news feed fetching
0402 #                     thus causing KDevelop to hang while creating network connections
0403 # * KDevManPage - man:/ kio-slave & deps not bundled yet
0404 
0405 cat > AppRun << EOF
0406 #!/bin/bash
0407 
0408 DIR="\`dirname \"\$0\"\`" 
0409 DIR="\`( cd \"\$DIR\" && pwd )\`"
0410 export APPDIR=\$DIR
0411 
0412 export LD_PRELOAD=\$DIR/exec_wrapper.so
0413 
0414 export APPIMAGE_ORIGINAL_QML2_IMPORT_PATH=\$QML2_IMPORT_PATH
0415 export APPIMAGE_ORIGINAL_LD_LIBRARY_PATH=\$LD_LIBRARY_PATH
0416 export APPIMAGE_ORIGINAL_QT_PLUGIN_PATH=\$QT_PLUGIN_PATH
0417 export APPIMAGE_ORIGINAL_XDG_DATA_DIRS=\$XDG_DATA_DIRS
0418 export APPIMAGE_ORIGINAL_PATH=\$PATH
0419 export APPIMAGE_ORIGINAL_PYTHONHOME=\$PYTHONHOME
0420 
0421 export QML2_IMPORT_PATH=\$DIR/usr/lib/qml:\$QML2_IMPORT_PATH
0422 export LD_LIBRARY_PATH=\$DIR/usr/lib/:\$LD_LIBRARY_PATH
0423 export QT_PLUGIN_PATH=\$DIR/usr/lib/qt5/plugins/
0424 export XDG_DATA_DIRS=\$DIR/usr/share/:\$XDG_DATA_DIRS
0425 export PATH=\$DIR/usr/bin:\$PATH
0426 export PYTHONHOME=\$DIR/usr/
0427 
0428 export APPIMAGE_STARTUP_QML2_IMPORT_PATH=\$QML2_IMPORT_PATH
0429 export APPIMAGE_STARTUP_LD_LIBRARY_PATH=\$LD_LIBRARY_PATH
0430 export APPIMAGE_STARTUP_QT_PLUGIN_PATH=\$QT_PLUGIN_PATH
0431 export APPIMAGE_STARTUP_XDG_DATA_DIRS=\$XDG_DATA_DIRS
0432 export APPIMAGE_STARTUP_PATH=\$PATH
0433 export APPIMAGE_STARTUP_PYTHONHOME=\$PYTHONHOME
0434 
0435 export KDEV_CLANG_BUILTIN_DIR=\$DIR/opt/llvm/lib/clang/${LLVM_VERSION}/include
0436 export KDEV_DISABLE_PLUGINS="KDevWelcomePage;KDevManPage"
0437 
0438 cd \$HOME
0439 
0440 kdevelop \$@
0441 EOF
0442 chmod +x AppRun
0443 
0444 # use normal desktop file, but remove actions, not yet handled by appimaged & Co
0445 cp $SRC/kdevelop/app/org.kde.kdevelop.desktop org.kde.kdevelop.desktop
0446 sed -i -e '/^Actions=/d;/^\[Desktop Action /Q' org.kde.kdevelop.desktop
0447 
0448 cp $SRC/kdevelop/app/icons/256-apps-kdevelop.png kdevelop.png
0449 cp -R /usr/lib/python3.6 /kdevelop.appdir/usr/lib/
0450 rm -Rf /kdevelop.appdir/usr/lib/python3.6/{test,config-3.5m,__pycache__,site-packages,lib-dynload,distutils,idlelib,unittest,tkinter,ensurepip}
0451 
0452 mkdir -p /kdevelop.appdir/usr/share/kdevelop/
0453 
0454 # Breeze cruft
0455 cp $BUILD/breeze-icons/icons/breeze-icons.rcc /kdevelop.appdir/usr/share/kdevelop/icontheme.rcc
0456 rm -Rf /kdevelop.appdir/usr/share/icons/{B,b}reeze* # not needed because of the rcc
0457 rm -Rf /kdevelop.appdir/usr/share/wallpapers
0458 rm -Rf /kdevelop.appdir/usr/share/plasma
0459 
0460 rm -f /kdevelop.appdir/usr/bin/llvm*
0461 rm -f /kdevelop.appdir/usr/bin/clang*
0462 rm -f /kdevelop.appdir/usr/bin/opt
0463 rm -f /kdevelop.appdir/usr/bin/lli
0464 rm -f /kdevelop.appdir/usr/bin/sancov
0465 rm -f /kdevelop.appdir/usr/bin/cmake
0466 rm -f /kdevelop.appdir/usr/bin/python
0467 rm -Rf /kdevelop.appdir/usr/lib/pkgconfig
0468 rm -Rf /kdevelop.appdir/usr/share/man
0469 rm -Rf /kdevelop.appdir/usr/share/locale
0470 rm -Rf /kdevelop.appdir/usr/lib/libLTO.so
0471 
0472 #At first it seems like "we shouldn't ship X11", but actually we should; the X11 protocol is sort of guaranteed to stay compatible,
0473 #while these libraries are not.
0474 # rm -Rf /kdevelop.appdir/usr/lib/libxcb*
0475 # add that back in
0476 # cp /usr/lib64/libxcb-keysyms.so.1 /kdevelop.appdir/usr/lib/
0477 # rm -Rf /kdevelop.appdir/usr/lib/{libX11.so.6,libXau.so.6,libXext.so.6,libXi.so.6,libXxf86vm.so.1,libX11-xcb.so.1,libXdamage.so.1,libXfixes.so.3,libXrender.so.1}
0478 
0479 rm -f /kdevelop.appdir/usr/bin/llc
0480 rm -f /kdevelop.appdir/usr/bin/bugpoint
0481 
0482 find /kdevelop.appdir -name '*.a' -exec rm {} \;
0483 
0484 echo "Final listing of files which will end up in the AppImage:"
0485 find /kdevelop.appdir
0486 
0487 cd /
0488 
0489 APP=KDevelop
0490 
0491 VERSION="git"
0492 
0493 if [[ "$ARCH" = "x86_64" ]] ; then
0494     APPIMAGE=$APP"-"$VERSION"-x86_64.AppImage"
0495 fi
0496 if [[ "$ARCH" = "i686" ]] ; then
0497     APPIMAGE=$APP"-"$VERSION"-i386.AppImage"
0498 fi
0499 echo $APPIMAGE
0500 
0501 # Get appimagetool
0502 APPIMAGETOOL_DIR=$SRC/appimagetool
0503 if [ ! -d $APPIMAGETOOL_DIR ]; then
0504     mkdir -p $APPIMAGETOOL_DIR
0505     pushd $APPIMAGETOOL_DIR
0506     wget -c -O appimagetool https://github.com/AppImage/AppImageKit/releases/download/11/appimagetool-x86_64.AppImage
0507     chmod +x ./appimagetool
0508     ./appimagetool --appimage-extract # no fuse on this docker instance...
0509     popd
0510 fi
0511 export PATH=$APPIMAGETOOL_DIR/squashfs-root/usr/bin:$PATH # add path to extracted appimage binary
0512 
0513 mkdir -p /out
0514 
0515 rm -f /out/*.AppImage || true
0516 appimagetool /kdevelop.appdir/ /out/$APPIMAGE
0517 
0518 chmod a+rwx /out/$APPIMAGE # So that we can edit the AppImage outside of the Docker container