1
0

Accepting request 555794 from home:nuklly:branches:server:messaging

OBS-URL: https://build.opensuse.org/request/show/555794
OBS-URL: https://build.opensuse.org/package/show/server:messaging/telegram-desktop?expand=0&rev=27
This commit is contained in:
Xu Zhao 2017-12-11 00:14:03 +00:00 committed by Git OBS Bridge
parent 75df68587b
commit f50174eea2
8 changed files with 269 additions and 237 deletions

5
input.json Normal file
View File

@ -0,0 +1,5 @@
{
"includes": [
"common.gypi"
]
}

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8097bccebb904800f06bc10d1f258150930df3f9de1aaed27b21bb83f3387790
size 574566
oid sha256:4189a42a0d59f7c650bfb65db43c8db0eb0d87a3250bf8ac37e85dca3a6b8692
size 565470

View File

@ -1,220 +0,0 @@
Index: tdesktop-1.1.23/Telegram/gyp/qt.gypi
===================================================================
--- tdesktop-1.1.23.orig/Telegram/gyp/qt.gypi
+++ tdesktop-1.1.23/Telegram/gyp/qt.gypi
@@ -38,7 +38,6 @@
'Qt5Network',
'Qt5Widgets',
'Qt5Gui',
- 'qtharfbuzzng',
],
'qt_version%': '<(qt_version)',
'conditions': [
@@ -62,7 +61,6 @@
'qtmain',
'qwindows',
'qtfreetype',
- 'qtpcre',
],
}],
[ 'build_mac', {
@@ -81,7 +79,6 @@
'<@(qt_libs)',
'Qt5Core',
'qtfreetype',
- 'qtpcre',
],
}],
[ 'build_linux', {
@@ -97,20 +94,6 @@
'<@(qt_libs)',
'Qt5DBus',
'Qt5Core',
- 'qtpcre',
- 'Xi',
- 'Xext',
- 'Xfixes',
- 'SM',
- 'ICE',
- 'fontconfig',
- 'expat',
- 'freetype',
- 'z',
- 'xcb-shm',
- 'xcb-xfixes',
- 'xcb-render',
- 'xcb-static',
],
}],
],
@@ -220,7 +203,6 @@
'<(qt_loc)/plugins/platforminputcontexts',
],
'libraries': [
- '<(linux_path_xkbcommon)/lib/libxkbcommon.a',
'<@(qt_libs_release)',
'<(linux_lib_ssl)',
'<(linux_lib_crypto)',
@@ -233,12 +215,28 @@
'-lgthread-2.0',
'-lglib-2.0',
'-lpthread',
+ '-ljpeg',
+ '-lGL',
+ '-lfreetype',
+ '-lfontconfig',
+ '-lXi',
+ '-lSM',
+ '-lICE',
+ '-lproxy',
+ '-lz',
+ '<!(pkg-config 2> /dev/null --libs xkbcommon xkbcommon-x11)',
+ '<!(pkg-config 2> /dev/null --libs libpcre16)',
+ '<!(pkg-config 2> /dev/null --libs zlib)',
+ '<!(pkg-config 2> /dev/null --libs libpng16)',
+ '<!(pkg-config 2> /dev/null --libs libwebp)',
+ '<!(pkg-config 2> /dev/null --libs harfbuzz)',
+ '<!(pkg-config 2> /dev/null --libs xcb-shm xcb-xfixes xcb-render xcb-renderutil xcb-sync xcb-randr xcb-xinerama xcb-xkb xcb-icccm xcb-image xcb-shape xcb-keysyms xcb-util)',
+
],
'include_dirs': [
'<(qt_loc)/mkspecs/linux-g++',
],
'ldflags': [
- '-static-libstdc++',
'-pthread',
'-g',
'-rdynamic',
Index: tdesktop-1.1.23/Telegram/gyp/telegram_linux.gypi
===================================================================
--- tdesktop-1.1.23.orig/Telegram/gyp/telegram_linux.gypi
+++ tdesktop-1.1.23/Telegram/gyp/telegram_linux.gypi
@@ -21,11 +21,20 @@
'conditions': [[ 'build_linux', {
'variables': {
'pkgconfig_libs': [
-# In order to work libxkbcommon must be linked statically,
-# PKGCONFIG links it like "-L/usr/local/lib -lxkbcommon"
-# which makes a dynamic link which leads to segfault in
-# QApplication() -> createPlatformIntegration -> QXcbIntegrationPlugin::create
- #'xkbcommon',
+ 'liblzma',
+ 'openal',
+ 'libavformat',
+ 'libavcodec',
+ 'libswresample',
+ 'libswscale',
+ 'libavutil',
+ 'opus',
+ 'libva-x11',
+ 'libva-drm',
+ 'libva',
+ 'libdrm',
+ 'zlib',
+
],
'linux_path_ffmpeg%': '/usr/local',
'linux_path_openal%': '/usr/local',
@@ -33,51 +42,31 @@
'linux_path_va%': '/usr/local',
'linux_path_vdpau%': '/usr/local',
'linux_path_breakpad%': '<(libs_loc)/breakpad',
- 'linux_path_opus_include%': '<(libs_loc)/opus/include',
+ 'linux_path_opus_include%': '/usr/include/opus',
},
'include_dirs': [
- '/usr/local/include',
- '<(linux_path_ffmpeg)/include',
- '<(linux_path_openal)/include',
+ '/usr/include',
'<(linux_path_breakpad)/include/breakpad',
'<(linux_path_opus_include)',
],
'library_dirs': [
- '/usr/local/lib',
- '<(linux_path_ffmpeg)/lib',
- '<(linux_path_openal)/lib',
- '<(linux_path_libexif_lib)',
- '<(linux_path_va)/lib',
- '<(linux_path_vdpau)/lib',
- '<(linux_path_breakpad)/lib',
+ '/usr/lib',
+ '<(linux_path_breakpad)/src/client/linux',
],
'libraries': [
- 'breakpad_client',
'composeplatforminputcontextplugin',
'ibusplatforminputcontextplugin',
'fcitxplatforminputcontextplugin',
'himeplatforminputcontextplugin',
- 'liblzma.a',
- 'libopenal.a',
- 'libavformat.a',
- 'libavcodec.a',
- 'libswresample.a',
- 'libswscale.a',
- 'libavutil.a',
- 'libopus.a',
- 'libva-x11.a',
- 'libva-drm.a',
- 'libva.a',
- 'libvdpau.a',
- 'libdrm.a',
- 'libz.a',
-# '<!(pkg-config 2> /dev/null --libs <@(pkgconfig_libs))',
+ '<!(pkg-config 2> /dev/null --libs <@(pkgconfig_libs))',
+ 'libbreakpad_client.a',
],
'cflags_cc': [
'<!(pkg-config 2> /dev/null --cflags appindicator-0.1)',
'<!(pkg-config 2> /dev/null --cflags gtk+-2.0)',
'<!(pkg-config 2> /dev/null --cflags glib-2.0)',
'<!(pkg-config 2> /dev/null --cflags dee-1.0)',
+ '<!(pkg-config --cflags <@(pkgconfig_libs))',
],
'configurations': {
'Release': {
Index: tdesktop-1.1.23/Telegram/gyp/Telegram.gyp
===================================================================
--- tdesktop-1.1.23.orig/Telegram/gyp/Telegram.gyp
+++ tdesktop-1.1.23/Telegram/gyp/Telegram.gyp
@@ -85,10 +85,13 @@
],
'defines': [
- 'AL_LIBTYPE_STATIC',
'AL_ALEXT_PROTOTYPES',
'TGVOIP_USE_CXX11_LIB',
'<!@(python -c "for s in \'<(build_defines)\'.split(\',\'): print(s)")',
+ '__STDC_FORMAT_MACROS',
+ 'TDESKTOP_DISABLE_AUTOUPDATE',
+ 'TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME',
+ 'TDESKTOP_DISABLE_UNITY_INTEGRATION',
],
'include_dirs': [
Index: tdesktop-1.1.23/Telegram/ThirdParty/libtgvoip/libtgvoip.gyp
===================================================================
--- tdesktop-1.1.23.orig/Telegram/ThirdParty/libtgvoip/libtgvoip.gyp
+++ tdesktop-1.1.23/Telegram/ThirdParty/libtgvoip/libtgvoip.gyp
@@ -13,7 +13,7 @@
'variables': {
'tgvoip_src_loc': '.',
'official_build_target%': '',
- 'linux_path_opus_include%': '<(DEPTH)/../../../Libraries/opus/include',
+ 'linux_path_opus_include%': '/usr/include/opus',
},
'include_dirs': [
'<(tgvoip_src_loc)/webrtc_dsp',
Index: tdesktop-1.1.23/Telegram/gyp/settings_linux.gypi
===================================================================
--- tdesktop-1.1.23.orig/Telegram/gyp/settings_linux.gypi
+++ tdesktop-1.1.23/Telegram/gyp/settings_linux.gypi
@@ -36,6 +36,7 @@
'-Wno-unused-but-set-variable',
'-Wno-missing-field-initializers',
'-Wno-sign-compare',
+ '-Wno-implicit-fallthrough',
],
},
'conditions': [

237
patch.py Normal file
View File

@ -0,0 +1,237 @@
#!/usr/bin/env python3
import json
import re
from shutil import copyfile
def remove_trailing_commas(json_like):
"""
Removes trailing commas from *json_like* and returns the result. Example::
>>> remove_trailing_commas('{"foo":"bar","baz":["blah",],}')
'{"foo":"bar","baz":["blah"]}'
"""
trailing_object_commas_re = re.compile(
r'(,)\s*}(?=([^"\\]*(\\.|"([^"\\]*\\.)*[^"\\]*"))*[^"]*$)')
trailing_array_commas_re = re.compile(
r'(,)\s*\](?=([^"\\]*(\\.|"([^"\\]*\\.)*[^"\\]*"))*[^"]*$)')
# Fix objects {} first
objects_fixed = trailing_object_commas_re.sub("}", json_like)
# Now fix arrays/lists [] and return the result
return trailing_array_commas_re.sub("]", objects_fixed)
def find_first_prime(str, ch):
for i,c in enumerate(str):
if c == ch:
return i
def find_last_prime(str, ch):
for i,c in enumerate(str[::-1]):
if c == ch:
return len(str)-1-i
def is_inserted_doublequote(line, i):
if i >= len(line):
return False
if line[i] == "\"":
if i == 0:
return True
elif (not line[i-1] == "\\"):
return True
return False
return False
def transform_back(proper_json):
gyp_str = ""
for line in proper_json.splitlines():
temp = '%s' % line
# remove double quotes in the middle
temp = temp.replace("'\": [[ \"'", "': [[ '")
temp = temp.replace("'\": [ \"'", "': [ '")
temp = temp.replace("'\": \"'", "': '")
# remove all other double quotes
for i,s in enumerate(temp):
if is_inserted_doublequote(temp, i):
if i == 0:
temp = temp[1:]
else:
temp = temp[:i] + temp[i+1:]
# replace \" to "
temp = temp.replace("\\\"", "\"")
# replace all double backslashes with single backslash
temp = temp.replace("\\\\", "\\")
gyp_str += temp + "\n"
return gyp_str
def read_file_to_proper_json(f):
json_like = ""
for line in f: # read it all in
stripped_line = line.strip()
if not stripped_line.startswith("#"):
if stripped_line.find("'") != -1:
# step 1: replace all " with \"
stripped_line = stripped_line.replace("\\'", "\\\\'")
stripped_line = stripped_line.replace("\"", "\\\"")
first = find_first_prime(stripped_line, "'")
last = find_last_prime(stripped_line, "'")
# step 2: insert " before the first ' and after the last '
first_str = stripped_line[0:first]
mid_str = stripped_line[first:last+1]
last_str = stripped_line[last+1:]
final_str = first_str + "\"" + mid_str + "\"" + last_str
line = final_str
# add double quotes for single quotes in the middle
line = line.replace("': '", "'\": \"'")
line = line.replace("': [ '", "'\": [ \"'")
line = line.replace("': [[ '", "'\": [[ \"'")
json_like += line
else:
json_like += line
proper_json = remove_trailing_commas(json_like)
return proper_json
def load_json(filename):
return json.loads(read_file_to_proper_json(open(filename)))
def save_json(jsonobj, filename):
# pass
j = transform_back(jsonobj)
# backup = filename + ".orig"
# copyfile(filename, backup)
f = open(filename, 'w')
f.write(j)
return
def process_telegram_linux(jsonobj):
child = jsonobj["'conditions'"][0][1]["'variables'"]["'pkgconfig_libs'"]
child.append("'liblzma'")
child.append("'openal'")
child.append("'libavformat'")
child.append("'libavcodec'")
child.append("'libswresample'")
child.append("'libswscale'")
child.append("'libavutil'")
child.append("'opus'")
child.append("'libva-x11'")
child.append("'libva-drm'")
child.append("'libva'")
child.append("'libdrm'")
child.append("'zlib'")
child = jsonobj["'conditions'"][0][1]["'variables'"]["'linux_path_opus_include%'"]
child = "'/usr/include/opus'"
child = jsonobj["'conditions'"][0][1]["'variables'"]["'linux_path_breakpad%'"]
child = "'<(libs_loc)/breakpad'"
child = jsonobj["'conditions'"][0][1]["'include_dirs'"]
child.remove("'/usr/local/include'")
child.remove("'<(linux_path_ffmpeg)/include'")
child.remove("'<(linux_path_openal)/include'")
child.append("'/usr/include'")
child = jsonobj["'conditions'"][0][1]["'library_dirs'"]
child.remove("'/usr/local/lib'")
child.remove("'<(linux_path_ffmpeg)/lib'")
child.remove("'<(linux_path_openal)/lib'")
child.remove("'<(linux_path_va)/lib'")
child.remove("'<(linux_path_vdpau)/lib'")
child.append("'/usr/lib'")
child = jsonobj["'conditions'"][0][1]["'libraries'"]
child.remove("'breakpad_client'")
child.remove("'liblzma.a'")
child.remove("'libopenal.a'")
child.remove("'libavformat.a'")
child.remove("'libavcodec.a'")
child.remove("'libswresample.a'")
child.remove("'libswscale.a'")
child.remove("'libavutil.a'")
child.remove("'libopus.a'")
child.remove("'libva-x11.a'")
child.remove("'libva-drm.a'")
child.remove("'libva.a'")
child.remove("'libvdpau.a'")
child.remove("'libdrm.a'")
child.remove("'libz.a'")
child.append("'libbreakpad_client.a'")
child.append("'<!(pkg-config 2> /dev/null --libs <@(pkgconfig_libs))'")
child = jsonobj["'conditions'"][0][1]["'cflags_cc'"]
child.append("'<!(pkg-config --cflags <@(pkgconfig_libs))'")
return json.dumps(jsonobj)
def process_qt(jsonobj):
child = jsonobj["'variables'"]["'variables'"]["'variables'"]["'variables'"]["'qt_libs'"];
child.remove("'qtharfbuzzng'")
child = jsonobj["'variables'"]["'variables'"]["'variables'"]["'conditions'"][0][1]["'qt_libs'"]; # build_win
child.remove("'qtpcre'")
child = jsonobj["'variables'"]["'variables'"]["'variables'"]["'conditions'"][2][1]["'qt_libs'"]; # build_mac not build_macold
child.remove("'qtpcre'")
child = jsonobj["'variables'"]["'variables'"]["'variables'"]["'conditions'"][3][1]["'qt_libs'"];
child.remove("'qtpcre'")
child.remove("'Xi'")
child.remove("'Xext'")
child.remove("'Xfixes'")
child.remove("'SM'")
child.remove("'ICE'")
child.remove("'fontconfig'")
child.remove("'expat'")
child.remove("'freetype'")
child.remove("'z'")
child.remove("'xcb-shm'")
child.remove("'xcb-xfixes'")
child.remove("'xcb-render'")
child.remove("'xcb-static'")
child = jsonobj["'conditions'"][0][1]["'libraries'"]
child.remove("'<(linux_path_xkbcommon)/lib/libxkbcommon.a'")
child.append("'-ljpeg'")
child.append("'-lGL'")
child.append("'-lfreetype'")
child.append("'-lfontconfig'")
child.append("'-lXi'")
child.append("'-lSM'")
child.append("'-lICE'")
child.append("'-lproxy'")
child.append("'-lz'")
child.append("'<!(pkg-config 2> /dev/null --libs xkbcommon xkbcommon-x11)'")
child.append("'<!(pkg-config 2> /dev/null --libs libpcre16)'")
child.append("'<!(pkg-config 2> /dev/null --libs zlib)'")
child.append("'<!(pkg-config 2> /dev/null --libs libpng16)'")
child.append("'<!(pkg-config 2> /dev/null --libs libwebp)'")
child.append("'<!(pkg-config 2> /dev/null --libs harfbuzz)'")
child.append("'<!(pkg-config 2> /dev/null --libs xcb-shm xcb-xfixes xcb-render xcb-renderutil xcb-sync xcb-randr xcb-xinerama xcb-xkb xcb-icccm xcb-image xcb-shape xcb-keysyms xcb-util)'")
child = jsonobj["'conditions'"][0][1]["'ldflags'"]
child.remove("'-static-libstdc++'")
return json.dumps(jsonobj)
def process_settings_linux(jsonobj):
child = jsonobj["'conditions'"][0][1]["'variables'"]["'linux_common_flags'"]
child.append("'-Wno-implicit-fallthrough'")
child.remove("'-Werror'")
return json.dumps(jsonobj)
def process_telegram(jsonobj):
child = jsonobj["'targets'"][0]["'defines'"]
child.append("'__STDC_FORMAT_MACROS'")
child.append("'TDESKTOP_DISABLE_AUTOUPDATE'")
child.append("'TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME'")
child.append("'TDESKTOP_DISABLE_UNITY_INTEGRATION'")
child.remove("'AL_LIBTYPE_STATIC'")
child = jsonobj["'targets'"][0]["'include_dirs'"]
child.remove("'<(libs_loc)/breakpad/src'")
child.append("'<(libs_loc)/breakpad/include/breakpad'")
return json.dumps(jsonobj)
def process(filename, op):
json = load_json(filename)
json = op(json)
save_json(json, filename)
tl_path = './Telegram/gyp/telegram_linux.gypi'
settings_path = './Telegram/gyp/settings_linux.gypi'
qt_path = './Telegram/gyp/qt.gypi'
tg_path = './Telegram/gyp/Telegram.gyp'
print("Patching %s ..." % tl_path)
process(tl_path, process_telegram_linux)
print("Patching %s ..." % settings_path)
process(settings_path, process_settings_linux)
print("Patching %s ..." % qt_path)
process(qt_path, process_qt)
print("Patching %s ..." % tg_path)
process(tg_path, process_telegram)
print("Patching complete!")

3
range-v3-master.zip Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fe02b500ce92077c9a603eba02c2aa3fe6a946e93face31dc8ce2c17b38b2264
size 808624

View File

@ -17,10 +17,11 @@
Name: telegram-desktop
Version: 1.1.23
Version: 1.1.29
Release: 0
Summary: A new era of messaging
License: GPL-3.0
Group: Productivity/Networking/Instant Messenger
Url: https://github.com/telegramdesktop/tdesktop
Source: https://github.com/telegramdesktop/tdesktop/archive/v%{version}.tar.gz
# curl https://chromium.googlesource.com/breakpad/breakpad/+archive/refs/heads/master.tar.gz -o breakpad-master.tar.gz
@ -29,7 +30,7 @@ Source1: breakpad-master.tar.gz
Source2: linux-syscall-support-refs-heads-master.tar.gz
# curl https://chromium.googlesource.com/external/gyp/+archive/master.tar.gz -o gyp-master.tar.gz
Source3: gyp-master.tar.gz
Source4: patch-%{version}.diff
Source4: patch.py
# curl https://codeload.github.com/Microsoft/GSL/zip/master -o GSL-master.zip
Source5: GSL-master.zip
# curl https://codeload.github.com/mapbox/variant/zip/master -o variant-master.zip
@ -38,6 +39,8 @@ Source6: variant-master.zip
Source7: libtgvoip.zip
# curl https://raw.githubusercontent.com/philsquared/Catch/master/single_include/catch.hpp -o catch.hpp
Source8: catch.hpp
# curl https://codeload.github.com/ericniebler/range-v3/zip/master -o range-v3-master.zip
Source9: range-v3-master.zip
# PATCH-FIX-UPSTREAM breakpad-ucontext_t-glibc2_26.patch badshah400@gmail.com -- Replace `struct ucontext` by `ucontext_t` to make compatible with glib-2.26; merged upstream
Patch0: breakpad-ucontext_t-glibc2_26.patch
BuildRequires: chrpath
@ -52,6 +55,7 @@ BuildRequires: libgcc_s1 >= 6.2
%else
BuildRequires: gcc-c++
%endif
BuildRequires: python3
BuildRequires: libXfixes-devel
BuildRequires: libexpat-devel
BuildRequires: libjpeg-devel
@ -114,7 +118,6 @@ Telegram Desktop app. A new era of messaging.
%prep
%setup -q -n tdesktop-%{version}
cp %{_sourcedir}/patch-%{version}.diff .
cp %{S:8} Telegram/SourceFiles/base/
# Already included in %{S:8}
@ -134,6 +137,14 @@ cp %{_sourcedir}/libtgvoip.zip . && unzip libtgvoip.zip
mv libtgvoip-public libtgvoip
mv libtgvoip %{_builddir}/tdesktop-%{version}/Telegram/ThirdParty/
cp %{_sourcedir}/range-v3-master.zip . && unzip range-v3-master.zip
mv range-v3-master range-v3
mkdir -p %{_builddir}/Libraries
mv range-v3 %{_builddir}/Libraries/
cp %{_sourcedir}/patch.py . && python3 ./patch.py
cp %{_sourcedir}/catch.hpp ./Telegram/SourceFiles/
%setup -q -T -c -n breakpad -b 1
%setup -q -T -c -n breakpad-lss -b 2
%setup -q -T -c -n gyp -b 3
@ -151,7 +162,6 @@ popd
# Setup compiler variables
mv %{_builddir}/tdesktop-%{version} %{_builddir}/tdesktop
mkdir -p %{_builddir}/Libraries
# patch gyp
cd %{_builddir}/Libraries
@ -165,21 +175,16 @@ cd %{_builddir}/Libraries
ln -s %{_libdir}/libtelegram-qt5 ./QtStatic
# Build breakpad
cd %{_builddir}/Libraries
ln -s %{_builddir}/breakpad ./breakpad
cd breakpad
cd %{_builddir}/breakpad
ln -s %{_builddir}/breakpad-lss ./src/third_party/lss
%if 0%{?suse_version} <= 1320
export CXX='g++-6'
export GCC='gcc-6'
%endif
# FIXME: you should use the %%configure macro
./configure
./configure --prefix=`pwd`/../Libraries/breakpad
make %{?_smp_mflags}
# patch with patch.diff
cd %{_builddir}/tdesktop
patch -p1 < patch-%{version}.diff
make install
# FIXME: you should use %%cmake macros
# use gyp to generate cmake files
@ -194,6 +199,8 @@ cd %{_builddir}/tdesktop/Telegram/gyp
-Dlinux_lib_ssl=-lssl \
-Dlinux_lib_crypto=-lcrypto \
-Dlinux_lib_icu="-licuuc -licutu -licui18n" \
-Dlinux_path_opus_include="/usr/include/opus" \
-Dlinux_path_breakpad="../../../Libraries/breakpad" \
--depth=. --generator-output="../../" -Goutput_dir=out Telegram.gyp --format=cmake
# build Telegram

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:56b7fce84adf85a4af1c3174353169f32d0b0c052a4e7a284fc741fa96b04030
size 16863984

3
v1.1.29.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:851c62884a7e4a88c5128eaded01b20ec1866fba1415dea08049156dc1b50952
size 16820234