Skip to content

Commit c8ba07b

Browse files
committed
flatpak: init setup
1 parent 118f91e commit c8ba07b

File tree

9 files changed

+354
-14
lines changed

9 files changed

+354
-14
lines changed

Makefile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,49 @@ ifdef LINUX_GPG_PRIVATE_KEY_FILE
718718
scripts/sign-linux-file.sh $(STATUS_CLIENT_TARBALL)
719719
endif
720720

721+
# Flatpak build configuration
722+
STATUS_CLIENT_FLATPAK ?= pkg/Status.flatpak
723+
STATUS_CLIENT_FLATPAK_BUNDLE ?= pkg/app.status.desktop.flatpak
724+
FLATPAK_BUILD_DIR ?= tmp/flatpak-build
725+
FLATPAK_REPO_DIR ?= tmp/flatpak-repo
726+
FLATPAK_MANIFEST ?= app.status.desktop.yml
727+
728+
$(STATUS_CLIENT_FLATPAK): override RESOURCES_LAYOUT := $(PRODUCTION_PARAMETERS)
729+
$(STATUS_CLIENT_FLATPAK): nim_status_client
730+
echo -e $(BUILD_MSG) "Flatpak"
731+
rm -rf $(FLATPAK_BUILD_DIR) $(FLATPAK_REPO_DIR)
732+
mkdir -p pkg
733+
734+
# Build Flatpak using flatpak-builder
735+
flatpak-builder --force-clean --disable-rofiles-fuse \
736+
--repo=$(FLATPAK_REPO_DIR) \
737+
$(FLATPAK_BUILD_DIR) \
738+
$(FLATPAK_MANIFEST)
739+
740+
# Create single-file bundle
741+
flatpak build-bundle $(FLATPAK_REPO_DIR) \
742+
$(STATUS_CLIENT_FLATPAK_BUNDLE) \
743+
app.status.desktop
744+
745+
# if LINUX_GPG_PRIVATE_KEY_FILE is set, sign the Flatpak bundle
746+
ifdef LINUX_GPG_PRIVATE_KEY_FILE
747+
scripts/sign-linux-file.sh $(STATUS_CLIENT_FLATPAK_BUNDLE)
748+
endif
749+
750+
# Convenience target
751+
.PHONY: flatpak
752+
flatpak: $(STATUS_CLIENT_FLATPAK)
753+
754+
# Target to build and install Flatpak locally for testing
755+
.PHONY: flatpak-install
756+
flatpak-install: $(STATUS_CLIENT_FLATPAK)
757+
flatpak install --user -y $(STATUS_CLIENT_FLATPAK_BUNDLE)
758+
759+
# Target to run Flatpak
760+
.PHONY: flatpak-run
761+
flatpak-run:
762+
flatpak run app.status.desktop
763+
721764
MACOS_OUTER_BUNDLE := tmp/macos/dist/Status.app
722765
MACOS_INNER_BUNDLE := $(MACOS_OUTER_BUNDLE)/Contents/Frameworks/QtWebEngineCore.framework/Versions/Current/Helpers/QtWebEngineProcess.app
723766

app.status.desktop.appdata.xml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<component type="desktop-application">
3+
<id>app.status.desktop</id>
4+
<metadata_license>CC0-1.0</metadata_license>
5+
<project_license>MPL-2.0</project_license>
6+
<name>Status Desktop</name>
7+
<summary>Desktop client for the Status Network</summary>
8+
<description>
9+
<p>
10+
Status is a secure messaging app, crypto wallet, and Web3 browser built with state of the art technology.
11+
It's an open source, Ethereum-based app that gives you the power to chat, transact and access a revolutionary
12+
world of DApps on the decentralized web.
13+
</p>
14+
<p>Features:</p>
15+
<ul>
16+
<li>Private, encrypted messaging</li>
17+
<li>Built-in Ethereum wallet</li>
18+
<li>Web3 DApp browser</li>
19+
<li>Decentralized network</li>
20+
<li>Community-driven development</li>
21+
</ul>
22+
</description>
23+
<launchable type="desktop-id">app.status.desktop.desktop</launchable>
24+
<url type="homepage">https://status.im</url>
25+
<url type="bugtracker">https://github.com/status-im/status-desktop/issues</url>
26+
<url type="help">https://status.im/help</url>
27+
<developer_name>Status Research &amp; Development GmbH</developer_name>
28+
<screenshots>
29+
<screenshot type="default">
30+
<image>https://status.im/img/status-desktop-screenshot.png</image>
31+
</screenshot>
32+
</screenshots>
33+
<content_rating type="oars-1.1">
34+
<content_attribute id="social-chat">intense</content_attribute>
35+
<content_attribute id="social-info">intense</content_attribute>
36+
<content_attribute id="money-purchasing">intense</content_attribute>
37+
</content_rating>
38+
<releases>
39+
<release version="0.0.0" date="2025-01-01"/>
40+
</releases>
41+
</component>

