telegram/telegram.spec

180 lines
5.6 KiB
RPMSpec

%define qt_ver 5.5.1
%define qt_patchver %(echo %qt_ver | tr . _)
%define qt_majver %(echo %qt_ver | cut -d. -f1-2)
Name: telegram
Version: 0.9.33
Release: 2mamba
Summary: The official desktop client for the Telegram messenger
Group: Graphical Desktop/Applications/Internet
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://telegram.org/
## GITSOURCE https://github.com/telegramdesktop/tdesktop.git v0.9.32
Source: https://github.com/telegramdesktop/tdesktop.git/v%{version}/tdesktop-%{version}.tar.bz2
Source1: telegramdesktop.desktop
Source2: tg.protocol
Source3: http://download.qt-project.org/official_releases/qt/%{qt_majver}/%{qt_ver}/single/qt-everywhere-opensource-src-%{qt_ver}.tar.xz
Patch0: telegram-0.9.32-disable-unity.patch
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libGL-devel
BuildRequires: libICE-devel
BuildRequires: libSM-devel
BuildRequires: libX11-devel
BuildRequires: libXext-devel
BuildRequires: libXi-devel
BuildRequires: libavcodec-ffmpeg-devel
BuildRequires: libavformat-ffmpeg-devel
BuildRequires: libavutil-ffmpeg-devel
BuildRequires: libfontconfig-devel
BuildRequires: libfreetype-devel
BuildRequires: libgcc
BuildRequires: libglib-devel
BuildRequires: libicu-devel
BuildRequires: libinput-devel
BuildRequires: libjasper-devel
BuildRequires: liblzma-devel
BuildRequires: libmng-devel
BuildRequires: libmtdev-devel
BuildRequires: libopenal-devel
BuildRequires: libopenssl-devel
BuildRequires: libopus-devel
BuildRequires: libproxy-devel
BuildRequires: libstdc++6-devel
BuildRequires: libswresample-ffmpeg-devel
BuildRequires: libswscale-ffmpeg-devel
BuildRequires: libtiff-devel
BuildRequires: libts-devel
BuildRequires: libudev-devel
BuildRequires: libva-devel
BuildRequires: libwebp-devel
BuildRequires: libxcb-devel
BuildRequires: libxkbcommon-devel
BuildRequires: libz-devel
## AUTOBUILDREQ-END
Requires: kconfig
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
The official desktop client for the Telegram messenger.
%debug_package
%prep
%setup -q -c -a0 -a3
#% setup -q -c -D -T
#:<< _EOF
git clone https://chromium.googlesource.com/breakpad/breakpad breakpad
git clone https://chromium.googlesource.com/linux-syscall-support breakpad-lss
mkdir -p Libraries
mv qt-everywhere-opensource-src-%{qt_ver} Libraries/QtStatic
cd Libraries/QtStatic/qtbase
patch -p1 < ../../../tdesktop-%{version}/Telegram/_qtbase_%{qt_patchver}_patch.diff
cd ../../..
if [ ! -h Libraries/breakpad ]; then
ln -s ../breakpad Libraries/breakpad
ln -s ../../../breakpad-lss Libraries/breakpad/src/third_party/lss
fi
cd tdesktop-%{version}
%patch0 -p1
sed -i 's/CUSTOM_API_ID//g' Telegram/Telegram.pro
sed -i 's,LIBS += /usr/local/lib/libxkbcommon.a,,g' Telegram/Telegram.pro
sed -i 's,LIBS += /usr/local/lib/libz.a,LIBS += -lz,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}/opus"'
echo 'LIBS += -lcrypto -lssl'
) >> Telegram/Telegram.pro
%build
# Build patched Qt
cd Libraries/QtStatic
./configure -prefix "%{_builddir}/telegram-%{version}/qt" -release -opensource -confirm-license -qt-zlib \
-qt-libpng -qt-libjpeg -qt-freetype -qt-harfbuzz -qt-pcre -qt-xcb \
-qt-xkbcommon-x11 -no-opengl -static -nomake examples -nomake tests
%make module-qtbase module-qtimageformats
%make module-qtbase-install_subtargets module-qtimageformats-install_subtargets
cd ../..
# also add /usr/bin to disable icecc
export PATH="%{_builddir}/telegram-%{version}/qt/bin:/usr/bin:$PATH"
# Build breakpad
cd Libraries/breakpad
./configure
%make
cd ../..
cd tdesktop-%{version}
# Build MetaStyle
mkdir -p Linux/DebugIntermediateStyle
cd Linux/DebugIntermediateStyle
qmake CONFIG+=debug "../../Telegram/MetaStyle.pro"
%make
cd ../..
# Build MetaLang
mkdir -p Linux/DebugIntermediateLang
cd Linux/DebugIntermediateLang
qmake CONFIG+=debug "../../Telegram/MetaLang.pro"
%make
cd ../..
# Build Telegram Desktop
mkdir -p Linux/ReleaseIntermediate
cd Linux/ReleaseIntermediate
qmake CONFIG+=release ../../Telegram/Telegram.pro
pattern="^PRE_TARGETDEPS +="
grep "$pattern" ../../Telegram/Telegram.pro | sed "s/$pattern//g" | xargs make
qmake CONFIG+=release ../../Telegram/Telegram.pro
%make
cd ../..
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
cd tdesktop-%{version}
install -D -m755 Linux/Release/Telegram %{buildroot}%{_bindir}/telegram-desktop
install -D -m644 %{SOURCE1} %{buildroot}%{_datadir}/applications/telegram-desktop.desktop
install -D -m644 %{SOURCE2} %{buildroot}%{_kde4_servicesdir}/tg.protocol
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 -m644 Telegram/SourceFiles/art/icon${icon_size}.png $icon_dir/telegram-desktop.png
done
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%files
%defattr(-,root,root)
%{_kde4_servicesdir}/tg.protocol
%{_bindir}/telegram-desktop
%{_datadir}/applications/telegram-desktop.desktop
%{_datadir}/icons/hicolor/*/apps/telegram-desktop.png
%doc tdesktop-%{version}/LICENSE
%changelog
* Wed Mar 16 2016 Silvan Calarco <silvan.calarco@mambasoft.it> 0.9.33-2mamba
- fix build tree organization
* Wed Mar 16 2016 Silvan Calarco <silvan.calarco@mambasoft.it> 0.9.33-1mamba
- update to 0.9.33
* Tue Mar 15 2016 Silvan Calarco <silvan.calarco@mambasoft.it> 0.9.32-1mamba
- package created using the webbuild interface