From fe34e6b7447059f25c6c6cbc00d70e597c0e2d37 Mon Sep 17 00:00:00 2001 From: "kali kaneko (leap communications)" Date: Sat, 1 May 2021 14:45:13 +0200 Subject: [pkg] build snap from scratch this is mainly a workaround for #497 --- branding/templates/snap/snapcraft-template.yaml | 222 +++++++++++++++++++----- 1 file changed, 180 insertions(+), 42 deletions(-) (limited to 'branding') diff --git a/branding/templates/snap/snapcraft-template.yaml b/branding/templates/snap/snapcraft-template.yaml index fe081e9..0840d88 100644 --- a/branding/templates/snap/snapcraft-template.yaml +++ b/branding/templates/snap/snapcraft-template.yaml @@ -9,9 +9,13 @@ grade: stable confinement: classic icon: snap/gui/icon.svg base: core20 +compression: lzo -parts: +architectures: + - build-on: amd64 + - build-on: i386 +parts: bitmask-root: plugin: dump source: helpers @@ -43,7 +47,8 @@ parts: mkdir -p $SNAPCRAFT_PRIME/snap/ echo ${version} > $SNAPCRAFT_PRIME/snap/version.txt make build_golib - QT_SELECT=5 XBUILD=no TARGET=${binaryName} make build_gui + ln -fs /usr/lib/qt5/bin/lrelease /root/parts/qt5/install/usr/lib/qt5/bin/lrelease + QMAKE=/root/parts/qt5/install/usr/lib/qt5/bin/qmake LRELEASE=/usr/lib/qt5/bin/lrelease QT_SELECT=5 XBUILD=no TARGET=${binaryName} make build_gui mkdir -p $SNAPCRAFT_PART_INSTALL/bin mv build/qt/release/${binaryName} $SNAPCRAFT_PART_INSTALL/bin/ override-prime: | @@ -55,29 +60,28 @@ parts: - golang - git - make - - qt5-qmake - qttools5-dev-tools - - qtdeclarative5-dev - stage-packages: # for some reason they're not picked from here - duplicating in desktop-qt5. - - libqt5qml5 - - libqt5quick5 - - qml-module-qtquick-controls - - qml-module-qtquick-controls2 - - qml-module-qtquick-dialogs - - qml-module-qtquick-extras + stage-packages: - qml-module-qt-labs-platform after: [desktop-qt5] + desktop-integration: + plugin: nil + stage-packages: + - libx11-data + - libx11-xcb1 + - xkb-data + desktop-qt5: - source: https://github.com/ubuntu/snapcraft-desktop-helpers.git + source: https://github.com/desktop-app/snapcraft-desktop-helpers.git source-subdir: qt plugin: make make-parameters: ["FLAVOR=qt5"] build-packages: - build-essential - - qtbase5-dev - dpkg-dev stage-packages: + - libjpeg-turbo8 - libxkbcommon0 - ttf-ubuntu-font-family - dmz-cursor-theme @@ -85,46 +89,180 @@ parts: - adwaita-icon-theme - gnome-themes-standard - shared-mime-info + - libgdk-pixbuf2.0-0 - locales-all - xdg-user-dirs - fcitx-frontend-qt5 + - libglib2.0-bin + stage: + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libjpeg.so.8.2.2 + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libQt5Core.so.5 + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libQt5DBus.so.5 + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libQt5EglFSDeviceIntegration.so.5 + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libQt5Gui.so.5 + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libQt5Network.so.5 + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libQt5XcbQpa.so.5 + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/bearer/libqconnmanbearer.so + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/bearer/libqgenericbearer.so + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/bearer/libqnmbearer.so + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/egldeviceintegrations/libqeglfs-emu-integration.so + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/generic/libqevdevkeyboardplugin.so + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/generic/libqevdevmouseplugin.so + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/generic/libqevdevtabletplugin.so + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/generic/libqevdevtouchplugin.so + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/generic/libqtuiotouchplugin.so + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/imageformats/libqgif.so + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/imageformats/libqico.so + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/imageformats/libqjpeg.so + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/platforms/libqeglfs.so + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/platforms/libqlinuxfb.so + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/platforms/libqminimal.so + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/platforms/libqminimalegl.so + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/platforms/libqoffscreen.so + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/platforms/libqvnc.so + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/platforms/libqxcb.so + after: + - qt5 + + qt5: + plugin: nil + build-packages: + - libdbus-1-dev + - libegl-dev + - libfontconfig1-dev + - libfreetype-dev + - libgl-dev + - libglib2.0-dev + - libharfbuzz-dev + - libicu-dev + - libpcre2-dev + - libpng-dev + - libwayland-dev + - libx11-dev + - libx11-xcb-dev + - libxcb1-dev + - libxcb-glx0-dev + - libxcb-icccm4-dev + - libxcb-image0-dev + - libxcb-keysyms1-dev + - libxcb-randr0-dev + - libxcb-render0-dev + - libxcb-render-util0-dev + - libxcb-shape0-dev + - libxcb-shm0-dev + - libxcb-sync-dev + - libxcb-util-dev + - libxcb-xfixes0-dev + - libxcb-xinerama0-dev + - libxcb-xinput-dev + - libxcb-xkb-dev + - libxcursor-dev + - libxkbcommon-dev + - libxkbcommon-x11-dev + - zlib1g-dev + stage-packages: + - libdbus-1-3 + - libegl1 + - libfontconfig1 + - libfreetype6 + - libgl1 + - libglib2.0-0 + - libharfbuzz0b + - libicu66 + - libpcre2-16-0 + - libpng16-16 + #- libwayland-client0 + #- libwayland-cursor0 + #- libwayland-egl1 + - libx11-6 + - libx11-xcb1 - libxcb1 - - libqt5gui5 - - libgdk-pixbuf2.0-0 - - libqt5svg5 - - libqt5qml5 - - libqt5quick5 - - qt5-style-plugins - - qml-module-qtquick2 - - qml-module-qtquick-controls - - qml-module-qtquick-controls2 - - qml-module-qtquick-dialogs - - qml-module-qtquick-extras - - qml-module-qt-labs-platform + - libxcb-glx0 + - libxcb-icccm4 + - libxcb-image0 + - libxcb-keysyms1 + - libxcb-randr0 + - libxcb-render0 + - libxcb-render-util0 + - libxcb-shape0 + - libxcb-shm0 + - libxcb-sync1 + - libxcb-util1 + - libxcb-xfixes0 + - libxcb-xinerama0 + - libxcb-xinput0 + - libxcb-xkb1 + - libxcursor1 + - libxkbcommon0 + - libxkbcommon-x11-0 + - zlib1g - try: [appmenu-qt5] # not available on core18 + override-pull: | + QT=5_15_2 + git clone -b v5.15.2 --depth=1 git://code.qt.io/qt/qt5.git . + perl init-repository --module-subset=qtbase,qtimageformats,qtsvg,qtdeclarative,qtgraphicaleffects,qtquickcontrols,qtquickcontrols2,qtscript + git submodule update qtbase qtimageformats qtsvg qtdeclarative qtgraphicaleffects qtquickcontrols qtquickcontrols2 qtscript + override-build: | + ./configure \ + -prefix /usr \ + -bindir /usr/lib/qt5/bin \ + -libdir /usr/lib/$SNAPCRAFT_ARCH_TRIPLET \ + -docdir /usr/share/qt5/doc \ + -headerdir /usr/include/$SNAPCRAFT_ARCH_TRIPLET/qt5 \ + -datadir /usr/share/qt5 \ + -archdatadir /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5 \ + -plugindir /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins \ + -importdir /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/imports \ + -translationdir /usr/share/qt5/translations \ + -hostdatadir /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5 \ + -sysconfdir /etc/xdg \ + -examplesdir /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/examples \ + -release \ + -opensource \ + -confirm-license \ + -no-gtk \ + -no-feature-xcb-sm \ + -no-openssl \ + -nomake examples \ + -nomake tests \ + -opengl desktop \ + -I $SNAPCRAFT_STAGE/usr/include \ + -L $SNAPCRAFT_STAGE/usr/lib/$SNAPCRAFT_ARCH_TRIPLET + make -j$SNAPCRAFT_PARALLEL_BUILD_COUNT + make INSTALL_ROOT="$SNAPCRAFT_PART_INSTALL" install + stage: + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libjpeg.so.8.2.2 + prime: + - -./usr/include + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/cmake + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pkgconfig + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/bin + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/mkspecs + - -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/examples + - -./usr/lib/qt5 + - -./usr/share apps: - bitmask-root: command: bin/bitmask-root openvpn: command: usr/sbin/openvpn - environment: - LD_LIBRARY_PATH: &library-path - $SNAP/lib:$SNAP/lib/$SNAPCRAFT_ARCH_TRIPLET:$SNAP/usr/lib:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET launcher: - command: bin/${binaryName} - environment: - QT_PLUGIN_PATH: &path - $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/qml - LD_LIBRARY_PATH: - $SNAP/lib:$SNAP/lib/$SNAPCRAFT_ARCH_TRIPLET:$SNAP/usr/lib:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET:$LD_LIBRARY_PATH - QML2_IMPORT_PATH: - $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/qml:$SNAP/usr/lib/x86_64-linux-gnu/qt5/qml - # debug ------------- - #QT_DEBUG_PLUGINS: 1 - SNAP_DESKTOP_DEBUG: 1 - QT_STYLE_OVERRIDE: Fusion - # debug ------------- + command: bin/${binaryName} -platform xcb + +environment: + QT_PLUGIN_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/platforms:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/qml:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/qml/QtQuick/Controls.2/:$SNAP/usr/lib/x86_64-linux-gnu/qt5/plugins:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/xcbglintegrations + QT_QPA_PLATFORM_PLUGIN_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins:$SNAP/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms + # QT_STYLE_OVERRIDE: Fusion + QML2_IMPORT_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/qml + DISABLE_WAYLAND: 1 + LD_LIBRARY_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/dri + # debug ------------- + # QT_OPENGL: software + # QT_DEBUG_PLUGINS: 1 + SNAP_DESKTOP_DEBUG: 1 + # debug ------------- -- cgit v1.2.3