telegram/telegram.spec

202 lines
6.3 KiB
RPMSpec

%define qt_ver 5.6.0
%define qt_patchver %(echo %qt_ver | tr . _)
%define qt_majver %(echo %qt_ver | cut -d. -f1-2)
Name: telegram
Version: 0.10.6
Release: 1mamba
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}/submodules/qtbase-opensource-src-%{qt_ver}.tar.xz
Source4: http://download.qt-project.org/official_releases/qt/%{qt_majver}/%{qt_ver}/submodules/qtimageformats-opensource-src-%{qt_ver}.tar.xz
Patch0: telegram-0.10.6-disable-unity.patch
Patch1: telegram-0.10.6-fix-build.patch
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-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: libdbus-devel
BuildRequires: libexpat-devel
BuildRequires: libfontconfig-devel
BuildRequires: libfreetype-devel
BuildRequires: libgcc
BuildRequires: libglib-devel
BuildRequires: libharfbuzz-devel
BuildRequires: libicu-devel
BuildRequires: libjpeg-devel
BuildRequires: liblzma-devel
BuildRequires: libopenal-devel
BuildRequires: libopenssl-devel
BuildRequires: libopus-devel
BuildRequires: libpcre-devel
BuildRequires: libpng-devel
BuildRequires: libproxy-devel
BuildRequires: libswresample-ffmpeg-devel
BuildRequires: libswscale-ffmpeg-devel
BuildRequires: libva-devel
BuildRequires: libwebp-devel
BuildRequires: libxcb-devel
BuildRequires: libxcb-image-devel
BuildRequires: libxcb-keysyms-devel
BuildRequires: libxcb-render-util-devel
BuildRequires: libxcb-util-wm-devel
BuildRequires: libxkbcommon-devel
BuildRequires: libz-devel
## AUTOBUILDREQ-END
BuildRequires: libbreakpad-devel
Requires: kconfig
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
The official desktop client for the Telegram messenger.
%debug_package
%prep
%setup -q -c -a0 -a3 -a4
#% setup -q -c -D -T
#:<< _EOF
git clone https://chromium.googlesource.com/external/gyp gyp
mkdir -p Libraries/qt%{qt_ver}
mv qtbase-opensource-src-%{qt_ver} Libraries/qt%{qt_ver}/qtbase
mv qtimageformats-opensource-src-%{qt_ver} Libraries/qt%{qt_ver}/qtimageformats
cd Libraries/qt%{qt_ver}/qtbase
patch -p1 < ../../../tdesktop-%{version}/Telegram/Patches/qtbase_%{qt_patchver}.diff
cd ../../..
cd gyp
git apply ../tdesktop-%{version}/Telegram/Patches/gyp.diff
cd ..
ln -s ../gyp Libraries/gyp
mkdir -p Libraries/cmake-3.6.2/bin
ln -s %{_bindir}/cmake Libraries/cmake-3.6.2/bin/cmake
cd tdesktop-%{version}
%patch1 -p1
%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/qt%{qt_ver}/qtbase
./configure -prefix "%{_builddir}/telegram-%{version}/qt" -release -force-debug-info \
-opensource -confirm-license -system-zlib -system-libpng -system-libjpeg \
-system-freetype -system-harfbuzz -system-pcre -system-xcb -system-xkbcommon-x11 \
-no-opengl -no-gtkstyle -static -nomake examples -nomake tests
%make
#module-qtbase module-qtimageformats
make install
# also add /usr/bin to disable icecc
export PATH="%{_builddir}/telegram-%{version}/qt/bin:/usr/bin:$PATH"
cd ../qtimageformats
qmake .
%make
make install
cd ../../../tdesktop-%{version}/Telegram
gyp/refresh.sh
cd ../out/Release
%make
chrpath --delete Telegram
## 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 out/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/Resources/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
* Tue Sep 13 2016 Silvan Calarco <silvan.calarco@mambasoft.it> 0.10.6-1mamba
- update to 0.10.6
* Tue Mar 29 2016 Silvan Calarco <silvan.calarco@mambasoft.it> 0.9.33-3mamba
- rebuilt (for latest ffmpeg deps on x86_64)
* 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