app.status.desktop.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
app-id: app.status.desktop
2+
runtime: org.kde.Platform
3+
runtime-version: '6.8'
4+
sdk: org.kde.Sdk
5+
command: nim_status_client_wrapped
6+
finish-args:
7+
# X11 + XShm access
8+
- --share=ipc
9+
- --socket=x11
10+
# Wayland access
11+
- --socket=wayland
12+
# Network access
13+
- --share=network
14+
# Sound access
15+
- --socket=pulseaudio
16+
# GPU acceleration
17+
- --device=dri
18+
# Smart card access
19+
- --device=all
20+
# File system access
21+
- --filesystem=xdg-download
22+
- --filesystem=xdg-documents
23+
- --filesystem=xdg-pictures
24+
- --filesystem=xdg-videos
25+
# D-Bus access
26+
- --socket=session-bus
27+
- --socket=system-bus
28+
# Notifications
29+
- --talk-name=org.freedesktop.Notifications
30+
# Allow access to status-im directories
31+
- --filesystem=~/.status-im:create
32+
# Prevent theme issues
33+
- --env=XCURSOR_PATH=/run/host/user-share/icons:/run/host/share/icons
34+
# Qt platform
35+
- --env=QT_QPA_PLATFORM=xcb
36+
37+
modules:
38+
# pcsc-lite (smartcard support - runtime dependency)
39+
- name: pcsc-lite
40+
config-opts:
41+
- --disable-libsystemd
42+
- --disable-serial
43+
- --disable-polkit
44+
- --enable-ipcdir=/tmp/pcscd/run
45+
sources:
46+
- type: archive
47+
url: https://pcsclite.apdu.fr/files/pcsc-lite-2.2.3.tar.xz
48+
sha256: cab1e62755713f62ce1b567954dbb0e9a7e668ffbc3bbad3ce85c53f8f4e00a4
49+
50+
# GStreamer plugins (additional plugins beyond what KDE runtime provides)
51+
- name: gst-plugins-ugly
52+
buildsystem: meson
53+
sources:
54+
- type: archive
55+
url: https://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-1.24.0.tar.xz
56+
sha256: c5d1cbdf71ab0c675bca236f70edfa1feb3f813fd4bfff563308f466d8805ca5
57+
58+
# fcitx5-qt (input method support)
59+
- name: fcitx5-qt
60+
buildsystem: cmake-ninja
61+
config-opts:
62+
- -DCMAKE_BUILD_TYPE=Release
63+
- -DCMAKE_INSTALL_PREFIX=/app
64+
- -DCMAKE_INSTALL_LIBDIR=/app/lib
65+
- -DBUILD_ONLY_PLUGIN=ON
66+
- -DENABLE_QT4=OFF
67+
- -DENABLE_QT5=OFF
68+
- -DENABLE_QT6=ON
69+
# Override Qt6 plugin install path to be inside /app
70+
- -DCMAKE_INSTALL_QT6PLUGINDIR=/app/lib/qt6/plugins
71+
sources:
72+
- type: git
73+
url: https://github.com/fcitx/fcitx5-qt.git
74+
tag: 5.1.8
75+
commit: cdd0efe6724dbc7f6cbb8a8c02812e26e80d88d4
76+
77+
# Main application - packages pre-built binaries from CI build
78+
- name: status-desktop
79+
buildsystem: simple
80+
build-commands:
81+
# Install pre-built binary
82+
- install -Dm755 bin/nim_status_client /app/bin/nim_status_client
83+
# Install StatusQ libraries
84+
- install -Dm755 bin/StatusQ/*.so /app/lib/
85+
# Install resources
86+
- install -Dm644 resources.rcc /app/share/status-desktop/resources.rcc
87+
# Install desktop file
88+
- install -Dm644 nim-status.desktop /app/share/applications/app.status.desktop.desktop
89+
# Update desktop file
90+
- sed -i 's/^Exec=nim_status_client/Exec=nim_status_client/' /app/share/applications/app.status.desktop.desktop
91+
- sed -i 's/^Icon=status/Icon=app.status.desktop/' /app/share/applications/app.status.desktop.desktop
92+
# Install icon (512x512 png)
93+
- install -Dm644 status-512.png /app/share/icons/hicolor/512x512/apps/app.status.desktop.png
94+
# Install appdata
95+
- install -Dm644 app.status.desktop.appdata.xml /app/share/metainfo/app.status.desktop.appdata.xml
96+
# Copy fcitx5 plugin
97+
- mkdir -p /app/lib/qt6/plugins/platforminputcontexts
98+
- cp /app/lib/qt6/plugins/platforminputcontexts/libfcitx5platforminputcontextplugin.so /app/lib/qt6/plugins/platforminputcontexts/ || true
99+
# Create wrapper script to set up environment
100+
- install -Dm755 flatpak-wrapper.sh /app/bin/nim_status_client_wrapped
101+
sources:
102+
# Use local directory with pre-built binaries
103+
- type: dir
104+
path: .
105+
# Wrapper script
106+
- type: file
107+
path: flatpak-wrapper.sh
108+

ci/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ RUN apt update -yq && apt install -yq software-properties-common \
6969
&& apt update -yq && apt full-upgrade -yq && apt install -yq --no-install-recommends --fix-missing \
7070
gnupg2 openssh-client ca-certificates locales sudo jq curl wget fuse s3cmd file unzip llvm tk-dev xz-utils \
7171
git make build-essential pkg-config extra-cmake-modules \
72+
flatpak flatpak-builder elfutils appstream \
7273
libgl1-mesa-dev libsm6 libice6 libfontconfig1 libdbus-1-3 libssl-dev libz-dev \
7374
zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev unixodbc-dev libpq-dev \
7475
libncurses5-dev libncursesw5-dev libnss3 \
@@ -158,6 +159,11 @@ RUN sudo groupadd -g 1001 jenkins \
158159
USER jenkins
159160
ENV HOME="/home/jenkins"
160161

162+
# Setup Flatpak for jenkins user
163+
RUN flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo \
164+
&& flatpak install --user -y flathub org.kde.Platform//6.8 \
165+
&& flatpak install --user -y flathub org.kde.Sdk//6.8
166+
161167
# Rust is needed for nwaku builds
162168
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
163169
ENV PATH="${HOME}/.cargo/bin:${PATH}"

ci/Jenkinsfile.linux

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ pipeline {
1010
/* Image with Ubuntu 22.04 and QT 6.9.2 */
1111
docker {
1212
label 'linuxcontainer'
13-
image 'harbor.status.im/status-im/status-desktop-build:1.0.5-qt6.9.2'
14-
/* allows jenkins use cat and mounts '/dev/fuse' for linuxdeployqt */
13+
image 'harbor.status.im/status-im/status-desktop-build:1.0.7-qt6.9.2'
14+
/* allows jenkins use cat and mounts '/dev/fuse' for linuxdeployqt and flatpak-builder */
15+
/* flatpak-builder requires --privileged to mount /proc inside bwrap sandbox */
1516
args '--entrypoint="" ' +
16-
'--cap-add=SYS_ADMIN ' +
17-
'--security-opt=apparmor:unconfined ' +
17+
'--privileged ' +
1818
'--device=/dev/fuse ' +
1919
'--volume=/nix:/nix ' +
2020
'--volume=/etc/nix:/etc/nix '
@@ -57,7 +57,7 @@ pipeline {
5757
options {
5858
timestamps()
5959
/* Prevent Jenkins jobs from running forever */
60-
timeout(time: 30, unit: 'MINUTES')
60+
timeout(time: 45, unit: 'MINUTES')
6161
/* manage how many builds we keep */
6262
buildDiscarder(logRotator(
6363
numToKeepStr: '10',
@@ -87,8 +87,14 @@ pipeline {
8787
VERSION = sh(script: "./scripts/version.sh", returnStdout: true).trim()
8888
/* Control output the filename */
8989
APP_TYPE = "${utils.getAppType() + (params.USE_NWAKU ? '-experimental' : '')}"
90+
/* AppImage/Tarball output files */
9091
STATUS_CLIENT_APPIMAGE = "pkg/${utils.pkgFilename(ext: 'AppImage', arch: getArch(), version: env.VERSION, type: env.APP_TYPE)}"
9192
STATUS_CLIENT_TARBALL = "pkg/${utils.pkgFilename(ext: 'tar.gz', arch: getArch(), version: env.VERSION, type: env.APP_TYPE)}"
93+
/* Flatpak output files */
94+
STATUS_CLIENT_FLATPAK = "pkg/${utils.pkgFilename(ext: 'flatpak', arch: getArch(), version: env.VERSION, type: env.APP_TYPE)}"
95+
/* Flatpak build directories */
96+
FLATPAK_BUILD_DIR = "${env.WORKSPACE_TMP}/flatpak-build"
97+
FLATPAK_REPO_DIR = "${env.WORKSPACE_TMP}/flatpak-repo"
9298
/* prevent sharing cache dir across different jobs */
9399
GO_GENERATE_FAST_DIR = "${env.WORKSPACE_TMP}/go-generate-fast"
94100
SENTRY_PRODUCTION = "${utils.isReleaseBuild() ? 'true' : 'false'}"
@@ -128,27 +134,47 @@ pipeline {
128134
}
129135

130136
stage('Package') {
131-
steps { script {
132-
linux.bundle('tgz-linux')
133-
} }
137+
parallel {
138+
stage('Tarball') {
139+
steps { script {
140+
linux.bundle('tgz-linux')
141+
} }
142+
}
143+
stage('Flatpak') {
144+
steps { script {
145+
sh 'scripts/build-flatpak.sh'
146+
} }
147+
}
148+
}
134149
}
135150

136151
stage('Parallel Upload') {
137152
parallel {
138-
stage('Upload') {
153+
stage('Upload Tarball') {
139154
steps { script {
140155
env.PKG_URL = s5cmd.upload(env.STATUS_CLIENT_TARBALL)
141-
jenkins.setBuildDesc(AppImage: env.PKG_URL)
156+
} }
157+
}
158+
stage('Upload Flatpak') {
159+
steps { script {
160+
env.FLATPAK_URL = s5cmd.upload(env.STATUS_CLIENT_FLATPAK)
142161
} }
143162
}
144163
stage('Archive') {
145164
steps { script {
146165
archiveArtifacts("${env.STATUS_CLIENT_TARBALL}*")
166+
archiveArtifacts("${env.STATUS_CLIENT_FLATPAK}*")
147167
} }
148168
}
149169
}
150170
}
151171

172+
stage('Post Upload') {
173+
steps { script {
174+
jenkins.setBuildDesc(Tarball: env.PKG_URL, Flatpak: env.FLATPAK_URL)
175+
} }
176+
}
177+
152178
stage('E2E') {
153179
when { expression { utils.isPRBuild() && !(params.USE_NWAKU ?: false) } }
154180
steps { script {
@@ -166,10 +192,7 @@ pipeline {
166192
post {
167193
success { script { github.notifyPR(true) } }
168194
failure { script { github.notifyPR(false) } }
169-
cleanup {
170-
cleanWs(disableDeferredWipeout: true)
171-
dir(env.WORKSPACE_TMP) { deleteDir() }
172-
}
195+
cleanup { cleanWs(disableDeferredWipeout: true) }
173196
}
174197
}
175198

flatpak-wrapper.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
# Flatpak wrapper script for Status Desktop
3+
4+
# Start pcscd daemon for smartcard support
5+
PCSCD_RUN_DIR="/tmp/pcscd/run"
6+
mkdir -p "${PCSCD_RUN_DIR}"
7+
if [ -x /app/bin/pcscd ]; then
8+
/app/bin/pcscd -f &
9+
fi
10+
11+
# Execute the actual application
12+
exec /app/bin/nim_status_client "$@"

pcscd-launcher.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
# Launcher for pcscd daemon in Flatpak environment
3+
4+
PCSCD_RUN_DIR="/tmp/pcscd/run"
5+
rm -rf "${PCSCD_RUN_DIR}"
6+
mkdir -p "${PCSCD_RUN_DIR}"
7+
8+
export PCSC_DRIVERS_DIR="/app/lib/pcsc/drivers"
9+
export PCSCLITE_CONFIG_DIR="/app/etc/reader.conf.d"
10+
11+
exec /app/bin/pcscd -f "$@"

0 commit comments

Comments
 (0)