Add new option to simplify creation of self-contained packages (snap/flatpak/appimage)

This commit is contained in:
Ilya Fedin 2020-05-02 06:32:40 +04:00 committed by John Preston
parent 89950de93e
commit 3135463017
20 changed files with 93 additions and 157 deletions

View File

@ -133,14 +133,6 @@ jobs:
cd Libraries
echo ::set-env name=LibrariesPath::`pwd`
- name: Range-v3.
run: |
echo "Find necessary branch from doc."
cloneRange=$(grep -A 1 "range-v3" $REPO_NAME/$DOC_PATH | sed -n 1p)
cd $LibrariesPath
echo $cloneRange
eval $cloneRange
- name: Patches.
run: |
echo "Find necessary commit from doc."
@ -440,11 +432,7 @@ jobs:
git submodule update qtbase qtwayland qtimageformats qtsvg
cd qtbase
git apply ../../patches/qtbase_${QT}.diff
cd src/plugins/platforminputcontexts
git clone $GIT/desktop-app/fcitx.git
git clone $GIT/desktop-app/hime.git
git clone $GIT/desktop-app/nimf.git
cd ../../../..
cd ../
./configure -prefix "$QT_PREFIX" \
-release \
@ -473,18 +461,6 @@ jobs:
cd $LibrariesPath
sudo cp -R qt-cache/. /
- name: Material Decoration.
run: |
cd $LibrariesPath
git clone --depth=1 $GIT/desktop-app/materialdecoration.git
cd materialdecoration
$QT_PREFIX/bin/qmake CONFIG+=static
make -j$(nproc)
sudo make install
cd ..
rm -rf materialdecoration
- name: Breakpad cache.
id: cache-breakpad
uses: actions/cache@v1

View File

@ -100,14 +100,6 @@ jobs:
cd Libraries/macos
echo ::set-env name=LibrariesPath::`pwd`
- name: Range-v3.
run: |
echo "Find necessary branch from doc."
cloneRange=$(grep -A 1 "range-v3" $REPO_NAME/$DOC_PATH | sed -n 1p)
cd $LibrariesPath
echo $cloneRange
eval $cloneRange
- name: Patches.
run: |
echo "Find necessary commit from doc."

View File

@ -111,15 +111,6 @@ jobs:
run: |
choco install --no-progress -y nasm yasm jom ninja
- name: Range-v3.
shell: bash
run: |
echo "Find necessary branch from doc."
cloneRange=$(grep -A 1 "range-v3" $REPO_NAME/$DOC_PATH | sed -n 1p)
cd $LibrariesPath
echo $cloneRange
eval $cloneRange
- name: Patches.
shell: bash
run: |

24
.gitmodules vendored
View File

@ -67,3 +67,27 @@
[submodule "Telegram/ThirdParty/hunspell"]
path = Telegram/ThirdParty/hunspell
url = https://github.com/hunspell/hunspell
[submodule "Telegram/ThirdParty/materialdecoration"]
path = Telegram/ThirdParty/materialdecoration
url = https://github.com/desktop-app/materialdecoration.git
[submodule "Telegram/ThirdParty/range-v3"]
path = Telegram/ThirdParty/range-v3
url = https://github.com/ericniebler/range-v3.git
[submodule "Telegram/ThirdParty/fcitx-qt5"]
path = Telegram/ThirdParty/fcitx-qt5
url = https://github.com/fcitx/fcitx-qt5.git
[submodule "Telegram/ThirdParty/nimf"]
path = Telegram/ThirdParty/nimf
url = https://github.com/hamonikr/nimf.git
[submodule "Telegram/ThirdParty/hime"]
path = Telegram/ThirdParty/hime
url = https://github.com/hime-ime/hime.git
[submodule "Telegram/ThirdParty/qt5ct"]
path = Telegram/ThirdParty/qt5ct
url = https://github.com/desktop-app/qt5ct.git
[submodule "Telegram/ThirdParty/lxqt-qtplugin"]
path = Telegram/ThirdParty/lxqt-qtplugin
url = https://github.com/lxqt/lxqt-qtplugin.git
[submodule "Telegram/ThirdParty/libqtxdg"]
path = Telegram/ThirdParty/libqtxdg
url = https://github.com/lxqt/libqtxdg.git

View File

