Skip to content

Commit

Permalink
bundle debug infos for qt and kde
Browse files Browse the repository at this point in the history
  • Loading branch information
lievenhey committed Feb 6, 2024
1 parent 2d41c79 commit ec44b45
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 15 deletions.
24 changes: 15 additions & 9 deletions scripts/appimage/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
FROM centos/devtoolset-7-toolchain-centos7 as intermediate

ARG QT_VERSION=5.15.11
ARG KF5_VERSION v5.110.0
ARG KF5_VERSION=v5.110.0
ARG KDDockWidgets_VERSION=2.0
ARG QCustomPlot_VERSION=2.1.1
ARG rust_demangler_VERSION=0.1.23
Expand Down Expand Up @@ -46,23 +46,27 @@ RUN sed -i 's#enabled=1#enabled=0#' /etc/yum/pluginconf.d/fastestmirror.conf &&
fuse fuse-libs bzip2 desktop-file-utils && \
ln -s /usr/bin/cmake3 /usr/bin/cmake && \
rm -Rf /var/cache/yum && \
. /opt/rh/devtoolset-11/enable
. /opt/rh/devtoolset-11/enable && \
debuginfo-install -y devtoolset-11-elfutils-libs

ENV LD_LIBRARY_PATH=/opt/rh/devtoolset-11/root/usr/lib64:/opt/rh/devtoolset-11/root/usr/lib:/opt/rh/devtoolset-11/root/usr/lib64/dyninst:/opt/rh/devtoolset-11/root/usr/lib/dyninst:/opt/rh/devtoolset-11/root/usr/lib64:/opt/rh/devtoolset-11/root/usr/lib:/opt/rh/httpd24/root/usr/lib64:/opt/rh/rh-perl530/root/usr/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} \
PATH=/opt/rh/devtoolset-11/root/usr/bin:/opt/rh/rh-git227/root/usr/bin:/opt/rh/rh-perl530/root/usr/local/bin:/opt/rh/rh-perl530/root/usr/bin${PATH:+:${PATH}}

RUN rm /opt/rh/devtoolset-11/root/usr/bin/ld && ln -s /opt/rh/devtoolset-11/root/usr/bin/ld.gold /opt/rh/devtoolset-11/root/usr/bin/ld

# qt5
RUN wget https://download.qt.io/official_releases/qt/5.15/${QT_VERSION}/single/qt-everywhere-opensource-src-${QT_VERSION}.tar.xz && \
tar -xvf qt-everywhere-opensource-src-${QT_VERSION}.tar.xz && \
mkdir build && cd build && \
../qt-everywhere-src-${QT_VERSION}/configure -opensource -confirm-license \
tar -xvf qt-everywhere-opensource-src-${QT_VERSION}.tar.xz

RUN mkdir build && cd build && \
../qt-everywhere-src-${QT_VERSION}/configure -opensource -confirm-license -force-debug-info -separate-debug-info \
-xcb -xcb-xlib -bundled-xcb-xinput -skip qtwebengine -skip qtdatavis3d -skip qtmultimedia -skip qtquick3d \
-skip qtquickcontrols -skip qtquickcontrols2 -skip qtquicktimeline -skip qt3d -skip qtdeclarative \
-skip qtscript -skip qtcharts -skip qtdoc -skip qtwebsockets -skip qtgamepad -skip qtgraphicaleffects \
-skip qtpurchasing -skip qtserialbus -skip qtserialport -skip qtwebchannel -skip qtwebglplugin \
-skip qtwebview -skip qtlocation -skip qtspeech -skip qtwinextras \
-release -ssl -no-compile-examples -cups -I /usr/include/openssl11 -prefix /usr && \
make -j && make install && cd .. && rm -Rf build qt-everywhere-*
make -j $(nproc) && make install && cd .. && rm -Rf build qt-everywhere-*

# appimage build tools
RUN wget https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20230713-1/linuxdeploy-x86_64.AppImage && chmod +x linuxdeploy-x86_64.AppImage && \
Expand All @@ -79,7 +83,7 @@ RUN cd /opt && mkdir qcustomplot && cd qcustomplot && \
cd qcustomplot && cp qcustomplot.h /usr/include && \
wget https://www.qcustomplot.com/release/${QCustomPlot_VERSION}/QCustomPlot-sharedlib.tar.gz && \
tar -xf QCustomPlot-sharedlib.tar.gz && ls && cd qcustomplot-sharedlib/sharedlib-compilation \
&& qmake . && make -j && mv libqcustomplot.so* /usr/lib && cd /opt && rm -Rf qcustomplot && ldconfig
&& qmake . && make -j $(nproc) && mv libqcustomplot.so* /usr/lib && cd /opt && rm -Rf qcustomplot && ldconfig

