add guide how build flatpak package

This commit is contained in:
0FL01 2025-07-14 09:51:35 +03:00
parent f56b5ea03e
commit c86d6c1986
15 changed files with 345 additions and 0 deletions

View file

@ -0,0 +1,39 @@
app-id: com.ayugram.desktop
runtime: org.gnome.Platform
runtime-version: '48'
sdk: org.gnome.Sdk
command: ayugram-desktop
finish-args:
- --share=ipc
- --socket=fallback-x11
- --socket=wayland
- --socket=pulseaudio
- --device=dri
- --share=network
- --filesystem=xdg-download
- --talk-name=org.kde.StatusNotifierWatcher
- --talk-name=org.gnome.Mutter.IdleMonitor
- --talk-name=com.canonical.AppMenu.Registrar
- --talk-name=com.canonical.indicator.application
- --talk-name=org.freedesktop.Notifications
- --talk-name=org.freedesktop.portal.Desktop
- --talk-name=org.freedesktop.portal.OpenURI
- --talk-name=org.freedesktop.portal.FileChooser
- --talk-name=org.sigxcpu.Feedback
modules:
- name: ayugram-repack
buildsystem: simple
build-commands:
- sed -i 's|^Exec=.*|Exec=ayugram-desktop -- %%u|' usr/share/applications/com.ayugram.desktop.desktop
- sed -i 's|^Exec=.*|Exec=/app/bin/ayugram-desktop|' usr/share/dbus-1/services/com.ayugram.desktop.service
- install -d /app/share/
- install -Dm755 AyuGram /app/bin/ayugram-desktop
- cp -a usr/share/* /app/share/
sources:
- type: dir
path: .

View file

@ -0,0 +1,22 @@
[Desktop Entry]
Name=AyuGram Desktop
Comment=Desktop version of AyuGram - ToS breaking Telegram client
TryExec=ayugram-desktop
Exec=env DESKTOPINTEGRATION=1 ayugram-desktop -- %u
Icon=com.ayugram.desktop
Terminal=false
StartupWMClass=AyuGram
Type=Application
Categories=Chat;Network;InstantMessaging;Qt;
MimeType=x-scheme-handler/tg;x-scheme-handler/tonsite;
Keywords=tg;chat;im;messaging;messenger;sms;telegram;tdesktop;
Actions=quit;
DBusActivatable=true
SingleMainWindow=true
X-GNOME-UsesNotifications=true
X-GNOME-SingleWindow=true
[Desktop Action quit]
Exec=ayugram-desktop -quit
Name=Quit AyuGram
Icon=application-exit

View file

@ -0,0 +1,3 @@
[D-BUS Service]
Name=com.ayugram.desktop
Exec=/usr/bin/ayugram-desktop

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="plane" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M1.3311718,6.36592184 C5.3576954,4.67244493 8.04267511,3.5560013 9.38611094,3.01659096 C13.2218932,1.47646481 14.0189359,1.2089284 14.5384372,1.2 C14.6526967,1.19815119 14.9081723,1.22548649 15.0736587,1.35511219 C15.2133922,1.4645656 15.2518384,1.61242159 15.2702362,1.71619544 C15.288634,1.81996929 15.3115436,2.05636876 15.2933322,2.24108442 C15.0854698,4.34939964 14.1860526,9.46572464 13.7284802,11.8270738 C13.5348641,12.8262491 13.1536281,13.1612675 12.7845475,13.1940535 C11.9824498,13.265305 11.3733733,12.6823476 10.5965026,12.190753 C9.3808532,11.4215044 8.69408865,10.9426448 7.51409044,10.1920004 C6.15039834,9.32450079 7.03442319,8.84770795 7.81158733,8.06849502 C8.01497489,7.86457129 11.5490353,4.7615061 11.6174372,4.48000946 C11.625992,4.44480359 11.6339313,4.31357282 11.5531696,4.24427815 C11.472408,4.17498349 11.3532107,4.19867957 11.2671947,4.21752527 C11.1452695,4.24423848 9.20325394,5.48334063 5.44114787,7.93483171 C4.88991321,8.30022994 4.39062196,8.47826423 3.94327414,8.46893456 C3.45010907,8.45864936 2.50145729,8.19975808 1.79623221,7.97846422 C0.931244952,7.70703829 0.243770289,7.56353344 0.303633888,7.10256824 C0.334814555,6.86246904 0.677327192,6.61692024 1.3311718,6.36592184 Z" id="Path-3" fill="#FFFFFF"></path>
</g>
<circle class="error" fill="#f23c34" cx="3.9" cy="12.7" r="2.2"/>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="plane" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M1.3311718,6.36592184 C5.3576954,4.67244493 8.04267511,3.5560013 9.38611094,3.01659096 C13.2218932,1.47646481 14.0189359,1.2089284 14.5384372,1.2 C14.6526967,1.19815119 14.9081723,1.22548649 15.0736587,1.35511219 C15.2133922,1.4645656 15.2518384,1.61242159 15.2702362,1.71619544 C15.288634,1.81996929 15.3115436,2.05636876 15.2933322,2.24108442 C15.0854698,4.34939964 14.1860526,9.46572464 13.7284802,11.8270738 C13.5348641,12.8262491 13.1536281,13.1612675 12.7845475,13.1940535 C11.9824498,13.265305 11.3733733,12.6823476 10.5965026,12.190753 C9.3808532,11.4215044 8.69408865,10.9426448 7.51409044,10.1920004 C6.15039834,9.32450079 7.03442319,8.84770795 7.81158733,8.06849502 C8.01497489,7.86457129 11.5490353,4.7615061 11.6174372,4.48000946 C11.625992,4.44480359 11.6339313,4.31357282 11.5531696,4.24427815 C11.472408,4.17498349 11.3532107,4.19867957 11.2671947,4.21752527 C11.1452695,4.24423848 9.20325394,5.48334063 5.44114787,7.93483171 C4.88991321,8.30022994 4.39062196,8.47826423 3.94327414,8.46893456 C3.45010907,8.45864936 2.50145729,8.19975808 1.79623221,7.97846422 C0.931244952,7.70703829 0.243770289,7.56353344 0.303633888,7.10256824 C0.334814555,6.86246904 0.677327192,6.61692024 1.3311718,6.36592184 Z" id="Path-3" fill="#FFFFFF"></path>
</g>
<circle fill="#888888" cx="3.9" cy="12.7" r="2.2"/>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -0,0 +1,10 @@
<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1067_20)">
<path d="M7.58588 9.73341C8.52939 10.6769 9.41338 12.269 10.085 13.6905C10.5357 14.6445 12.0164 14.6078 12.3503 13.6068L15.8086 3.23922C16.1618 2.1804 15.1541 1.17304 14.0954 1.52654L3.74092 4.98387C2.73902 5.3184 2.70382 6.80252 3.65913 7.2532C5.0706 7.91907 6.64716 8.79469 7.58588 9.73341Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_1067_20">
<rect width="16" height="16.0037" fill="white" transform="translate(0.665001 0.668152)"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 600 B

View file

@ -0,0 +1,80 @@
<?xml version='1.0' encoding='utf-8'?>
<component type="desktop">
<id>com.ayugram.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0</project_license>
<name>AyuGram Desktop</name>
<summary>Desktop version of AyuGram - ToS breaking Telegram client</summary>
<description>
<p>Telegram Desktop with Ghost Mode, Anti-Recall and cool design.</p>
</description>
<categories>
<category>Network</category>
<category>InstantMessaging</category>
</categories>
<update_contact>helpdesk_at_radolyn.com</update_contact>
<developer_name>Radolyn Labs</developer_name>
<url type="homepage">https://ayugram.one/</url>
<url type="bugtracker">https://t.me/ayugramchat/1262</url>
<url type="translate">https://crowdin.com/project/ayugram</url>
<url type="contribute">https://github.com/AyuGram/AyuGramDesktop/blob/dev/.github/CONTRIBUTING.md</url>
<screenshots>
<screenshot type="default">
<image>https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/docs/assets/preview.png</image>
</screenshot>
</screenshots>
<keywords>
<keyword>tg</keyword>
<keyword>telegram</keyword>
<keyword>tdesktop</keyword>
<keyword>messaging</keyword>
<keyword>messenger</keyword>
<keyword>chat</keyword>
<keyword>sms</keyword>
<keyword>im</keyword>
<keyword>ayugram</keyword>
</keywords>
<requires>
<display_length compare="ge">medium</display_length>
<internet>always</internet>
</requires>
<supports>
<control>pointing</control>
<control>keyboard</control>
<control>touch</control>
</supports>
<content_rating type="oars-1.1">
<content_attribute id="violence-cartoon">none</content_attribute>
<content_attribute id="violence-fantasy">none</content_attribute>
<content_attribute id="violence-realistic">none</content_attribute>
<content_attribute id="violence-bloodshed">none</content_attribute>
<content_attribute id="violence-sexual">none</content_attribute>
<content_attribute id="violence-desecration">none</content_attribute>
<content_attribute id="violence-slavery">none</content_attribute>
<content_attribute id="violence-worship">none</content_attribute>
<content_attribute id="drugs-alcohol">none</content_attribute>
<content_attribute id="drugs-narcotics">none</content_attribute>
<content_attribute id="drugs-tobacco">none</content_attribute>
<content_attribute id="sex-nudity">none</content_attribute>
<content_attribute id="sex-themes">none</content_attribute>
<content_attribute id="sex-homosexuality">none</content_attribute>
<content_attribute id="sex-prostitution">none</content_attribute>
<content_attribute id="sex-adultery">none</content_attribute>
<content_attribute id="sex-appearance">none</content_attribute>
<content_attribute id="language-profanity">none</content_attribute>
<content_attribute id="language-humor">none</content_attribute>
<content_attribute id="language-discrimination">none</content_attribute>
<content_attribute id="social-chat">intense</content_attribute>
<content_attribute id="social-info">none</content_attribute>
<content_attribute id="social-audio">intense</content_attribute>
<content_attribute id="social-location">none</content_attribute>
<content_attribute id="social-contacts">intense</content_attribute>
<content_attribute id="money-purchasing">intense</content_attribute>
<content_attribute id="money-gambling">none</content_attribute>
<content_attribute id="money-advertising">moderate</content_attribute>
</content_rating>
<launchable type="desktop-id">com.ayugram.desktop.desktop</launchable>
<provides>
<binary>ayugram-desktop</binary>
</provides>
<releases><release version="5.16.3" date="2025-07-14"><description><ul><li>Fix stale birthday suggestions removing.</li><li>Fix notification click opening a new window.</li></ul></description></release><release version="5.14.2" date="2025-05-08"><description><ul><li>Buy Rare Gifts in the Marketplace.</li><li>Sell Your Gifts for Stars.</li><li>Set Your Channel to Auto-Translate.</li></ul></description></release><release version="5.14.1" date="2025-05-01"><description><ul><li>Fix launching on Windows 7.</li></ul></description></release><release version="5.14" date="2025-05-01"><description><ul><li>Secure Group Calls Made Easy.</li><li>Automated Business Accounts.</li><li>New Gifts Settings.</li></ul></description></release><release version="5.13.1" date="2025-03-26"><description><ul><li>Fix crash in group/channel stories.</li></ul></description></release><release version="5.13" date="2025-03-26"><description><ul><li>Allow transferring my unique gifts from Send Gift section.</li><li>Edit type of gifts you accept in Settings &gt; Privacy and Security.</li><li>Swipe navigation using swipe gesture on touchpads / touchscreens.</li><li>Choose chat list quick action for swipe or middle click.</li></ul></description></release><release version="5.12.6~beta" date="2025-03-20"><description><ul><li>Allow customizing chats list swipe left action.</li><li>Fix custom emoji in poll results view.</li><li>Fix crash in main menu swipe closing.</li></ul></description></release><release version="5.12.5~beta" date="2025-03-14"><description><ul><li>Support swipe navigation on touchscreens.</li><li>Close main menu by swipe navigation.</li></ul></description></release><release version="5.12.4~beta" date="2025-03-12"><description><ul><li>Touchpad swipe back to go back in navigation history.</li><li>Touchpad swipe between folders if they're horizontal.</li><li>Out-of-the-box monochrome tray icon on Linux.</li><li>Icons telegram{,{,-attention,-mute}-panel} are renamed</li><li>Snap package got icon theming support,</li></ul></description></release><release version="5.12.3" date="2025-03-10"><description><ul><li>Fix a couple more crashes.</li><li>Fix gift disappearing on unpin.</li><li>Fix country emoji for Fragment numbers.</li></ul></description></release></releases></component>

177
docs/building-flatpak.md Normal file
View file

@ -0,0 +1,177 @@
# Building the AyuGram Flatpak
This guide describes the complete process for creating a Flatpak package for AyuGram. The process consists of two main stages:
1. **Building the AyuGram binary** using the official Docker environment.
2. **Packaging the built binary** and necessary resources into a Flatpak package.
## Prerequisites
This guide was tested on **Fedora 42** (inside a Toolbx container) but should work on most modern Linux distributions.
Before you begin, ensure that the following components are installed on your system:
* `git`
* `docker`
* `flatpak`
* `flatpak-builder`
Also, make sure your user is added to the `docker` group to run commands without `sudo`.
```bash
# Example for Fedora/Ubuntu
sudo usermod -aG docker $USER
# You will need to log out and log back in for this change to take effect
```
## Step 1: Build the AyuGram Binary
First, you need to build the application itself by following the official instructions.
1. **Clone the AyuGram repository:**
Choose a directory for the build and run the command. Note that this will create a directory named `tdesktop`.
```bash
git clone --recursive https://github.com/AyuGram/AyuGramDesktop.git tdesktop
cd tdesktop
```
2. **Prepare the libraries:**
Run the preparation script. You might need `poetry` for this.
```bash
# If poetry is not installed: pip install poetry
./Telegram/build/prepare/linux.sh
```
3. **Build the project using Docker:**
This command will run the build in an isolated CentOS environment.
```bash
docker run --rm -it \
-u $(id -u) \
-v "$PWD:/usr/src/tdesktop" \
ghcr.io/telegramdesktop/tdesktop/centos_env:latest \
/usr/src/tdesktop/Telegram/build/docker/centos_env/build.sh \
-D TDESKTOP_API_ID=2040 \
-D TDESKTOP_API_HASH=b18441a1ff607e10a989891a5462e627
```
After the build completes successfully, the resulting binary will be located at:
`tdesktop/out/Release/AyuGram`.
## Step 2: Prepare for the Flatpak Build
Now that we have the binary, we will prepare a dedicated directory for the Flatpak build.
1. **Create a working directory:**
Return to your parent directory and create a folder for the Flatpak build.
```bash
# If you are inside the tdesktop directory, navigate out of it
cd ..
mkdir ayugram-flatpak-build
cd ayugram-flatpak-build
```
2. **Copy the necessary files:**
We need to copy three items from the `tdesktop` repository into this new directory:
* The built `AyuGram` binary.
* The `com.ayugram.desktop.yml` manifest and its resources (icons, .desktop file, metadata), which are located in the same folder.
Execute the following commands from the `ayugram-flatpak-build` directory:
```bash
# Copy the binary from the correct path
cp ../tdesktop/out/Release/AyuGram .
# Copy the manifest and all resources from the flatpak-files directory
cp -r ../tdesktop/docs/assets/flatpak-files/* .
```
After this, your `ayugram-flatpak-build` directory should have the following structure:
```
.
├── AyuGram
├── com.ayugram.desktop.yml
└── usr/
└── share/
├── applications/
├── dbus-1/
├── icons/
└── metainfo/
```
## Step 3: Build the Flatpak Package
Everything is now ready for the final step.
1. **Install the GNOME SDK:**
Our Flatpak uses the GNOME runtime. Ensure you have the corresponding SDK (Software Development Kit) installed.
```bash
flatpak install --user org.gnome.Sdk//48
```
*Note: The manifest uses runtime version `48`. If `flatpak` cannot find this version, make sure you have the Flathub repository enabled.*
You now have two build options.
### Option A: Build and Install into the System (for testing)
This method is ideal for quickly testing the application.
1. **Run the build and installation:**
```bash
flatpak-builder --user --install --force-clean build-dir com.ayugram.desktop.yml
```
* `--user`: Install for the current user.
* `--install`: Automatically install after building.
* `--force-clean`: Start with a clean build.
* `build-dir`: A temporary directory for the build.
*Problem and Solution:* If you see a `Permission denied` or `Failure spawning rofiles-fuse` error, add the `--disable-rofiles-fuse` flag:
```bash
flatpak-builder --disable-rofiles-fuse --user --install --force-clean build-dir com.ayugram.desktop.yml
```
2. **Run the installed application:**
```bash
flatpak run com.ayugram.desktop
```
### Option B: Build a Portable `.flatpak` File (for distribution)
This method creates a single file that can be distributed to other users for installation.
1. **Clean up old artifacts (important!):**
If you have previously attempted to build a bundle, delete the old repository directory to avoid errors.
```bash
rm -rf repo
```
2. **Build the application into a local repository:**
```bash
flatpak-builder --repo=repo --force-clean build-dir com.ayugram.desktop.yml
```
* `--repo=repo`: Tells `flatpak-builder` to export the result into a directory named `repo`, creating a repository there.
*Problem and Solution:* As with Option A, add the `--disable-rofiles-fuse` flag if you encounter a `rofiles-fuse` error.
3. **Create the `.flatpak` bundle:**
Now, let's package the contents of the `repo` repository into a single file.
```bash
flatpak build-bundle repo ayugram-desktop-5.16.3.flatpak com.ayugram.desktop
```
* `repo`: The source (our local repository).
* `ayugram-desktop-5.16.3.flatpak`: The name of the final file (remember to update the version if necessary).
* `com.ayugram.desktop`: The ID of the application to be packaged.
As a result, the `ayugram-desktop-5.16.3.flatpak` file will appear in the current directory, ready for installation. It can be installed with the command:
```bash
flatpak install --user ayugram-desktop-5.16.3.flatpak
```