@ -67,12 +67,33 @@ generate_numbers(Telegram ${res_loc}/numbers.txt)
set_target_properties(Telegram PROPERTIES AUTOMOC ON AUTORCC ON)
if (LINUX AND NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION)
if (LINUX)
target_link_libraries(Telegram
PRIVATE
desktop-app::external_statusnotifieritem
desktop-app::external_dbusmenu_qt
desktop-app::external_materialdecoration
desktop-app::external_nimf_qt5
desktop-app::external_qt5ct
desktop-app::external_qt5ct_style
desktop-app::external_qt5ct_qtplugin
)
if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION)
# conflicts with Qt static link
if (DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES)
target_link_libraries(Telegram
PRIVATE
desktop-app::external_lxqt_qtplugin
)
endif()
target_link_libraries(Telegram
PRIVATE
desktop-app::external_statusnotifieritem
desktop-app::external_dbusmenu_qt
desktop-app::external_fcitx_qt5
desktop-app::external_hime_qt
)
endif()
endif()
if (add_hunspell_library)
@ -1010,14 +1031,13 @@ PRIVATE
mainwindow.h
observer_peer.cpp
observer_peer.h
qt_static_plugins.cpp
settings.cpp
settings.h
)
if (DESKTOP_APP_USE_PACKAGED)
nice_target_sources(Telegram ${src_loc} PRIVATE qt_functions.cpp)
else()
nice_target_sources(Telegram ${src_loc} PRIVATE qt_static_plugins.cpp)
endif()
nice_target_sources(Telegram ${res_loc}

View File

@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include <QtCore/QtPlugin>
#ifndef DESKTOP_APP_USE_PACKAGED
Q_IMPORT_PLUGIN(QWebpPlugin)
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
@ -30,20 +31,41 @@ Q_IMPORT_PLUGIN(QWaylandXdgShellV5IntegrationPlugin)
Q_IMPORT_PLUGIN(QWaylandXdgShellV6IntegrationPlugin)
Q_IMPORT_PLUGIN(QWaylandXdgShellIntegrationPlugin)
Q_IMPORT_PLUGIN(QWaylandBradientDecorationPlugin)
Q_IMPORT_PLUGIN(QWaylandMaterialDecorationPlugin)
Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
Q_IMPORT_PLUGIN(QWaylandIntegrationPlugin)
Q_IMPORT_PLUGIN(QWaylandEglPlatformIntegrationPlugin)
Q_IMPORT_PLUGIN(QGenericEnginePlugin)
Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin)
Q_IMPORT_PLUGIN(QSvgPlugin)
Q_IMPORT_PLUGIN(QSvgIconPlugin)
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
Q_IMPORT_PLUGIN(QConnmanEnginePlugin)
Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin)
Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin)
Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin)
Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin)
Q_IMPORT_PLUGIN(NimfInputContextPlugin)
Q_IMPORT_PLUGIN(QXdgDesktopPortalThemePlugin)
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
#endif // Q_OS_WIN | Q_OS_MAC | Q_OS_LINUX
#endif // !DESKTOP_APP_USE_PACKAGED
#ifdef Q_OS_LINUX
#if !defined DESKTOP_APP_USE_PACKAGED || defined DESKTOP_APP_USE_PACKAGED_LAZY
Q_IMPORT_PLUGIN(QWaylandMaterialDecorationPlugin)
Q_IMPORT_PLUGIN(NimfInputContextPlugin)
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin)
Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin)
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
#endif // !DESKTOP_APP_USE_PACKAGED || DESKTOP_APP_USE_PACKAGED_LAZY
#if !defined DESKTOP_APP_USE_PACKAGED || defined DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES
Q_IMPORT_PLUGIN(Qt5CTPlatformThemePlugin)
Q_IMPORT_PLUGIN(Qt5CTStylePlugin)
#endif // !DESKTOP_APP_USE_PACKAGED || DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES
// conflicts with Qt static link
#ifdef DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
Q_IMPORT_PLUGIN(LXQtPlatformThemePlugin)
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
#endif // DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES
#endif // Q_OS_LINUX

1
Telegram/ThirdParty/fcitx-qt5 vendored Submodule

@ -0,0 +1 @@
Subproject commit 4abe66549e13b33fd4baa84858d932e0178ce8c0

1
Telegram/ThirdParty/hime vendored Submodule

@ -0,0 +1 @@
Subproject commit 7525645598649afeab5bfe7fda612c2ad744e7a3

1
Telegram/ThirdParty/libqtxdg vendored Submodule

@ -0,0 +1 @@
Subproject commit ae412d30c695f3d4ce9b79feabc937eefde5537b

1
Telegram/ThirdParty/lxqt-qtplugin vendored Submodule

@ -0,0 +1 @@
Subproject commit 418162b36eff24fe70fd9195c60fae7276afa286

