1
0
telegram-desktop/telegram-desktop.spec

179 lines
5.0 KiB
RPMSpec
Raw Normal View History

Name: telegram-desktop
Summary: A new era of messaging
Version: 1.0.24
Release: 1
License: GPL-3.0
URL: https://github.com/telegramdesktop/tdesktop
Source: tdesktop-%{version}.tar.gz
Source1: breakpad-master.tar.gz
Source2: linux-syscall-support-refs-heads-master.tar.gz
Source3: gyp-master.tar.gz
Source4: patch-%{version}.diff
Source5: GSL-master.zip
Source6: variant-master.zip
ExclusiveArch: x86_64
BuildRequires: libtelegram-qt5-devel-static
BuildRequires: libappindicator-devel
BuildRequires: gcc-c++
BuildRequires: libtiff-devel
BuildRequires: libmng-devel
BuildRequires: pcre-devel
BuildRequires: ffmpeg-devel
BuildRequires: libopus-devel
BuildRequires: zlib-devel
BuildRequires: portaudio-devel
BuildRequires: desktop-file-utils
BuildRequires: chrpath
BuildRequires: cmake
BuildRequires: libopus-devel
BuildRequires: xorg-x11-devel
BuildRequires: xz
BuildRequires: unzip
BuildRequires: openal-soft-devel
BuildRequires: xcb-util-wm-devel
BuildRequires: xcb-util-image-devel
BuildRequires: xcb-util-renderutil-devel
BuildRequires: xcb-util-keysyms-devel
BuildRequires: libproxy-devel
BuildRequires: libXfixes-devel
BuildRequires: fontconfig-devel
BuildRequires: libexpat-devel
BuildRequires: freetype-devel
BuildRequires: libjpeg-devel
BuildRequires: pkgconfig(libpng)
BuildRequires: pkgconfig(xcb-util)
BuildRequires: pkgconfig(mtdev)
BuildRequires: pkgconfig(tslib)
BuildRequires: pkgconfig(harfbuzz)
BuildRequires: pkgconfig(libwebp)
BuildRequires: pkgconfig(xkbcommon)
BuildRequires: pkgconfig(xkbcommon-x11)
BuildRequires: pkgconfig(dee-1.0)
BuildRequires: pkgconfig(libavcodec)
BuildRequires: pkgconfig(libavformat)
BuildRequires: pkgconfig(libavutil)
BuildRequires: pkgconfig(liblzma)
BuildRequires: pkgconfig(libavfilter)
BuildRequires: pkgconfig(libavdevice)
BuildRequires: pkgconfig(libcrypto)
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(libva)
BuildRequires: pkgconfig(fontconfig)
BuildRequires: pkgconfig(freetype2)
BuildRequires: pkgconfig(libva-glx)
BuildRequires: pkgconfig(libva-x11)
# Runtime requirements
Requires: ffmpeg
Requires: openssl
Requires: hicolor-icon-theme
Requires: icu
Requires: jasper
%description
Telegram Desktop app. A new era of messaging.
%prep
%setup -n tdesktop-%{version}
cp %{_sourcedir}/patch-%{version}.diff .
rm -rf %{_builddir}/tdesktop-%{version}/third_party/*
cp %{_sourcedir}/GSL-master.zip . && unzip GSL-master.zip
mv GSL-master GSL
mv GSL %{_builddir}/tdesktop-%{version}/third_party/
cp %{_sourcedir}/variant-master.zip . && unzip variant-master.zip
mv variant-master variant
mv variant %{_builddir}/tdesktop-%{version}/third_party/
%setup -T -c -n breakpad -b 1
%setup -T -c -n breakpad-lss -b 2
%setup -T -c -n gyp -b 3
%build
# generate patch
# git diff --relative-directory=./a a b
# Setup compiler variables
mv %{_builddir}/tdesktop-%{version} %{_builddir}/tdesktop
mkdir -p %{_builddir}/Libraries
# patch gyp
cd %{_builddir}/Libraries
ln -s %{_builddir}/gyp ./gyp
cp %{_builddir}/tdesktop/Telegram/Patches/gyp.diff ./gyp/
cd gyp
patch -p1 < ./gyp.diff
# Link with patched Qt Static Library
cd %{_builddir}/Libraries
ln -s /usr/lib64/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
# patch with patch.diff
cd %{_builddir}/tdesktop
patch -p1 < patch-%{version}.diff
# use gyp to generate cmake files
cd %{_builddir}/tdesktop/Telegram/gyp
# patch qt.gypi to change libxkbcommon path
../../../Libraries/gyp/gyp \
-Dlinux_path_qt="%{_builddir}/Libraries/QtStatic" \
-Dqt_version="5.6.0" \
-Dlinux_lib_ssl=-lssl \
-Dlinux_lib_crypto=-lcrypto \
-Dlinux_lib_icu="-licuuc -licutu -licui18n" \
--depth=. --generator-output="../../" -Goutput_dir=out Telegram.gyp --format=cmake
# build Telegram
cd %{_builddir}/tdesktop/out/Release
cmake .
make
chrpath --delete Telegram
%install
# Install binary
install -dm755 %{buildroot}/usr/bin
install -m755 %{_builddir}/tdesktop/out/Release/Telegram \
%{buildroot}/usr/bin/telegram-desktop
# Install desktop file
install -d %{buildroot}/usr/share/applications
desktop-file-install \
--dir %{buildroot}%{_datadir}/applications \
--add-category InstantMessaging \
%{_builddir}/tdesktop/lib/xdg/telegramdesktop.desktop
# Install protocol
install -d %{buildroot}/usr/share/kde4/services
install -m644 %{_builddir}/tdesktop/lib/xdg/tg.protocol \
%{buildroot}/usr/share/kde4/services/tg.protocol
# Install icons
for icon_size in 16 32 48 64 128 256 512; do
icon_dir="%{buildroot}/usr/share/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
%files
%defattr (-, root, root, -)
/usr/bin/telegram-desktop
/usr/share/applications/telegramdesktop.desktop
%dir /usr/share/kde4
%dir /usr/share/kde4/services
/usr/share/kde4/services/tg.protocol
/usr/share/icons/hicolor/*/apps/telegram-desktop.png