1
0
telegram-desktop/telegram-desktop.spec

168 lines
4.7 KiB
RPMSpec

Name: telegram-desktop
Summary: A new era of messaging
Version: 0.10.19
Release: 1
License: GPL-3.0
URL: https://github.com/telegramdesktop/tdesktop
Source: tdesktop-%{version}.tar.gz
Source1: breakpad-refs-heads-master.tar.gz
Source2: linux-syscall-support-refs-heads-master.tar.gz
Source3: gyp-master.tar.gz
ExclusiveArch: x86_64
BuildRequires: libtelegram-qt5-devel-static
BuildRequires: gcc5-c++
BuildRequires: libappindicator-devel
BuildRequires: libpng16-devel
BuildRequires: libtiff-devel
BuildRequires: libmng-devel
BuildRequires: libwebp-devel
BuildRequires: cmake
BuildRequires: pkgconfig(libwebp)
BuildRequires: libopus-devel
BuildRequires: xorg-x11-devel
BuildRequires: xz
BuildRequires: openal-soft-devel
BuildRequires: xcb-util-wm-devel
BuildRequires: xcb-util-devel
BuildRequires: xcb-util-image-devel
BuildRequires: xcb-util-renderutil-devel
BuildRequires: xcb-util-keysyms-devel
BuildRequires: mtdev-devel
BuildRequires: tslib-devel
BuildRequires: harfbuzz-devel
BuildRequires: pkgconfig(xkbcommon)
BuildRequires: pkgconfig(xkbcommon-x11)
BuildRequires: pkgconfig(dee-1.0)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(libavcodec)
BuildRequires: pkgconfig(libavformat)
BuildRequires: pkgconfig(libavutil)
BuildRequires: pkgconfig(liblzma)
BuildRequires: libavfilter-devel
BuildRequires: libavdevice-devel
BuildRequires: libproxy-devel
BuildRequires: pkgconfig(libcrypto)
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(gtk+-2.0)
BuildRequires: pkgconfig(libva)
BuildRequires: pkgconfig(fontconfig)
BuildRequires: pcre-devel
BuildRequires: xcb-util-image-devel
BuildRequires: xcb-util-keysyms-devel
BuildRequires: xcb-util-renderutil-devel
BuildRequires: xcb-util-wm-devel
BuildRequires: pkgconfig(freetype2)
BuildRequires: pkgconfig(libva-glx)
BuildRequires: pkgconfig(libva-x11)
BuildRequires: ffmpeg-devel
BuildRequires: libopus-devel
BuildRequires: zlib-devel
BuildRequires: portaudio-devel
BuildRequires: desktop-file-utils
BuildRequires: chrpath
# 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.diff .
%setup -T -c -n breakpad -b 1
%setup -T -c -n breakpad-lss -b 2
%setup -T -c -n gyp -b 3
%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
# 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 aur_fixes.diff
cd %{_builddir}/tdesktop
patch -p1 < patch.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 . -DCMAKE_ASM_COMPILER=${AR} -DCMAKE_CXX_COMPILER=${CXX}
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
%clean
rm -rf %{buildroot}
%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