@ -0,0 +1 @@
Subproject commit e58c870f2365178b0553664d762a7a2aeae99bd4

1
Telegram/ThirdParty/nimf vendored Submodule

@ -0,0 +1 @@
Subproject commit 7234ac6724f4b7870aebed4dae95a4b9edbccd70

1
Telegram/ThirdParty/qt5ct vendored Submodule

@ -0,0 +1 @@
Subproject commit a959a35dfe3b9547a9f6bc8c102a71941cf0fc0a

1
Telegram/ThirdParty/range-v3 vendored Submodule

@ -0,0 +1 @@
Subproject commit 4d6a463bca51bc316f9b565edd94e82388206093

View File

@ -4,7 +4,7 @@
# For license and copyright information please follow this link:
# https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
if (TDESKTOP_USE_PACKAGED_TGVOIP)
if (TDESKTOP_USE_PACKAGED_TGVOIP AND NOT DESKTOP_APP_USE_PACKAGED_LAZY)
add_library(lib_tgvoip INTERFACE IMPORTED GLOBAL)
add_library(tdesktop::lib_tgvoip ALIAS lib_tgvoip)

View File

@ -56,7 +56,6 @@ Go to ***BuildPath*** and run
cd patches
git checkout 10aeaf6
cd ../
git clone --branch 0.10.0 https://github.com/ericniebler/range-v3
git clone https://github.com/xiph/opus
cd opus
@ -246,10 +245,7 @@ Go to ***BuildPath*** and run
cd qtbase
git apply ../../patches/qtbase_5_12_8.diff
cd src/plugins/platforminputcontexts
git clone https://github.com/desktop-app/fcitx.git
git clone https://github.com/desktop-app/hime.git
git clone https://github.com/desktop-app/nimf.git
cd ../../../..
cd ..
OPENSSL_DIR=/usr/local/desktop-app/openssl-1.1.1
./configure -prefix "/usr/local/desktop-app/Qt-5.12.8" \
@ -275,13 +271,6 @@ Go to ***BuildPath*** and run
sudo make install
cd ..
git clone --depth=1 https://github.com/desktop-app/materialdecoration.git
cd materialdecoration
/usr/local/desktop-app/Qt-5.12.8/bin/qmake CONFIG+=static
make $MAKE_THREADS_CNT
sudo make install
cd ..
git clone https://chromium.googlesource.com/external/gyp
cd gyp
git checkout 9f2a7bb1

View File

@ -66,7 +66,6 @@ Open **x86 Native Tools Command Prompt for VS 2019.bat**, go to ***BuildPath***
cd patches
git checkout 10aeaf6
cd ..
git clone --branch 0.10.0 https://github.com/ericniebler/range-v3 range-v3
git clone https://github.com/desktop-app/lzma.git
cd lzma\C\Util\LzmaLib

View File

@ -54,7 +54,6 @@ Go to ***BuildPath*** and run
cd patches
git checkout 395b620
cd ../
git clone --branch 0.10.0 https://github.com/ericniebler/range-v3
cd xz-5.0.5
CFLAGS="-mmacosx-version-min=10.10" LDFLAGS="-mmacosx-version-min=10.10" ./configure

View File

@ -49,7 +49,6 @@ Go to ***BuildPath*** and run
cd patches
git checkout 10aeaf6
cd ..
git clone --branch 0.10.0 https://github.com/ericniebler/range-v3
xz_ver=5.2.4
wget https://tukaani.org/xz/xz-$xz_ver.tar.gz

View File

