Skip to content

Commit

Permalink
build ayugram
Browse files Browse the repository at this point in the history
  • Loading branch information
solopasha committed Nov 18, 2023
1 parent 168d51c commit ffcaf1b
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 21 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/ayugram.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
on:
push:
workflow_dispatch:
name: CI
jobs:
flatpak:
name: 'Flatpak'
runs-on: ubuntu-latest
container:
image: bilelmoussaoui/flatpak-github-actions:freedesktop-23.08
options: --privileged
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'

- name: Restore cache
id: cache
uses: actions/cache/restore@v3
with:
path: .flatpak-builder
key: ayugram-flatpak-${{ github.sha }}
restore-keys: ayugram-flatpak-

- uses: flatpak/flatpak-github-actions/[email protected]
with:
bundle: ayugram.flatpak
manifest-path: io.github.ayugram.TDesktop.yml
cache: false

- name: Save cache
id: cache-save
uses: actions/cache/save@v3
if: always()
with:
path: .flatpak-builder
key: ${{ steps.cache.outputs.cache-primary-key }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.flatpak-builder/
.vscode/
repo/
32 changes: 11 additions & 21 deletions org.telegram.desktop.yml → io.github.ayugram.TDesktop.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
id: org.telegram.desktop
id: io.github.ayugram.TDesktop
runtime: org.freedesktop.Platform
runtime-version: '23.08'
sdk: org.freedesktop.Sdk
command: telegram-desktop
rename-icon: telegram
command: ayugram-desktop
rename-icon: ayugram
finish-args:
- --share=ipc
- --share=network
- --socket=wayland
- --socket=fallback-x11
- --socket=pulseaudio
- --device=all
- --talk-name=org.gnome.Mutter.IdleMonitor
- --talk-name=org.kde.StatusNotifierWatcher
- --talk-name=com.canonical.AppMenu.Registrar
Expand Down Expand Up @@ -38,8 +36,10 @@ cleanup-commands:
- mkdir -p ${FLATPAK_DEST}/lib/ffmpeg
- mkdir -p ${FLATPAK_DEST}/lib/webview
build-options:
cflags: -DNDEBUG
cxxflags: -DNDEBUG
strip: true
no-debuginfo: true
cflags: -DNDEBUG -g0
cxxflags: -DNDEBUG -g0
append-path: /usr/lib/sdk/llvm16/bin
append-ld-library-path: /usr/lib/sdk/llvm16/lib
cleanup:
Expand Down Expand Up @@ -530,27 +530,17 @@ modules:
- name: telegram-desktop
buildsystem: cmake-ninja
builddir: true
build-options:
arch:
aarch64:
cflags: -g1
cxxflags: -g1
config-opts:
- -DCMAKE_BUILD_TYPE=None
- -DTDESKTOP_API_ID=611335
- -DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c
- -DDESKTOP_APP_USE_PACKAGED_LAZY=ON
sources:
- type: git
url: https://github.com/telegramdesktop/tdesktop.git
commit: 830e9a59537dd8720735c6b0612230aac486b74c
tag: v4.11.8
x-checker-data:
type: json
url: https://api.github.com/repos/telegramdesktop/tdesktop/releases
tag-query: first | .tag_name
timestamp-query: first | .published_at
version-query: $tag | sub("^[vV]"; "")
url: https://github.com/AyuGram/AyuGramDesktop.git
commit: 6af28f6089d645799913e05e19ee837a7818b015
- type: shell
commands:
- sed -i '/-Werror/d' Telegram/ThirdParty/dispatch/cmake/modules/DispatchCompilerWarnings.cmake
- type: patch
path: rename.diff
115 changes: 115 additions & 0 deletions rename.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt
index 6a71c866d..2a59aa485 100644
--- a/Telegram/CMakeLists.txt
+++ b/Telegram/CMakeLists.txt
@@ -1913,9 +1913,9 @@ endif()

if (LINUX AND DESKTOP_APP_USE_PACKAGED)
include(GNUInstallDirs)
- configure_file("../lib/xdg/ayugram.desktop.service" "${CMAKE_CURRENT_BINARY_DIR}/ayugram.desktop.service" @ONLY)
- configure_file("../lib/xdg/ayugram.desktop.metainfo.xml" "${CMAKE_CURRENT_BINARY_DIR}/ayugram.desktop.metainfo.xml" @ONLY)
- generate_appdata_changelog(Telegram "${CMAKE_SOURCE_DIR}/changelog.txt" "${CMAKE_CURRENT_BINARY_DIR}/ayugram.desktop.metainfo.xml")
+ configure_file("../lib/xdg/io.github.ayugram.TDesktop.service" "${CMAKE_CURRENT_BINARY_DIR}/io.github.ayugram.TDesktop.service" @ONLY)
+ configure_file("../lib/xdg/io.github.ayugram.TDesktop.metainfo.xml" "${CMAKE_CURRENT_BINARY_DIR}/io.github.ayugram.TDesktop.metainfo.xml" @ONLY)
+ generate_appdata_changelog(Telegram "${CMAKE_SOURCE_DIR}/changelog.txt" "${CMAKE_CURRENT_BINARY_DIR}/io.github.ayugram.TDesktop.metainfo.xml")
install(TARGETS Telegram RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(FILES "Resources/art/icon16.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/16x16/apps" RENAME "ayugram.png")
install(FILES "Resources/art/icon32.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/32x32/apps" RENAME "ayugram.png")
@@ -1925,7 +1925,7 @@ if (LINUX AND DESKTOP_APP_USE_PACKAGED)
install(FILES "Resources/art/icon256.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps" RENAME "ayugram.png")
install(FILES "Resources/art/icon512.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/512x512/apps" RENAME "ayugram.png")
install(FILES "Resources/icons/tray_monochrome.svg" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/symbolic/apps" RENAME "telegram-symbolic.svg")
- install(FILES "../lib/xdg/ayugram.desktop.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
- install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ayugram.desktop.service" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/dbus-1/services")
- install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ayugram.desktop.metainfo.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo")
+ install(FILES "../lib/xdg/io.github.ayugram.TDesktop.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/io.github.ayugram.TDesktop.service" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/dbus-1/services")
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/io.github.ayugram.TDesktop.metainfo.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo")
endif()
diff --git a/Telegram/Resources/qrc/telegram/telegram.qrc b/Telegram/Resources/qrc/telegram/telegram.qrc
index ce814218c..c9b8c9c5c 100644
--- a/Telegram/Resources/qrc/telegram/telegram.qrc
+++ b/Telegram/Resources/qrc/telegram/telegram.qrc
@@ -55,6 +55,6 @@
</qresource>
<qresource prefix="/misc">
<file alias="default_shortcuts-custom.json">../../default_shortcuts-custom.json</file>
- <file alias="ayugram.desktop.desktop">../../../../lib/xdg/ayugram.desktop.desktop</file>
+ <file alias="io.github.ayugram.TDesktop.desktop">../../../../lib/xdg/io.github.ayugram.TDesktop.desktop</file>
</qresource>
</RCC>
diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp
index f7d5169ee..793402bd2 100644
--- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp
+++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp
@@ -198,7 +198,7 @@ bool GenerateDesktopFile(
DEBUG_LOG(("App Info: placing .desktop file to %1").arg(targetPath));
if (!QDir(targetPath).exists()) QDir().mkpath(targetPath);

- const auto sourceFile = u":/misc/ayugram.desktop.desktop"_q;
+ const auto sourceFile = u":/misc/io.github.ayugram.TDesktop.desktop"_q;
const auto targetFile = targetPath
+ QGuiApplication::desktopFileName()
+ u".desktop"_q;
@@ -328,7 +328,7 @@ bool GenerateDesktopFile(
hashMd5Hex(exePath.constData(), exePath.size(), md5Hash);
}

- QFile::remove(u"%1ayugram.desktop.%2.desktop"_q.arg(
+ QFile::remove(u"%1io.github.ayugram.TDesktop.%2.desktop"_q.arg(
targetPath,
md5Hash));
}
@@ -623,10 +623,10 @@ void start() {
md5Hash.data());
}

- return u"ayugram.desktop._%1"_q.arg(md5Hash.constData());
+ return u"io.github.ayugram.TDesktop._%1"_q.arg(md5Hash.constData());
}

- return u"ayugram.desktop"_q;
+ return u"io.github.ayugram.TDesktop"_q;
}());

LOG(("App ID: %1").arg(QGuiApplication::desktopFileName()));
diff --git a/lib/xdg/ayugram.desktop.desktop b/lib/xdg/io.github.ayugram.TDesktop.desktop
similarity index 100%
rename from lib/xdg/ayugram.desktop.desktop
rename to lib/xdg/io.github.ayugram.TDesktop.desktop
diff --git a/lib/xdg/ayugram.desktop.metainfo.xml b/lib/xdg/io.github.ayugram.TDesktop.metainfo.xml
similarity index 96%
rename from lib/xdg/ayugram.desktop.metainfo.xml
rename to lib/xdg/io.github.ayugram.TDesktop.metainfo.xml
index 1def1027e..0ac288cec 100644
--- a/lib/xdg/ayugram.desktop.metainfo.xml
+++ b/lib/xdg/io.github.ayugram.TDesktop.metainfo.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<component type="desktop">
- <id>ayugram.desktop</id>
+ <id>io.github.ayugram.TDesktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0</project_license>
<name>AyuGram Desktop</name>
@@ -73,7 +73,7 @@
<content_attribute id="money-gambling">none</content_attribute>
<content_attribute id="money-advertising">moderate</content_attribute>
</content_rating>
- <launchable type="desktop-id">ayugram.desktop.desktop</launchable>
+ <launchable type="desktop-id">io.github.ayugram.TDesktop.desktop</launchable>
<provides>
<binary>ayugram-desktop</binary>
</provides>
diff --git a/lib/xdg/ayugram.desktop.service b/lib/xdg/io.github.ayugram.TDesktop.service
similarity index 67%
rename from lib/xdg/ayugram.desktop.service
rename to lib/xdg/io.github.ayugram.TDesktop.service
index 853c53544..bcd56d806 100644
--- a/lib/xdg/ayugram.desktop.service
+++ b/lib/xdg/io.github.ayugram.TDesktop.service
@@ -1,3 +1,3 @@
[D-BUS Service]
-Name=ayugram.desktop
+Name=io.github.ayugram.TDesktop
Exec=@CMAKE_INSTALL_FULL_BINDIR@/ayugram-desktop

0 comments on commit ffcaf1b

Please sign in to comment.