# rust demangle
RUN cd /opt/ && mkdir rust && cd rust && wget https://sh.rustup.rs -O rustup.sh && \
Expand Down Expand Up @@ -129,8 +133,10 @@ RUN ldconfig && \

# kddockwidgets
RUN cd /opt && git clone --recursive https://github.com/KDAB/KDDockWidgets.git -b ${KDDockWidgets_VERSION} && \
cd KDDockWidgets && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=/usr -DKDDockWidgets_EXAMPLES=0 -DKDDockWidgets_FRONTENDS="qtwidgets" .. && \
make -j && make install && cd /opt && rm -Rf KDDockWidgets
cd KDDockWidgets && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=/usr -DKDDockWidgets_EXAMPLES=0 -DKDDockWidgets_FRONTENDS="qtwidgets" -DCMAKE_BUILD_TYPE=RelWithDebugInfo .. && \
make -j $(nproc) && make install && cd /opt && rm -Rf KDDockWidgets

RUN

FROM intermediate

Expand Down
38 changes: 33 additions & 5 deletions scripts/appimage/build_appimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
make -j
DESTDIR=appdir make install

tar -cjvf "/output/hotspot-debuginfo-$gitversion-x86_64.tar.bz2" \
--transform="s#appdir/#hotspot-debuginfo-$gitversion/#" \
appdir/usr/bin/hotspot appdir/usr/lib64/libexec/hotspot-perfparser

# FIXME: Do in CMakeLists.txt
mkdir -p "appdir/usr/share/applications/"
cp "$srcdir/com.kdab.hotspot.desktop" "appdir/usr/share/applications/"
Expand Down Expand Up @@ -74,7 +70,39 @@ linuxdeploy-x86_64.AppImage --appdir appdir --plugin qt \
-d "./appdir/usr/share/applications/com.kdab.hotspot.desktop" \
--output appimage

# copy qt libs and modify debug link since linuxdeploy modifies the lib
for lib in $(cd appdir/usr/lib && ls libQt*); do
if [ -f /usr/lib/${lib}*.debug ]; then
cp /usr/lib/${lib}*.debug appdir/usr/lib/${lib}.debug
objcopy --add-gnu-debuglink="appdir/usr/lib/${lib}" appdir/usr/lib/${lib}.debug
fi
done

# kde libs got stripped by linuxdeploy so we need to extrace the debug info from the source files
for lib in $(cd appdir/usr/lib && ls libKF*); do
strip --only-keep-debug /usr/lib64/${lib}.* -o appdir/usr/lib/${lib}.debug
done

# copy debug infos for kddockwidgets, hotspot and perfparser
strip --only-keep-debug bin/hotspot -o appdir/usr/bin/hotspot.debug
strip --only-keep-debug bin/perfparser -o appdir/usr/lib64/libexec/hotspot-perfparser.debug
strip --only-keep-debug /usr/lib64/libkddockwidgets.so.2.0 -o appdir/usr/lib/libkddockwidgets.so.2.0.debug

# copy elfutils debuginfo
cp /usr/lib/debug/opt/rh/devtoolset-11/root/usr/lib64/lib{elf,dw}-*.debug appdir/usr/lib

# add debug files from libs
tar -cjvf "/output/hotspot-debuginfo-$gitversion-x86_64.tar.bz2" \
--transform="s#appdir/#hotspot-debuginfo-$gitversion/#" \
appdir/usr/bin/hotspot.debug appdir/usr/lib64/libexec/hotspot-perfparser.debug \
appdir/usr/lib/lib*.debug

# delete debug info from final appimage
find appdir -type f -name "*.debug" -exec rm {} \;

find appdir/usr/lib -type f -name "*.so*" -exec strip -s {} \;

# package appdir with type 2 runtime so we don't depend on glibc and fuse2
appimagetool-x86_64.AppImage --runtime-file /opt/runtime-x86_64 appdir

mv Hotspot-x86_64.AppImage "/output/hotspot-$gitversion-x86_64.AppImage"
mv Hotspot*x86_64.AppImage "/output/hotspot-$gitversion-x86_64.AppImage"
2 changes: 1 addition & 1 deletion scripts/appimage/kdesrc-buildrc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ global
# thumbrule is one core for every 2 GiB of total memory.
num-cores-low-mem HALF_NPROC

cmake-options -DBUILD_TESTING=OFF -DBUILD_DESIGNERPLUGIN=OFF
cmake-options -DBUILD_TESTING=OFF -DBUILD_DESIGNERPLUGIN=OFF -DBUILD_TYPE=RelWithDebInfo
end global

# Instead of specifying modules here, the current best practice is to refer to
Expand Down

0 comments on commit ec44b45

Please sign in to comment.