@ -68,29 +68,27 @@ parts:
source: .
source-type: git
parse-info: [share/metainfo/telegramdesktop.appdata.xml]
build-environment:
- CFLAGS: "$CFLAGS -I$SNAPCRAFT_STAGE/usr/include/$SNAPCRAFT_ARCH_TRIPLET/qt5/QtWaylandClient/5.12.3"
- CXXFLAGS: "$CXXFLAGS -I$SNAPCRAFT_STAGE/usr/include/$SNAPCRAFT_ARCH_TRIPLET/qt5/QtWaylandClient/5.12.3"
build-snaps:
- kde-frameworks-5-core18-sdk
- kde-frameworks-5-core18
build-packages:
- gcc-8
- g++-8
- libmapbox-variant-dev
- libasound2-dev
- libglib2.0-dev
- libglvnd-dev
- libhunspell-dev
- liblz4-dev
- libgtk-3-dev
- liblzma-dev
- libminizip-dev
- libopus-dev
- libpulse-dev
- libssl-dev
- zlib1g-dev
stage-packages:
- libasound2
- libhunspell-1.6-0
- liblz4-1
- liblzma5
- libminizip1
- libopus0
- libpulse0
- libssl1.1
@ -98,14 +96,12 @@ parts:
configflags:
- -DCMAKE_C_COMPILER=gcc-8
- -DCMAKE_CXX_COMPILER=g++-8
- -DCMAKE_AUTOMOC_MOC_OPTIONS=-I$SNAPCRAFT_STAGE/usr/include/$SNAPCRAFT_ARCH_TRIPLET/qt5/QtWaylandClient/5.12.3
- -DCMAKE_BUILD_TYPE=Release
- -DTDESKTOP_API_ID=611335
- -DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c
- -DDESKTOP_APP_USE_PACKAGED_LAZY=ON
- -DDESKTOP_APP_USE_PACKAGED_FONTS=OFF
- -DDESKTOP_APP_USE_PACKAGED_GSL=OFF
- -DDESKTOP_APP_USE_PACKAGED_EXPECTED=OFF
- -DDESKTOP_APP_USE_PACKAGED_RLOTTIE=OFF
- -DTDESKTOP_USE_PACKAGED_TGVOIP=OFF
- -DTDESKTOP_USE_FONTCONFIG_FALLBACK=ON
override-pull: |
snapcraftctl pull
@ -126,10 +122,7 @@ parts:
after:
- cmake
- ffmpeg
- libdbusmenu-qt
- openal
- range-v3
- xxhash
telegram-launcher:
plugin: dump
@ -232,20 +225,6 @@ parts:
after:
- nasm
fcitx-qt5:
source: https://github.com/fcitx/fcitx-qt5.git
source-depth: 1
source-tag: 1.2.4
plugin: cmake
build-snaps:
- kde-frameworks-5-core18-sdk
- kde-frameworks-5-core18
build-packages:
- libglvnd-dev
configflags:
- -DCMAKE_BUILD_TYPE=Release
- -DENABLE_LIBRARY=OFF
ffmpeg:
source: https://github.com/FFmpeg/FFmpeg.git
source-depth: 1
@ -377,46 +356,6 @@ parts:
- nasm
- dav1d
libdbusmenu-qt:
source: https://github.com/unity8-team/libdbusmenu-qt.git
source-depth: 1
source-tag: 0.9.3+16.04.20160218-0ubuntu1
plugin: cmake
build-snaps:
- kde-frameworks-5-core18-sdk
- kde-frameworks-5-core18
build-packages:
- libglvnd-dev
configflags:
- -DCMAKE_BUILD_TYPE=Release
- -DWITH_DOC=OFF
prime:
- -./include
- -./lib/cmake
- -./lib/pkgconfig
materialdecoration:
source: https://github.com/desktop-app/materialdecoration.git
source-depth: 1
plugin: dump
build-snaps:
- kde-frameworks-5-core18-sdk
- kde-frameworks-5-core18
build-packages:
- libglvnd-dev
override-build: |
KF5_DIR=/snap/kde-frameworks-5-core18-sdk/current
$KF5_DIR/usr/lib/qt5/bin/qmake -qtconf "$SNAPCRAFT_STAGE/qt.conf"
make -j$(nproc)
make INSTALL_ROOT="$SNAPCRAFT_PART_INSTALL/tmp" install
cp -a "$SNAPCRAFT_PART_INSTALL/tmp/$KF5_DIR/." "$SNAPCRAFT_PART_INSTALL"
rm -r "$SNAPCRAFT_PART_INSTALL/tmp"
after:
- qtconf
- qtwayland
openal:
source: https://github.com/kcat/openal-soft.git
source-depth: 1
@ -443,17 +382,6 @@ parts:
- -./lib/cmake
- -./lib/pkgconfig
range-v3:
source: https://github.com/ericniebler/range-v3.git
source-depth: 1
source-tag: 0.10.0
plugin: cmake
configflags:
- -DRANGE_V3_TESTS=OFF
- -DRANGE_V3_EXAMPLES=OFF
- -DRANGE_V3_DOCS=OFF
prime: [-./*]
qgnomeplatform:
source: https://github.com/FedoraQt/QGnomePlatform.git
source-depth: 1
@ -526,14 +454,3 @@ parts:
after:
- qtconf
prime: [-./*]
xxhash:
source: https://github.com/Cyan4973/xxHash.git
source-depth: 1
source-tag: v0.7.2
plugin: make
make-parameters: [PREFIX=]
prime:
- -./bin
- -./include
- -./share