1
0
telegram-desktop/telegram-desktop.spec

212 lines
7.4 KiB
RPMSpec
Raw Normal View History

#
# spec file for package telegram-desktop
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: telegram-desktop
Version: 0.9.56
Release: 0
Summary: A new era of messaging
License: GPL-3.0
Url: https://github.com/telegramdesktop/tdesktop
Source: https://github.com/telegramdesktop/tdesktop/archive/v%{version}.tar.gz
Source1: breakpad-refs-heads-master.tar.gz
Source2: linux-syscall-support-refs-heads-master.tar.gz
Source3: unity.h
BuildRequires: desktop-file-utils
BuildRequires: gcc5-c++
BuildRequires: hicolor-icon-theme
BuildRequires: libappindicator-devel
BuildRequires: libavdevice-devel
BuildRequires: libavfilter-devel
BuildRequires: libmng-devel
BuildRequires: libopus-devel
BuildRequires: libpng16-devel
BuildRequires: libtelegram-qt5-devel-static
BuildRequires: libtiff-devel
BuildRequires: libwebp-devel
BuildRequires: mtdev-devel
BuildRequires: openal-soft-devel
BuildRequires: pkgconfig
BuildRequires: tslib-devel
BuildRequires: xcb-util-devel
BuildRequires: xcb-util-image-devel
BuildRequires: xcb-util-keysyms-devel
BuildRequires: xcb-util-renderutil-devel
BuildRequires: xcb-util-wm-devel
BuildRequires: xorg-x11-devel
BuildRequires: xz
BuildRequires: pkgconfig(dee-1.0)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(gtk+-2.0)
BuildRequires: pkgconfig(libavcodec)
BuildRequires: pkgconfig(libavformat)
BuildRequires: pkgconfig(libavutil)
BuildRequires: pkgconfig(libcrypto)
BuildRequires: pkgconfig(liblzma)
BuildRequires: pkgconfig(libva)
BuildRequires: pkgconfig(libva-glx)
BuildRequires: pkgconfig(libva-x11)
BuildRequires: pkgconfig(libwebp)
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(xkbcommon)
BuildRequires: pkgconfig(xkbcommon-x11)
# Runtime requirements
Requires: ffmpeg
Requires: hicolor-icon-theme
Requires: icu
Requires: jasper
Requires: openssl
Requires(post): desktop-file-utils
Requires(postun): desktop-file-utils
ExclusiveArch: x86_64
%description
Telegram Desktop app. A new era of messaging.
%prep
%setup -q -n tdesktop-%{version}
cp %{_sourcedir}/unity.h ./Telegram/SourceFiles/
sed -i 's/CUSTOM_API_ID//g' "./Telegram/Telegram.pro"
sed -i 's,LIBS += %{_prefix}/local/lib/libxkbcommon.a,,g' "./Telegram/Telegram.pro"
sed -i 's,LIBS += %{_prefix}/local/lib/libz.a,LIBS += -lz,g' "./Telegram/Telegram.pro"
sed -i 's,<unity/unity/unity\.h>,"unity.h",g' "./Telegram/SourceFiles/pspecific_linux.cpp"
sed -i 's,<unity/unity/unity\.h>,"unity.h",g' "./Telegram/SourceFiles/platform/linux/linux_libs.h"
sed -i 's/c++11/c++14/g' "./Telegram/Telegram.pro"
# sed -i "s,/usr/local/tdesktop/Qt-5.6.0,%{_builddir}/Libraries/QtStatic,g" "./Telegram/Telegram.pro"
# sed -i "s,5\.6\.0,5.6.0,g" "./Telegram/Telegram.pro"
(
echo "DEFINES += TDESKTOP_DISABLE_AUTOUPDATE"
echo "DEFINES += TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME"
echo 'INCLUDEPATH += "%{_libdir}/glib-2.0/include"'
echo 'INCLUDEPATH += "%{_libdir}/gtk-2.0/include"'
echo 'INCLUDEPATH += "%{_includedir}/ffmpeg"'
echo 'INCLUDEPATH += "%{_includedir}/libdbusmenu-glib-0.4"'
echo 'INCLUDEPATH += "%{_includedir}/opus"'
echo 'LIBS += -lcrypto -lssl -lqwebp -lwebp'
) >> "./Telegram/Telegram.pro"
%setup -T -c -n breakpad -b 1
%setup -T -c -n breakpad-lss -b 2
%build
# Setup compiler variables
export CC="gcc-5"
export CXX="g++-5"
export AR="gcc-ar-5"
mv %{_builddir}/tdesktop-%{version} %{_builddir}/tdesktop
mkdir -p %{_builddir}/Libraries
# Link with patched Qt Static Library
cd %{_builddir}/Libraries
ln -s %{_libdir}/libtelegram-qt5 ./QtStatic
# Build breakpad
cd %{_builddir}/Libraries
ln -s %{_builddir}/breakpad ./breakpad
cd breakpad
ln -s %{_builddir}/breakpad-lss ./src/third_party/lss
./configure
make
export PATH="%{_libdir}/libtelegram-qt5/bin/:$PATH"
# Build codegen_style
mkdir -p "%{_builddir}/tdesktop/Linux/obj/codegen_style/Release"
cd %{_builddir}/tdesktop/Linux/obj/codegen_style/Release
qmake QMAKE_CXX="g++-5" QMAKE_LINK="g++-5" \
QT_TDESKTOP_VERSION="5.6.0" \
QT_TDESKTOP_PATH="%{_builddir}/Libraries/QtStatic" \
CONFIG+=release ../../../../Telegram/build/qmake/codegen_style/codegen_style.pro
make
# Build codegen_numbers
mkdir -p "%{_builddir}/tdesktop/Linux/obj/codegen_numbers/Release"
cd %{_builddir}/tdesktop/Linux/obj/codegen_numbers/Release
qmake QMAKE_CXX="g++-5" QMAKE_LINK="g++-5" \
QT_TDESKTOP_VERSION="5.6.0" \
QT_TDESKTOP_PATH="%{_builddir}/Libraries/QtStatic" \
CONFIG+=release ../../../../Telegram/build/qmake/codegen_numbers/codegen_numbers.pro
make
# Build MetaLang
mkdir -p "%{_builddir}/tdesktop/Linux/ReleaseIntermediateLang"
cd %{_builddir}/tdesktop/Linux/ReleaseIntermediateLang
qmake QMAKE_CXX="g++-5" QMAKE_LINK="g++-5" \
QT_TDESKTOP_VERSION="5.6.0" \
QT_TDESKTOP_PATH="%{_builddir}/Libraries/QtStatic" \
CONFIG+=release "../../Telegram/MetaLang.pro"
make
# Build Telegram Desktop
mkdir -p "%{_builddir}/tdesktop/Linux/ReleaseIntermediate"
cd %{_builddir}/tdesktop/Linux/ReleaseIntermediate
./../codegen/Release/codegen_style "-I./../../Telegram/Resources" "-I./../../Telegram/SourceFiles" "-o./../../Telegram/GeneratedFiles/styles" all_files.style --rebuild
./../codegen/Release/codegen_numbers "-o./../../Telegram/GeneratedFiles" "./../../Telegram/Resources/numbers.txt"
./../ReleaseLang/MetaLang -lang_in ./../../Telegram/Resources/langs/lang.strings -lang_out ./../../Telegram/GeneratedFiles/lang_auto
qmake QMAKE_CXX="g++-5" QMAKE_LINK="g++-5" CONFIG+=release \
QT_TDESKTOP_VERSION="5.6.0" \
QT_TDESKTOP_PATH="%{_builddir}/Libraries/QtStatic" \
"../../Telegram/Telegram.pro"
make
%install
# Install binary
install -dm755 %{buildroot}%{_prefix}/bin
install -m755 %{_builddir}/tdesktop/Linux/Release/Telegram \
%{buildroot}%{_bindir}/telegram-desktop
# Install desktop file
install -d %{buildroot}%{_datadir}/applications
desktop-file-install \
--dir %{buildroot}%{_datadir}/applications \
--add-category InstantMessaging \
%{_builddir}/tdesktop/lib/xdg/telegramdesktop.desktop
# Install protocol
install -d %{buildroot}%{_datadir}/kde4/services
install -m644 %{_builddir}/tdesktop/lib/xdg/tg.protocol \
%{buildroot}%{_datadir}/kde4/services/tg.protocol
# Install icons
for icon_size in 16 32 48 64 128 256 512; do
icon_dir="%{buildroot}%{_datadir}/icons/hicolor/${icon_size}x${icon_size}/apps"
install -d "${icon_dir}"
install -m644 "%{_builddir}/tdesktop/Telegram/Resources/art/icon${icon_size}.png" \
"${icon_dir}/telegram-desktop.png"
done
%post
%desktop_database_post
%icon_theme_cache_post
%postun
%desktop_database_postun
%icon_theme_cache_postun
%files
%defattr (-, root, root, -)
%{_bindir}/telegram-desktop
%{_datadir}/applications/telegramdesktop.desktop
%dir %{_datadir}/kde4
%dir %{_datadir}/kde4/services
%{_datadir}/kde4/services/tg.protocol
%{_datadir}/icons/hicolor/*/apps/telegram-desktop.png
%changelog