View | Details | Raw Unified | Return to bug 224193
Collapse All | Expand All

(-)net-im/Makefile (+1 lines)
Lines 169-174 Link Here
169
    SUBDIR += skype4
169
    SUBDIR += skype4
170
    SUBDIR += teamwords
170
    SUBDIR += teamwords
171
    SUBDIR += telegram
171
    SUBDIR += telegram
172
    SUBDIR += telegram-desktop
172
    SUBDIR += telegram-purple
173
    SUBDIR += telegram-purple
173
    SUBDIR += telegramqml
174
    SUBDIR += telegramqml
174
    SUBDIR += telepathy-accounts-signon
175
    SUBDIR += telepathy-accounts-signon
(-)net-im/telegram-desktop/Makefile (+83 lines)
Line 0 Link Here
1
# $FreeBSD$
2
3
PORTNAME=	telegram-desktop
4
DISTVERSIONPREFIX=	v
5
DISTVERSION=	1.1.23
6
CATEGORIES=	net-im
7
8
MAINTAINER=	henry.hu.sh@gmail.com
9
COMMENT=	Telegram desktop messaging app
10
11
LICENSE=	GPLv3
12
LICENSE_FILE=	${WRKSRC}/LICENSE
13
14
BUILD_DEPENDS=	dee>0:devel/dee \
15
		gyp:devel/py-gyp \
16
		python:lang/python \
17
		${LOCALBASE}/include/alsa/asoundlib.h:audio/alsa-lib \
18
		${LOCALBASE}/include/pulse/pulseaudio.h:audio/pulseaudio
19
LIB_DEPENDS=	libavformat.so:multimedia/ffmpeg \
20
		libdbus-1.so:devel/dbus \
21
		libminizip.so:archivers/minizip \
22
		libopenal.so:audio/openal-soft \
23
		libopus.so:audio/opus
24
25
USES=		cmake:noninja,outsource desktop-file-utils gmake pkgconfig ssl
26
USE_GITHUB=	yes
27
GH_ACCOUNT=	telegramdesktop
28
GH_PROJECT=	tdesktop
29
GH_TUPLE=	catchorg:Catch2:5ca44b68:catch/Telegram/ThirdParty/Catch \
30
		mapbox:variant:550ac2f:variant/Telegram/ThirdParty/variant \
31
		Microsoft:GSL:c5851a8:gsl/Telegram/ThirdParty/GSL \
32
		telegramdesktop:libtgvoip:757a5d8e:libtgvoip/Telegram/ThirdParty/libtgvoip
33
USE_GNOME=	glib20 gtk30
34
USE_QT5=	core gui imageformats network widgets buildtools_build qmake_build
35
USE_XORG=	x11 xcb
36
37
CMAKE_SOURCE_PATH=	${WRKSRC}/out/Release
38
39
GYP_DEFINES=	TDESKTOP_DISABLE_CRASH_REPORTS,TDESKTOP_DISABLE_AUTOUPDATE,TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
40
41
.include <bsd.port.pre.mk>
42
43
.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1100000
44
CC=		clang40
45
CXX=		clang++40
46
BUILD_DEPENDS+=	clang++40:devel/llvm40
47
RUN_DEPENDS+=	clang++40:devel/llvm40
48
.endif
49
50
post-patch:
51
	@cd ${WRKSRC} && \
52
		(${SED} -e " \
53
			s|%%QT_VERSION%%|${QT5_VERSION}| ; \
54
			s|%%LOCALBASE%%|${LOCALBASE}| ; \
55
			s|%%CFLAGS%%|${CFLAGS:C/(.*)/'\1',/}| ; \
56
			s|%%CXXFLAGS%%|${CXXFLAGS:C/(.*)/'\1',/}| ; \
57
			s|%%LDFLAGS%%|${LDFLAGS:C/(.*)/'\1',/}|" \
58
		${FILESDIR}/gyp-patches | \
59
		${PATCH} -s)
60
61
pre-configure:
62
	@cd ${WRKSRC} && gyp \
63
	    -Dbuild_defines=${GYP_DEFINES} \
64
	    -Gconfig=Release \
65
	    --depth=Telegram/gyp --generator-output=../.. -Goutput_dir=out Telegram/gyp/Telegram.gyp --format=cmake
66
	@TOT=`wc -l < ${WRKSRC}/out/Release/CMakeLists.txt` && NUM=`expr $$TOT - 2` && \
67
	    ${SED} -i -e "$$NUM r ${FILESDIR}/CMakeLists.inj" ${WRKSRC}/out/Release/CMakeLists.txt
68
69
do-install:
70
	${INSTALL_PROGRAM} ${BUILD_WRKSRC}/Telegram ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
71
	${INSTALL_DATA} ${WRKSRC}/lib/xdg/telegramdesktop.desktop ${STAGEDIR}${PREFIX}/share/applications/${PORTNAME}.desktop
72
	${INSTALL} -d ${STAGEDIR}${PREFIX}/share/kservices5
73
	${INSTALL_DATA} ${WRKSRC}/lib/xdg/tg.protocol ${STAGEDIR}${PREFIX}/share/kservices5
74
	${INSTALL} -d ${STAGEDIR}${PREFIX}/share/appdata
75
	${INSTALL_DATA} ${WRKSRC}/lib/xdg/telegramdesktop.appdata.xml ${STAGEDIR}${PREFIX}/share/appdata/${PORTNAME}.appdata.xml
76
.for icon_size in 16 32 48 64 128 256 512
77
	${INSTALL} -d ${STAGEDIR}${PREFIX}/share/icons/hicolor/${icon_size}x${icon_size}/apps
78
	${INSTALL_DATA} \
79
		${WRKSRC}/Telegram/Resources/art/icon${icon_size}.png \
80
		${STAGEDIR}${PREFIX}/share/icons/hicolor/${icon_size}x${icon_size}/apps/${PORTNAME}.png
81
.endfor
82
83
.include <bsd.port.post.mk>
(-)net-im/telegram-desktop/distinfo (+11 lines)
Line 0 Link Here
1
TIMESTAMP = 1512711381
2
SHA256 (telegramdesktop-tdesktop-v1.1.23_GH0.tar.gz) = 56b7fce84adf85a4af1c3174353169f32d0b0c052a4e7a284fc741fa96b04030
3
SIZE (telegramdesktop-tdesktop-v1.1.23_GH0.tar.gz) = 16863984
4
SHA256 (Microsoft-GSL-c5851a8_GH0.tar.gz) = 32fae541af0bc21cdf83922740db6a3a00fbb9cb9ace323fbc038b608ac36956
5
SIZE (Microsoft-GSL-c5851a8_GH0.tar.gz) = 54462
6
SHA256 (mapbox-variant-550ac2f_GH0.tar.gz) = 7ab3aa7c9fa672027f13721584df5f7ec09c0ecca499d374c6ac76e147ef7354
7
SIZE (mapbox-variant-550ac2f_GH0.tar.gz) = 108686
8
SHA256 (catchorg-Catch2-5ca44b68_GH0.tar.gz) = 8cdf2a345897bda1aaabffd4496dffe263768cef3e4254e74ae63545c8e12cc2
9
SIZE (catchorg-Catch2-5ca44b68_GH0.tar.gz) = 375264
10
SHA256 (telegramdesktop-libtgvoip-757a5d8e_GH0.tar.gz) = a745c2c097f6a98bf9443d0cee9e375f279571a18dcb51bf06684eccf82eb9c6
11
SIZE (telegramdesktop-libtgvoip-757a5d8e_GH0.tar.gz) = 408328
(-)net-im/telegram-desktop/files/CMakeLists.inj (+14 lines)
Line 0 Link Here
1
# ------------- debian/CMakeLists.inj begin -------------
2
# The text will be putted into the appropriate CMakeLists by debian/rules script
3
4
# Avoid rpath compiler parameter
5
set_target_properties(Telegram PROPERTIES SKIP_BUILD_RPATH TRUE)
6
7
# This makes up for patch of gyp utility, supporting precompiled headers. If
8
# Telegram/Patches/gyp.diff file will be changed in future, please check these
9
# lines.
10
include(../../Telegram/gyp/PrecompiledHeader.cmake)
11
add_precompiled_header(Telegram ../../Telegram/SourceFiles/stdafx.h)
12
13
# vim: ft=cmake
14
# -------------- debian/CMakeLists.inj end --------------
(-)net-im/telegram-desktop/files/gyp-patches (+296 lines)
Line 0 Link Here
1
--- Telegram/gyp/qt_rcc.gypi.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/gyp/qt_rcc.gypi
3
@@ -28,7 +28,7 @@
4
       '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/qrc/qrc_<(RULE_INPUT_ROOT).cpp',
5
     ],
6
     'action': [
7
-      '<(qt_loc)/bin/rcc<(exe_ext)',
8
+      '%%LOCALBASE%%/bin/rcc',
9
       '-name', '<(RULE_INPUT_ROOT)',
10
       '-no-compress',
11
       '<(RULE_INPUT_PATH)',
12
--- Telegram/gyp/qt.gypi.orig	2017-09-05 17:38:38 UTC
13
+++ Telegram/gyp/qt.gypi
14
@@ -27,25 +27,21 @@
15
               [ 'build_macold', {
16
                 'qt_version%': '5.3.2',
17
               }, {
18
-                'qt_version%': '5.6.2',
19
+                'qt_version%': '%%QT_VERSION%%',
20
               }]
21
             ],
22
           },
23
           'qt_libs': [
24
-            'qwebp',
25
-            'Qt5PrintSupport',
26
-            'Qt5PlatformSupport',
27
             'Qt5Network',
28
             'Qt5Widgets',
29
             'Qt5Gui',
30
-            'qtharfbuzzng',
31
           ],
32
           'qt_version%': '<(qt_version)',
33
           'conditions': [
34
             [ 'build_macold', {
35
               'linux_path_qt%': '/usr/local/macold/Qt-<(qt_version)',
36
             }, {
37
-              'linux_path_qt%': '/usr/local/tdesktop/Qt-<(qt_version)',
38
+              'linux_path_qt%': '%%LOCALBASE%%/lib/qt',
39
             }]
40
           ]
41
         },
42
@@ -85,32 +81,12 @@
43
             ],
44
           }],
45
           [ 'build_linux', {
46
-            'qt_lib_prefix': 'lib',
47
-            'qt_lib_debug_postfix': '.a',
48
-            'qt_lib_release_postfix': '.a',
49
+            'qt_lib_prefix': '',
50
+            'qt_lib_debug_postfix': '',
51
+            'qt_lib_release_postfix': '',
52
             'qt_libs': [
53
-              'qxcb',
54
-              'Qt5XcbQpa',
55
-              'qconnmanbearer',
56
-              'qgenericbearer',
57
-              'qnmbearer',
58
               '<@(qt_libs)',
59
-              'Qt5DBus',
60
               'Qt5Core',
61
-              'qtpcre',
62
-              'Xi',
63
-              'Xext',
64
-              'Xfixes',
65
-              'SM',
66
-              'ICE',
67
-              'fontconfig',
68
-              'expat',
69
-              'freetype',
70
-              'z',
71
-              'xcb-shm',
72
-              'xcb-xfixes',
73
-              'xcb-render',
74
-              'xcb-static',
75
             ],
76
           }],
77
         ],
78
@@ -140,11 +116,6 @@
79
     # '<!@(python <(DEPTH)/list_sources.py [sources] <(qt_moc_list_sources_arg))'
80
     # where [sources] contains all your source files
81
     'qt_moc_list_sources_arg': '--moc-prefix SHARED_INTERMEDIATE_DIR/<(_target_name)/moc/moc_',
82
-
83
-    'linux_path_xkbcommon%': '/usr/local',
84
-    'linux_lib_ssl%': '/usr/local/ssl/lib/libssl.a',
85
-    'linux_lib_crypto%': '/usr/local/ssl/lib/libcrypto.a',
86
-    'linux_lib_icu%': '/usr/lib/libicutu.a /usr/lib/libicui18n.a /usr/lib/libicuuc.a /usr/lib/libicudata.a',
87
   },
88
 
89
   'configurations': {
90
@@ -193,15 +164,17 @@
91
   },
92
 
93
   'include_dirs': [
94
-    '<(qt_loc)/include',
95
-    '<(qt_loc)/include/QtCore',
96
-    '<(qt_loc)/include/QtGui',
97
-    '<(qt_loc)/include/QtCore/<(qt_version)',
98
-    '<(qt_loc)/include/QtGui/<(qt_version)',
99
-    '<(qt_loc)/include/QtCore/<(qt_version)/QtCore',
100
-    '<(qt_loc)/include/QtGui/<(qt_version)/QtGui',
101
+    '%%LOCALBASE%%/include/qt5',
102
+    '%%LOCALBASE%%/include/qt5/QtCore',
103
+    '%%LOCALBASE%%/include/qt5/QtGui',
104
+    '%%LOCALBASE%%/include/qt5/QtCore/<(qt_version)',
105
+    '%%LOCALBASE%%/include/qt5/QtGui/<(qt_version)',
106
+    '%%LOCALBASE%%/include/qt5/QtCore/<(qt_version)/QtCore',
107
+    '%%LOCALBASE%%/include/qt5/QtGui/<(qt_version)/QtGui',
108
   ],
109
   'library_dirs': [
110
+    '%%LOCALBASE%%/lib',
111
+    '%%LOCALBASE%%/lib/qt5/',
112
     '<(qt_loc)/lib',
113
     '<(qt_loc)/plugins',
114
     '<(qt_loc)/plugins/bearer',
115
@@ -220,25 +193,20 @@
116
         '<(qt_loc)/plugins/platforminputcontexts',
117
       ],
118
       'libraries': [
119
-        '<(linux_path_xkbcommon)/lib/libxkbcommon.a',
120
         '<@(qt_libs_release)',
121
-        '<(linux_lib_ssl)',
122
-        '<(linux_lib_crypto)',
123
-        '<!@(python -c "for s in \'<(linux_lib_icu)\'.split(\' \'): print(s)")',
124
+        '-lcrypto',
125
         '-lxcb',
126
         '-lX11',
127
         '-lX11-xcb',
128
         '-ldbus-1',
129
-        '-ldl',
130
         '-lgthread-2.0',
131
         '-lglib-2.0',
132
         '-lpthread',
133
       ],
134
       'include_dirs': [
135
-        '<(qt_loc)/mkspecs/linux-g++',
136
+        '%%LOCALBASE%%/lib/qt5/mkspecs/freebsd-clang',
137
       ],
138
       'ldflags': [
139
-        '-static-libstdc++',
140
         '-pthread',
141
         '-g',
142
         '-rdynamic',
143
@@ -260,7 +228,7 @@
144
       '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/moc/moc_<(RULE_INPUT_ROOT).cpp',
145
     ],
146
     'action': [
147
-      '<(qt_loc)/bin/moc<(exe_ext)',
148
+      '%%LOCALBASE%%/bin/moc',
149
 
150
       # Silence "Note: No relevant classes found. No output generated."
151
       '--no-notes',
152
--- Telegram/gyp/telegram_linux.gypi.orig	2017-09-05 17:38:38 UTC
153
+++ Telegram/gyp/telegram_linux.gypi
154
@@ -33,7 +33,7 @@
155
       'linux_path_va%': '/usr/local',
156
       'linux_path_vdpau%': '/usr/local',
157
       'linux_path_breakpad%': '<(libs_loc)/breakpad',
158
-      'linux_path_opus_include%': '<(libs_loc)/opus/include',
159
+      'linux_path_opus_include%': '%%LOCALBASE%%/include/opus',
160
     },
161
     'include_dirs': [
162
       '/usr/local/include',
163
@@ -52,48 +52,34 @@
164
       '<(linux_path_breakpad)/lib',
165
     ],
166
     'libraries': [
167
-      'breakpad_client',
168
-      'composeplatforminputcontextplugin',
169
-      'ibusplatforminputcontextplugin',
170
-      'fcitxplatforminputcontextplugin',
171
-      'himeplatforminputcontextplugin',
172
-      'liblzma.a',
173
-      'libopenal.a',
174
-      'libavformat.a',
175
-      'libavcodec.a',
176
-      'libswresample.a',
177
-      'libswscale.a',
178
-      'libavutil.a',
179
-      'libopus.a',
180
-      'libva-x11.a',
181
-      'libva-drm.a',
182
-      'libva.a',
183
-      'libvdpau.a',
184
-      'libdrm.a',
185
-      'libz.a',
186
+      'openal',
187
+      'avformat',
188
+      'avcodec',
189
+      'swresample',
190
+      'swscale',
191
+      'avutil',
192
+      'minizip',
193
+      'opus',
194
+      'z',
195
 #      '<!(pkg-config 2> /dev/null --libs <@(pkgconfig_libs))',
196
     ],
197
     'cflags_cc': [
198
-      '<!(pkg-config 2> /dev/null --cflags appindicator-0.1)',
199
-      '<!(pkg-config 2> /dev/null --cflags gtk+-2.0)',
200
-      '<!(pkg-config 2> /dev/null --cflags glib-2.0)',
201
+#      '<!(pkg-config 2> /dev/null --cflags appindicator-0.1)',
202
+      '<!(pkg-config 2> /dev/null --cflags gtk+-3.0)',
203
       '<!(pkg-config 2> /dev/null --cflags dee-1.0)',
204
     ],
205
     'configurations': {
206
       'Release': {
207
         'cflags': [
208
-          '-Ofast',
209
-          '-flto',
210
+          %%CFLAGS%%
211
           '-fno-strict-aliasing',
212
         ],
213
         'cflags_cc': [
214
-          '-Ofast',
215
-          '-flto',
216
+          %%CXXFLAGS%%
217
           '-fno-strict-aliasing',
218
         ],
219
         'ldflags': [
220
-          '-Ofast',
221
-          '-flto',
222
+          %%LDFLAGS%%
223
         ],
224
       },
225
     },
226
--- Telegram/gyp/Telegram.gyp.orig	2017-09-05 17:38:38 UTC
227
+++ Telegram/gyp/Telegram.gyp
228
@@ -80,12 +80,10 @@
229
       'codegen.gyp:codegen_numbers',
230
       'codegen.gyp:codegen_style',
231
       'tests/tests.gyp:tests',
232
-      'utils.gyp:Updater',
233
       '../ThirdParty/libtgvoip/libtgvoip.gyp:libtgvoip',
234
     ],
235
 
236
     'defines': [
237
-      'AL_LIBTYPE_STATIC',
238
       'AL_ALEXT_PROTOTYPES',
239
       'TGVOIP_USE_CXX11_LIB',
240
       '<!@(python -c "for s in \'<(build_defines)\'.split(\',\'): print(s)")',
241
@@ -94,14 +92,7 @@
242
     'include_dirs': [
243
       '<(src_loc)',
244
       '<(SHARED_INTERMEDIATE_DIR)',
245
-      '<(libs_loc)/breakpad/src',
246
-      '<(libs_loc)/lzma/C',
247
-      '<(libs_loc)/libexif-0.6.20',
248
-      '<(libs_loc)/zlib-1.2.8',
249
-      '<(libs_loc)/ffmpeg',
250
-      '<(libs_loc)/openal-soft/include',
251
-      '<(libs_loc)/opus/include',
252
-      '<(minizip_loc)',
253
+      '%%LOCALBASE%%/include/minizip',
254
       '<(sp_media_key_tap_loc)',
255
       '<(emoji_suggestions_loc)',
256
       '<(submodules_loc)/GSL/include',
257
@@ -113,7 +104,7 @@
258
       '<!@(<(list_sources_command) <(qt_moc_list_sources_arg))',
259
     ],
260
     'sources!': [
261
-      '<!@(<(list_sources_command) <(qt_moc_list_sources_arg) --exclude_for <(build_os))',
262
+      '<!@(<(list_sources_command) <(qt_moc_list_sources_arg) --exclude_for linux)',
263
     ],
264
     'conditions': [
265
       [ '"<(official_build_target)" != ""', {
266
--- Telegram/ThirdParty/libtgvoip/libtgvoip.gyp.orig	2017-07-06 17:16:18 UTC
267
+++ Telegram/ThirdParty/libtgvoip/libtgvoip.gyp
268
@@ -13,11 +13,12 @@
269
         'variables': {
270
           'tgvoip_src_loc': '.',
271
           'official_build_target%': '',
272
-          'linux_path_opus_include%': '<(DEPTH)/../../../Libraries/opus/include',
273
+          'linux_path_opus_include%': '%%LOCALBASE%%/include/opus',
274
         },
275
         'include_dirs': [
276
           '<(tgvoip_src_loc)/webrtc_dsp',
277
           '<(linux_path_opus_include)',
278
+          '%%LOCALBASE%%/include/',
279
         ],
280
         'direct_dependent_settings': {
281
           'include_dirs': [
282
@@ -371,12 +372,13 @@
283
             },
284
           ],
285
           [
286
-            '"<(OS)" == "linux"', {
287
+            '"<(OS)" == "freebsd"', {
288
               'defines': [
289
                 'WEBRTC_POSIX',
290
               ],
291
               'cflags_cc': [
292
                 '-msse2',
293
+                '-std=c++11',
294
               ],
295
               'direct_dependent_settings': {
296
                 'libraries': [
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles___other_packer.cpp (+11 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/_other/packer.cpp.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/_other/packer.cpp
3
@@ -246,7 +246,7 @@ int main(int argc, char *argv[])
4
 			}
5
 			QByteArray inner = f.readAll();
6
 			stream << name << quint32(inner.size()) << inner;
7
-#if defined Q_OS_MAC || defined Q_OS_LINUX
8
+#if defined Q_OS_MAC || defined Q_OS_LINUX || defined Q_OS_FREEBSD
9
 			stream << (QFileInfo(fullName).isExecutable() ? true : false);
10
 #endif
11
 		}
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_base_build__config.h (+11 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/base/build_config.h.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/base/build_config.h
3
@@ -26,7 +26,7 @@ Copyright (c) 2014-2017 John Preston, ht
4
 
5
 #if defined(__APPLE__)
6
 #define OS_MAC 1
7
-#elif defined(__linux__) // __APPLE__
8
+#elif defined(__linux__) || defined(__FreeBSD__)// __APPLE__
9
 #define OS_LINUX 1
10
 #elif defined(_WIN32) // __APPLE__ || __linux__
11
 #define OS_WIN 1
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_base_lambda.h (+73 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/base/lambda.h.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/base/lambda.h
3
@@ -212,11 +212,14 @@ protected:
4
 
5
 template <typename Lambda, typename Return, typename ...Args>
6
 struct vtable_once : public vtable_once_impl<Lambda, is_large<Lambda>, Return, Args...> {
7
-	static const vtable_once instance;
8
+	static const vtable_once* get_instance();
9
 };
10
 
11
 template <typename Lambda, typename Return, typename ...Args>
12
-const vtable_once<Lambda, Return, Args...> vtable_once<Lambda, Return, Args...>::instance = {};
13
+const vtable_once<Lambda, Return, Args...>* vtable_once<Lambda, Return, Args...>::get_instance() {
14
+	static vtable_once<Lambda, Return, Args...> instance;
15
+	return &instance;
16
+}
17
 
18
 template <typename Lambda, bool IsLarge, typename Return, typename ...Args> struct vtable_impl;
19
 
20
@@ -262,12 +265,14 @@ struct vtable_impl<Lambda, false, Return
21
 
22
 template <typename Lambda, typename Return, typename ...Args>
23
 struct vtable : public vtable_impl<Lambda, is_large<Lambda>, Return, Args...> {
24
-	static const vtable instance;
25
+	static const vtable* get_instance();
26
 };
27
 
28
 template <typename Lambda, typename Return, typename ...Args>
29
-const vtable<Lambda, Return, Args...> vtable<Lambda, Return, Args...>::instance = {};
30
-
31
+const vtable<Lambda, Return, Args...>* vtable<Lambda, Return, Args...>::get_instance() {
32
+	static vtable<Lambda, Return, Args...> instance;
33
+	return &instance;
34
+}
35
 } // namespace lambda_internal
36
 
37
 template <typename Return, typename ...Args>
38
@@ -346,7 +351,7 @@ public:
39
 	// Copy / move construct / assign from an arbitrary type.
40
 	template <typename Lambda, typename = std::enable_if_t<std::is_convertible<decltype(std::declval<Lambda>()(std::declval<Args>()...)),Return>::value>>
41
 	lambda_once(Lambda other) {
42
-		data_.vtable = &lambda_internal::vtable_once<Lambda, Return, Args...>::instance;
43
+		data_.vtable = lambda_internal::vtable_once<Lambda, Return, Args...>::get_instance();
44
 		lambda_internal::vtable_once<Lambda, Return, Args...>::construct_move_lambda_method(data_.storage, &other);
45
 	}
46
 	template <typename Lambda, typename = std::enable_if_t<std::is_convertible<decltype(std::declval<Lambda>()(std::declval<Args>()...)),Return>::value>>
47
@@ -354,7 +359,7 @@ public:
48
 		if (data_.vtable) {
49
 			data_.vtable->destruct(data_.storage);
50
 		}
51
-		data_.vtable = &lambda_internal::vtable_once<Lambda, Return, Args...>::instance;
52
+		data_.vtable = lambda_internal::vtable_once<Lambda, Return, Args...>::get_instance();
53
 		lambda_internal::vtable_once<Lambda, Return, Args...>::construct_move_lambda_method(data_.storage, &other);
54
 		return *this;
55
 	}
56
@@ -424,7 +429,7 @@ public:
57
 
58
 	// Copy / move construct / assign from an arbitrary type.
59
 	template <typename Lambda, typename = std::enable_if_t<std::is_convertible<decltype(std::declval<Lambda>()(std::declval<Args>()...)),Return>::value>>
60
-	lambda(Lambda other) : Parent(&lambda_internal::vtable<Lambda, Return, Args...>::instance, typename Parent::Private()) {
61
+	lambda(Lambda other) : Parent(lambda_internal::vtable<Lambda, Return, Args...>::get_instance(), typename Parent::Private()) {
62
 		lambda_internal::vtable<Lambda, Return, Args...>::construct_move_lambda_method(this->data_.storage, &other);
63
 	}
64
 	template <typename Lambda, typename = std::enable_if_t<std::is_convertible<decltype(std::declval<Lambda>()(std::declval<Args>()...)),Return>::value>>
65
@@ -432,7 +437,7 @@ public:
66
 		if (this->data_.vtable) {
67
 			this->data_.vtable->destruct(this->data_.storage);
68
 		}
69
-		this->data_.vtable = &lambda_internal::vtable<Lambda, Return, Args...>::instance;
70
+		this->data_.vtable = lambda_internal::vtable<Lambda, Return, Args...>::get_instance();
71
 		lambda_internal::vtable<Lambda, Return, Args...>::construct_move_lambda_method(this->data_.storage, &other);
72
 		return *this;
73
 	}
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_config.h (+20 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/config.h.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/config.h
3
@@ -270,7 +270,7 @@ inline const char *cApiDeviceModel() {
4
 	return "PC";
5
 #elif defined Q_OS_MAC
6
 	return "Mac";
7
-#elif defined Q_OS_LINUX
8
+#elif defined Q_OS_LINUX || defined Q_OS_FREEBSD
9
 	return "PC";
10
 #endif
11
 }
12
@@ -281,6 +281,8 @@ inline const char *cApiSystemVersion() {
13
 	return "OS X";
14
 #elif defined Q_OS_LINUX
15
 	return "Linux";
16
+#elif defined Q_OS_FREEBSD
17
+	return "FreeBSD";
18
 #endif
19
 }
20
 
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_layout.cpp (+22 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/layout.cpp.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/layout.cpp
3
@@ -264,16 +264,16 @@ bool documentIsExecutableName(const QStr
4
 		*result = qsl("\
5
 action app bin command csh osx workflow\
6
 ").split(' ');
7
-#elif defined Q_OS_LINUX // Q_OS_MAC
8
+#elif defined Q_OS_LINUX || defined Q_OS_FREEBSD // Q_OS_MAC
9
 		*result = qsl("\
10
 bin csh ksh out run\
11
 ").split(' ');
12
-#else // Q_OS_MAC || Q_OS_LINUX
13
+#else // Q_OS_MAC || Q_OS_LINUX || Q_OS_FREEBSD
14
 		*result = qsl("\
15
 bat bin cmd com cpl exe gadget inf ins inx isu job jse lnk msc msi \
16
 msp mst paf pif ps1 reg rgs sct shb shs u3p vb vbe vbs vbscript ws wsf\
17
 ").split(' ');
18
-#endif // !Q_OS_MAC && !Q_OS_LINUX
19
+#endif // !Q_OS_MAC && !Q_OS_LINUX && ! Q_OS_FREEBSD
20
 		return result.release();
21
 	})());
22
 
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_logs.cpp (+35 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/logs.cpp.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/logs.cpp
3
@@ -311,7 +311,7 @@ namespace Logs {
4
 		QString initialWorkingDir = QDir(cWorkingDir()).absolutePath() + '/', moveOldDataFrom;
5
 		if (cBetaVersion()) {
6
 			cSetDebug(true);
7
-#if defined Q_OS_MAC || defined Q_OS_LINUX
8
+#if defined Q_OS_MAC || defined Q_OS_LINUX || defined Q_OS_FREEBSD
9
 		} else {
10
 #ifdef _DEBUG
11
 			cForceWorkingDir(cExeDir());
12
@@ -322,11 +322,11 @@ namespace Logs {
13
 #endif // else for _DEBUG
14
 			workingDirChosen = true;
15
 
16
-#if defined Q_OS_LINUX && !defined _DEBUG // fix first version
17
+#if (defined Q_OS_LINUX || defined Q_OS_FREEBSD) && !defined _DEBUG // fix first version
18
 			moveOldDataFrom = initialWorkingDir;
19
-#endif // Q_OS_LINUX && !_DEBUG
20
+#endif // (Q_OS_LINUX || Q_OS_FREEBSD) && !_DEBUG
21
 
22
-#elif defined Q_OS_WINRT // Q_OS_MAC || Q_OS_LINUX
23
+#elif defined Q_OS_WINRT // Q_OS_MAC || Q_OS_LINUX || Q_OS_FREEBSD
24
 		} else {
25
 			cForceWorkingDir(psAppDataPath());
26
 			workingDirChosen = true;
27
@@ -502,7 +502,7 @@ namespace Logs {
28
 		//OutputDebugString(reinterpret_cast<const wchar_t *>(msg.utf16()));
29
 #elif defined Q_OS_MAC
30
 		//objc_outputDebugString(msg);
31
-#elif defined Q_OS_LINUX && defined _DEBUG
32
+#elif (defined Q_OS_LINUX || defined Q_OS_FREEBSD) && defined _DEBUG
33
 		//std::cout << msg.toUtf8().constData();
34
 #endif
35
 	}
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_main.cpp (+31 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/main.cpp.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/main.cpp
3
@@ -21,11 +21,14 @@ Copyright (c) 2014-2017 John Preston, ht
4
 #include "application.h"
5
 #include "platform/platform_specific.h"
6
 #include "storage/localstorage.h"
7
+#include <QFileInfo>
8
+#include <QDir>
9
 
10
 int main(int argc, char *argv[]) {
11
-#ifndef Q_OS_MAC // Retina display support is working fine, others are not.
12
+#if !defined(Q_OS_MAC) && QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
13
+	// Retina display support is working fine, others are not.
14
 	QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
15
-#endif // Q_OS_MAC
16
+#endif // not defined Q_OS_MAC and QT_VERSION >= 5.6.0
17
 	QCoreApplication::setApplicationName(qsl("TelegramDesktop"));
18
 
19
 	InitFromCommandLine(argc, argv);
20
@@ -39,6 +42,11 @@ int main(int argc, char *argv[]) {
21
 	Logs::start(); // must be started before Platform is started
22
 	Platform::start(); // must be started before QApplication is created
23
 
24
+	// I don't know why path is not in QT_PLUGIN_PATH by default
25
+	QCoreApplication::addLibraryPath(QFileInfo(QCoreApplication::applicationFilePath()).absolutePath()+"/lib/qt5/plugins");
26
+	// without this Telegram doesn't start on Ubuntu 17.04 due GTK errors
27
+	setenv("QT_STYLE_OVERRIDE", "qwerty", false);
28
+
29
 	int result = 0;
30
 	{
31
 		Application app(argc, argv);
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_mainwindow.cpp (+19 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/mainwindow.cpp.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/mainwindow.cpp
3
@@ -460,6 +460,7 @@ void MainWindow::ui_hideMediaPreview() {
4
 void MainWindow::showConnecting(const QString &text, const QString &reconnect) {
5
 	if (_connecting) {
6
 		_connecting->set(text, reconnect);
7
+		_connecting->show();
8
 	} else {
9
 		_connecting.create(bodyWidget(), text, reconnect);
10
 		_connecting->show();
11
@@ -470,7 +471,7 @@ void MainWindow::showConnecting(const QS
12
 
13
 void MainWindow::hideConnecting() {
14
 	if (_connecting) {
15
-		_connecting.destroyDelayed();
16
+		_connecting->hide();
17
 	}
18
 }
19
 
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_linux_linux__libs.cpp (+47 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/platform/linux/linux_libs.cpp.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/platform/linux/linux_libs.cpp
3
@@ -133,6 +133,7 @@ bool setupGtkBase(QLibrary &lib_gtk) {
4
 	return true;
5
 }
6
 
7
+#ifdef HAVE_APPINDICATOR
8
 bool setupAppIndicator(QLibrary &lib_indicator) {
9
 	if (!load(lib_indicator, "app_indicator_new", app_indicator_new)) return false;
10
 	if (!load(lib_indicator, "app_indicator_set_status", app_indicator_set_status)) return false;
11
@@ -142,6 +143,7 @@ bool setupAppIndicator(QLibrary &lib_ind
12
 	DEBUG_LOG(("Library appindicator functions loaded!"));
13
 	return true;
14
 }
15
+#endif
16
 
17
 } // namespace
18
 
19
@@ -201,10 +203,12 @@ f_g_type_check_instance_cast g_type_chec
20
 f_g_type_check_instance_is_a g_type_check_instance_is_a = nullptr;
21
 f_g_signal_connect_data g_signal_connect_data = nullptr;
22
 f_g_signal_handler_disconnect g_signal_handler_disconnect = nullptr;
23
+#ifdef HAVE_APPINDICATOR
24
 f_app_indicator_new app_indicator_new = nullptr;
25
 f_app_indicator_set_status app_indicator_set_status = nullptr;
26
 f_app_indicator_set_menu app_indicator_set_menu = nullptr;
27
 f_app_indicator_set_icon_full app_indicator_set_icon_full = nullptr;
28
+#endif
29
 f_gdk_init_check gdk_init_check = nullptr;
30
 f_gdk_pixbuf_new_from_data gdk_pixbuf_new_from_data = nullptr;
31
 f_gdk_pixbuf_new_from_file gdk_pixbuf_new_from_file = nullptr;
32
@@ -242,6 +246,7 @@ void start() {
33
 	bool gtkLoaded = false;
34
 	bool indicatorLoaded = false;
35
 	QLibrary lib_gtk, lib_indicator;
36
+#ifdef HAVE_APPINDICATOR
37
 	if (loadLibrary(lib_indicator, "appindicator3", 1)) {
38
 		if (loadLibrary(lib_gtk, "gtk-3", 0)) {
39
 			gtkLoaded = setupGtkBase(lib_gtk);
40
@@ -257,6 +262,7 @@ void start() {
41
 			}
42
 		}
43
 	}
44
+#endif
45
 
46
 	// If no appindicator, try at least load gtk.
47
 	if (!gtkLoaded && !indicatorLoaded) {
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_linux_linux__libs.h (+36 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/platform/linux/linux_libs.h.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/platform/linux/linux_libs.h
3
@@ -22,14 +22,16 @@ Copyright (c) 2014-2017 John Preston, ht
4
 
5
 extern "C" {
6
 #undef signals
7
+#ifdef HAVE_APPINDICATOR
8
 #include <libappindicator/app-indicator.h>
9
+#endif
10
 #include <gtk/gtk.h>
11
 #include <gdk/gdk.h>
12
 #define signals public
13
 } // extern "C"
14
 
15
 #ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION
16
-#include <unity/unity/unity.h>
17
+typedef void UnityLauncherEntry;
18
 #endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION
19
 
20
 namespace Platform {
21
@@ -284,6 +286,7 @@ inline gulong g_signal_connect_swapped_h
22
 typedef void (*f_g_signal_handler_disconnect)(gpointer instance, gulong handler_id);
23
 extern f_g_signal_handler_disconnect g_signal_handler_disconnect;
24
 
25
+#ifdef HAVE_APPINDICATOR
26
 typedef AppIndicator* (*f_app_indicator_new)(const gchar *id, const gchar *icon_name, AppIndicatorCategory category);
27
 extern f_app_indicator_new app_indicator_new;
28
 
29
@@ -295,6 +298,7 @@ extern f_app_indicator_set_menu app_indi
30
 
31
 typedef void (*f_app_indicator_set_icon_full)(AppIndicator *self, const gchar *icon_name, const gchar *icon_desc);
32
 extern f_app_indicator_set_icon_full app_indicator_set_icon_full;
33
+#endif
34
 
35
 typedef gboolean (*f_gdk_init_check)(gint *argc, gchar ***argv);
36
 extern f_gdk_init_check gdk_init_check;
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_linux_main__window__linux.cpp (+87 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/platform/linux/main_window_linux.cpp.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/platform/linux/main_window_linux.cpp
3
@@ -36,7 +36,9 @@ namespace {
4
 bool noQtTrayIcon = false, tryAppIndicator = false;
5
 bool useGtkBase = false, useAppIndicator = false, useStatusIcon = false, trayIconChecked = false, useUnityCount = false;
6
 
7
+#ifdef HAVE_APPINDICATOR
8
 AppIndicator *_trayIndicator = 0;
9
+#endif
10
 GtkStatusIcon *_trayIcon = 0;
11
 GtkWidget *_trayMenu = 0;
12
 GdkPixbuf *_trayPixbuf = 0;
13
@@ -274,7 +276,9 @@ void MainWindow::workmodeUpdated(DBIWork
14
 	if (mode == dbiwmWindowOnly) {
15
 		if (noQtTrayIcon) {
16
 			if (useAppIndicator) {
17
+#ifdef HAVE_APPINDICATOR
18
 				Libs::app_indicator_set_status(_trayIndicator, APP_INDICATOR_STATUS_PASSIVE);
19
+#endif
20
 			} else if (useStatusIcon) {
21
 				Libs::gtk_status_icon_set_visible(_trayIcon, false);
22
 			}
23
@@ -288,7 +292,9 @@ void MainWindow::workmodeUpdated(DBIWork
24
 	} else {
25
 		if (noQtTrayIcon) {
26
 			if (useAppIndicator) {
27
+#ifdef HAVE_APPINDICATOR
28
 				Libs::app_indicator_set_status(_trayIndicator, APP_INDICATOR_STATUS_ACTIVE);
29
+#endif
30
 			} else if (useStatusIcon) {
31
 				Libs::gtk_status_icon_set_visible(_trayIcon, true);
32
 			}
33
@@ -305,7 +311,9 @@ void MainWindow::psUpdateIndicator() {
34
 	if (iconFile.exists()) {
35
 		QByteArray path = QFile::encodeName(iconFile.absoluteFilePath()), name = QFile::encodeName(iconFile.fileName());
36
 		name = name.mid(0, name.size() - 4);
37
+#ifdef HAVE_APPINDICATOR
38
 		Libs::app_indicator_set_icon_full(_trayIndicator, path.constData(), name);
39
+#endif
40
 	} else {
41
 		useAppIndicator = false;
42
 	}
43
@@ -392,11 +400,15 @@ void MainWindow::LibsLoaded() {
44
 			&& (Libs::g_object_ref_sink != nullptr)
45
 			&& (Libs::g_object_unref != nullptr);
46
 
47
+#ifdef HAVE_APPINDICATOR
48
 	useAppIndicator = useGtkBase
49
 			&& (Libs::app_indicator_new != nullptr)
50
 			&& (Libs::app_indicator_set_status != nullptr)
51
 			&& (Libs::app_indicator_set_menu != nullptr)
52
 			&& (Libs::app_indicator_set_icon_full != nullptr);
53
+#else
54
+    useAppIndicator = false;
55
+#endif
56
 
57
 	if (tryAppIndicator && useGtkBase && useAppIndicator) {
58
 		noQtTrayIcon = true;
59
@@ -439,6 +451,7 @@ void MainWindow::psCreateTrayIcon() {
60
 		return;
61
 	}
62
 
63
+#ifdef HAVE_APPINDICATOR
64
 	if (useAppIndicator) {
65
 		DEBUG_LOG(("Trying to create AppIndicator"));
66
 		_trayMenu = Libs::gtk_menu_new();
67
@@ -469,6 +482,7 @@ void MainWindow::psCreateTrayIcon() {
68
 			useAppIndicator = false;
69
 		}
70
 	}
71
+#endif
72
 	if (useStatusIcon) {
73
 		if (Libs::gdk_init_check(0, 0)) {
74
 			if (!_trayMenu) _trayMenu = Libs::gtk_menu_new();
75
@@ -585,10 +599,12 @@ MainWindow::~MainWindow() {
76
 		Libs::g_object_unref(_trayMenu);
77
 		_trayMenu = nullptr;
78
 	}
79
+#ifdef HAVE_APPINDICATOR
80
 	if (_trayIndicator) {
81
 		Libs::g_object_unref(_trayIndicator);
82
 		_trayIndicator = nullptr;
83
 	}
84
+#endif
85
 #ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION
86
 	if (_psUnityLauncherEntry) {
87
 		Libs::g_object_unref(_psUnityLauncherEntry);
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_platform__audio.h (+20 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/platform/platform_audio.h.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/platform/platform_audio.h
3
@@ -32,7 +32,7 @@ void DeInit();
4
 
5
 // Platform dependent implementations.
6
 
7
-#if defined Q_OS_MAC || defined Q_OS_LINUX
8
+#if defined Q_OS_MAC || defined Q_OS_LINUX || defined Q_OS_FREEBSD
9
 namespace Platform {
10
 namespace Audio {
11
 
12
@@ -44,6 +44,6 @@ inline void DeInit() {
13
 
14
 } // namespace Audio
15
 } // namespace Platform
16
-#elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX
17
+#elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX || Q_OS_FREEBSD
18
 #include "platform/win/audio_win.h"
19
-#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN
20
+#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN || Q_OS_FREEBSD
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_platform__file__utilities.h (+14 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/platform/platform_file_utilities.h.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/platform/platform_file_utilities.h
3
@@ -51,8 +51,8 @@ bool Get(QStringList &files, QByteArray 
4
 
5
 #ifdef Q_OS_MAC
6
 #include "platform/mac/file_utilities_mac.h"
7
-#elif defined Q_OS_LINUX // Q_OS_MAC
8
+#elif defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) // Q_OS_MAC
9
 #include "platform/linux/file_utilities_linux.h"
10
-#elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX
11
+#elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX || Q_OS_FREEBSD
12
 #include "platform/win/file_utilities_win.h"
13
-#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN
14
+#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN || Q_OS_FREEBSD
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_platform__main__window.h (+14 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/platform/platform_main_window.h.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/platform/platform_main_window.h
3
@@ -32,8 +32,8 @@ class MainWindow;
4
 
5
 #ifdef Q_OS_MAC
6
 #include "platform/mac/main_window_mac.h"
7
-#elif defined Q_OS_LINUX // Q_OS_MAC
8
+#elif defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) // Q_OS_MAC
9
 #include "platform/linux/main_window_linux.h"
10
-#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX
11
+#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX || Q_OS_FREEBSD
12
 #include "platform/win/main_window_win.h"
13
-#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN
14
+#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN || Q_OS_FREEBSD
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_platform__notifications__manager.h (+14 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/platform/platform_notifications_manager.h.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/platform/platform_notifications_manager.h
3
@@ -39,8 +39,8 @@ void FlashBounce();
4
 
5
 #ifdef Q_OS_MAC
6
 #include "platform/mac/notifications_manager_mac.h"
7
-#elif defined Q_OS_LINUX // Q_OS_MAC
8
+#elif defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) // Q_OS_MAC
9
 #include "platform/linux/notifications_manager_linux.h"
10
-#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX
11
+#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX || Q_OS_FREEBSD
12
 #include "platform/win/notifications_manager_win.h"
13
-#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN
14
+#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN || Q_OS_FREEBSD
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_platform__specific.h (+14 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/platform/platform_specific.h.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/platform/platform_specific.h
3
@@ -45,8 +45,8 @@ void finish();
4
 
5
 #ifdef Q_OS_MAC
6
 #include "platform/mac/specific_mac.h"
7
-#elif defined Q_OS_LINUX // Q_OS_MAC
8
+#elif defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) // Q_OS_MAC
9
 #include "platform/linux/specific_linux.h"
10
-#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX
11
+#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX || Q_OS_FREEBSD
12
 #include "platform/win/specific_win.h"
13
-#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN
14
+#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN || Q_OS_FREEBSD
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_platform__window__title.h (+17 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/platform/platform_window_title.h.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/platform/platform_window_title.h
3
@@ -38,7 +38,7 @@ void PreviewWindowFramePaint(QImage &pre
4
 #include "platform/mac/window_title_mac.h"
5
 #elif defined Q_OS_WIN // Q_OS_MAC
6
 #include "platform/win/window_title_win.h"
7
-#elif defined Q_OS_WINRT || defined Q_OS_LINUX // Q_OS_MAC || Q_OS_WIN
8
+#elif defined Q_OS_WINRT || defined Q_OS_LINUX  || defined Q_OS_FREEBSD // Q_OS_MAC || Q_OS_WIN
9
 
10
 namespace Platform {
11
 
12
@@ -56,4 +56,4 @@ inline void PreviewWindowFramePaint(QIma
13
 
14
 } // namespace Platform
15
 
16
-#endif // Q_OS_MAC || Q_OS_WIN || Q_OS_WINRT || Q_OS_LINUX
17
+#endif // Q_OS_MAC || Q_OS_WIN || Q_OS_WINRT || Q_OS_LINUX || Q_OS_FREEBSD
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_qt__functions.cpp (+97 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/qt_functions.cpp.orig	2017-12-11 02:38:06 UTC
2
+++ Telegram/SourceFiles/qt_functions.cpp
3
@@ -0,0 +1,94 @@
4
+/****************************************************************************
5
+**
6
+** Copyright (C) 2015 The Qt Company Ltd.
7
+** Contact: http://www.qt.io/licensing/
8
+**
9
+** This file contains some parts of the Qt Toolkit.
10
+**
11
+** $QT_BEGIN_LICENSE:LGPL21$
12
+** Commercial License Usage
13
+** Licensees holding valid commercial Qt licenses may use this file in
14
+** accordance with the commercial license agreement provided with the
15
+** Software or, alternatively, in accordance with the terms contained in
16
+** a written agreement between you and The Qt Company. For licensing terms
17
+** and conditions see http://www.qt.io/terms-conditions. For further
18
+** information use the contact form at http://www.qt.io/contact-us.
19
+**
20
+** GNU Lesser General Public License Usage
21
+** Alternatively, this file may be used under the terms of the GNU Lesser
22
+** General Public License version 2.1 or version 3 as published by the Free
23
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
24
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
25
+** following information to ensure the GNU Lesser General Public License
26
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
27
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
28
+**
29
+** As a special exception, The Qt Company gives you certain additional
30
+** rights. These rights are described in The Qt Company LGPL Exception
31
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
32
+**
33
+** $QT_END_LICENSE$
34
+**
35
+****************************************************************************/
36
+
37
+/* TODO: find a dynamic library with these symbols. */
38
+
39
+/* Debian maintainer: this function is taken from qfiledialog.cpp */
40
+/*
41
+    Makes a list of filters from ;;-separated text.
42
+    Used by the mac and windows implementations
43
+*/
44
+QStringList qt_make_filter_list(const QString &filter)
45
+{
46
+    QString f(filter);
47
+
48
+    if (f.isEmpty())
49
+        return QStringList();
50
+
51
+    QString sep(QLatin1String(";;"));
52
+    int i = f.indexOf(sep, 0);
53
+    if (i == -1) {
54
+        if (f.indexOf(QLatin1Char('\n'), 0) != -1) {
55
+            sep = QLatin1Char('\n');
56
+            i = f.indexOf(sep, 0);
57
+        }
58
+    }
59
+
60
+    return f.split(sep);
61
+}
62
+
63
+/* Debian maintainer: this constructor is taken from qtextengine.cpp for TextPainter::drawLine */
64
+QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe, const QTextCharFormat &format)
65
+    : flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline), charFormat(format),
66
+      num_chars(numChars), chars(chars_), logClusters(0), f(font),  glyphs(g), fontEngine(fe)
67
+{
68
+}
69
+
70
+/* Debian maintainer: this method is also taken from qtextengine.cpp */
71
+// Fix up flags and underlineStyle with given info
72
+void QTextItemInt::initWithScriptItem(const QScriptItem &si)
73
+{
74
+    // explicitly initialize flags so that initFontAttributes can be called
75
+    // multiple times on the same TextItem
76
+    flags = 0;
77
+    if (si.analysis.bidiLevel %2)
78
+        flags |= QTextItem::RightToLeft;
79
+    ascent = si.ascent;
80
+    descent = si.descent;
81
+
82
+    if (charFormat.hasProperty(QTextFormat::TextUnderlineStyle)) {
83
+        underlineStyle = charFormat.underlineStyle();
84
+    } else if (charFormat.boolProperty(QTextFormat::FontUnderline)
85
+               || f->d->underline) {
86
+        underlineStyle = QTextCharFormat::SingleUnderline;
87
+    }
88
+
89
+    // compat
90
+    if (underlineStyle == QTextCharFormat::SingleUnderline)
91
+        flags |= QTextItem::Underline;
92
+
93
+    if (f->d->overline || charFormat.fontOverline())
94
+        flags |= QTextItem::Overline;
95
+    if (f->d->strikeOut || charFormat.fontStrikeOut())
96
+        flags |= QTextItem::StrikeOut;
97
+}
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_qt__static__plugins.cpp (+19 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/qt_static_plugins.cpp.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/qt_static_plugins.cpp
3
@@ -27,14 +27,5 @@ Q_IMPORT_PLUGIN(QWindowsIntegrationPlugi
4
 Q_IMPORT_PLUGIN(QWebpPlugin)
5
 Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)
6
 Q_IMPORT_PLUGIN(QGenericEnginePlugin)
7
-#elif defined Q_OS_LINUX // Q_OS_WIN | Q_OS_MAC
8
-Q_IMPORT_PLUGIN(QWebpPlugin)
9
-Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
10
-Q_IMPORT_PLUGIN(QConnmanEnginePlugin)
11
-Q_IMPORT_PLUGIN(QGenericEnginePlugin)
12
-Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin)
13
-Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin)
14
-Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin)
15
-Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin)
16
-Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin)
17
-#endif // Q_OS_WIN | Q_OS_MAC | Q_OS_LINUX
18
+#elif defined Q_OS_LINUX || defined Q_OS_FREEBSD // Q_OS_WIN | Q_OS_MAC
19
+#endif // Q_OS_WIN | Q_OS_MAC | Q_OS_LINUX | Q_OS_FREEBSD
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_structs.cpp (+11 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/structs.cpp.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/structs.cpp
3
@@ -1280,7 +1280,7 @@ QString saveFileName(const QString &titl
4
 	name = name.replace(QRegularExpression(qsl("[\\\\\\/\\:\\*\\?\\\"\\<\\>\\|]")), qsl("_"));
5
 #elif defined Q_OS_MAC
6
 	name = name.replace(QRegularExpression(qsl("[\\:]")), qsl("_"));
7
-#elif defined Q_OS_LINUX
8
+#elif defined Q_OS_LINUX || defined Q_OS_FREEBSD
9
 	name = name.replace(QRegularExpression(qsl("[\\/]")), qsl("_"));
10
 #endif
11
 	if (Global::AskDownloadPath() || savingAs) {
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_ui_text_text.cpp (+17 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/ui/text/text.cpp.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/ui/text/text.cpp
3
@@ -1689,11 +1689,11 @@ private:
4
 		if (item == -1)
5
 			return;
6
 
7
-#ifdef OS_MAC_OLD
8
+#if defined(OS_MAC_OLD) || QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
9
 		auto end = _e->findItem(line.from + line.length - 1);
10
-#else // OS_MAC_OLD
11
+#else
12
 		auto end = _e->findItem(line.from + line.length - 1, item);
13
-#endif // OS_MAC_OLD
14
+#endif
15
 
16
 		auto blockIndex = _lineStartBlock;
17
 		auto currentBlock = _t->_blocks[blockIndex].get();
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_ui_text_text__block.cpp (+11 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/ui/text/text_block.cpp.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/ui/text/text_block.cpp
3
@@ -330,7 +330,7 @@ TextBlock::TextBlock(const style::font &
4
 		SignalHandlers::setCrashAnnotationRef("CrashString", &part);
5
 
6
 		QStackTextEngine engine(part, blockFont->f);
7
-		QTextLayout layout(&engine);
8
+		QTextLayout layout(part, blockFont->f);
9
 		layout.beginLayout();
10
 		layout.createLine();
11
 
(-)net-im/telegram-desktop/files/patch-Telegram_SourceFiles_ui_twidget.cpp (+14 lines)
Line 0 Link Here
1
--- Telegram/SourceFiles/ui/twidget.cpp.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/SourceFiles/ui/twidget.cpp
3
@@ -191,9 +191,9 @@ void sendSynteticMouseEvent(QWidget *wid
4
 			, button
5
 			, QGuiApplication::mouseButtons() | button
6
 			, QGuiApplication::keyboardModifiers()
7
-#ifndef OS_MAC_OLD
8
+#if !defined(OS_MAC_OLD) && QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
9
 			, Qt::MouseEventSynthesizedByApplication
10
-#endif // OS_MAC_OLD
11
+#endif
12
 		);
13
 		ev.setTimestamp(getms());
14
 		QGuiApplication::sendEvent(windowHandle, &ev);
(-)net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_audio_AudioInput.cpp (+11 lines)
Line 0 Link Here
1
--- Telegram/ThirdParty/libtgvoip/audio/AudioInput.cpp.orig	2017-07-06 17:16:18 UTC
2
+++ Telegram/ThirdParty/libtgvoip/audio/AudioInput.cpp
3
@@ -20,7 +20,7 @@
4
 #include "../os/windows/AudioInputWave.h"
5
 #endif
6
 #include "../os/windows/AudioInputWASAPI.h"
7
-#elif defined(__linux__)
8
+#elif defined(__linux__) || defined(__FreeBSD__)
9
 #include "../os/linux/AudioInputALSA.h"
10
 #include "../os/linux/AudioInputPulse.h"
11
 #else
(-)net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_audio_AudioOutput.cpp (+11 lines)
Line 0 Link Here
1
--- Telegram/ThirdParty/libtgvoip/audio/AudioOutput.cpp.orig	2017-07-06 17:16:18 UTC
2
+++ Telegram/ThirdParty/libtgvoip/audio/AudioOutput.cpp
3
@@ -21,7 +21,7 @@
4
 #include "../os/windows/AudioOutputWave.h"
5
 #endif
6
 #include "../os/windows/AudioOutputWASAPI.h"
7
-#elif defined(__linux__)
8
+#elif defined(__linux__) || defined(__FreeBSD__)
9
 #include "../os/linux/AudioOutputALSA.h"
10
 #include "../os/linux/AudioOutputPulse.h"
11
 #else
(-)net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_os_posix_NetworkSocketPosix.cpp (+10 lines)
Line 0 Link Here
1
--- Telegram/ThirdParty/libtgvoip/os/posix/NetworkSocketPosix.cpp.orig	2017-07-06 17:16:18 UTC
2
+++ Telegram/ThirdParty/libtgvoip/os/posix/NetworkSocketPosix.cpp
3
@@ -45,6 +45,7 @@ void NetworkSocketPosix::SetMaxPriority(
4
 	if(res<0){
5
 		LOGE("error setting darwin-specific net priority: %d / %s", errno, strerror(errno));
6
 	}
7
+#elif defined(__FreeBSD__)
8
 #else
9
 	int prio=5;
10
 	int res=setsockopt(fd, SOL_SOCKET, SO_PRIORITY, &prio, sizeof(prio));
(-)net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_threading.h (+11 lines)
Line 0 Link Here
1
--- Telegram/ThirdParty/libtgvoip/threading.h.orig	2017-07-06 17:16:18 UTC
2
+++ Telegram/ThirdParty/libtgvoip/threading.h
3
@@ -20,7 +20,7 @@ typedef pthread_cond_t tgvoip_lock_t;
4
 #define start_thread(ref, entry, arg) pthread_create(&ref, NULL, entry, arg)
5
 #define join_thread(thread) pthread_join(thread, NULL)
6
 #ifndef __APPLE__
7
-#define set_thread_name(thread, name) pthread_setname_np(thread, name)
8
+#define set_thread_name(thread, name)
9
 #else
10
 #define set_thread_name(thread, name)
11
 #endif
(-)net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_webrtc__dsp_webrtc_base_stringutils.h (+11 lines)
Line 0 Link Here
1
--- Telegram/ThirdParty/libtgvoip/webrtc_dsp/webrtc/base/stringutils.h.orig	2017-07-06 17:16:18 UTC
2
+++ Telegram/ThirdParty/libtgvoip/webrtc_dsp/webrtc/base/stringutils.h
3
@@ -23,7 +23,7 @@
4
 #endif  // WEBRTC_WIN 
5
 
6
 #if defined(WEBRTC_POSIX)
7
-#ifdef BSD
8
+#if defined BSD || defined __FreeBSD__
9
 #include <stdlib.h>
10
 #else  // BSD
11
 #include <alloca.h>
(-)net-im/telegram-desktop/files/patch-Telegram_gyp_PrecompiledHeader.cmake (+36 lines)
Line 0 Link Here
1
--- Telegram/gyp/PrecompiledHeader.cmake.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/gyp/PrecompiledHeader.cmake
3
@@ -79,7 +79,7 @@ function(export_all_flags _filename _sou
4
 endfunction()
5
 
6
 function(add_precompiled_header _target _input)
7
-  if(CMAKE_COMPILER_IS_GNUCXX)
8
+  if(CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
9
     get_filename_component(_name ${_input} NAME)
10
     set(_pch_header "${CMAKE_CURRENT_SOURCE_DIR}/${_input}")
11
     set(_pch_binary_dir "${CMAKE_CURRENT_BINARY_DIR}/${_target}_pch")
12
@@ -112,7 +112,7 @@ function(add_precompiled_header _target 
13
       set(_compiler_FLAGS "@${_pch_c_flags_file}")
14
       add_custom_command(
15
         OUTPUT "${_output_c}"
16
-        COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} -x c-header -o "${_output_c}" -c "${_pchfile}"
17
+        COMMAND "${CMAKE_C_COMPILER}" "$(C_DEFINES)" "$(C_INCLUDES)" "$(C_FLAGS)" -x c-header -o "${_output_c}" -c "${_pchfile}"
18
         DEPENDS "${_pchfile}" "${_pch_c_flags_file}"
19
         IMPLICIT_DEPENDS C "${_pch_header}"
20
         COMMENT "Precompiling ${_name} for ${_target} (C)")
21
@@ -123,7 +123,7 @@ function(add_precompiled_header _target 
22
       set(_compiler_FLAGS "@${_pch_cpp_flags_file}")
23
       add_custom_command(
24
         OUTPUT "${_output_cxx}"
25
-        COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} -x c++-header -o "${_output_cxx}" -c "${_pchfile}"
26
+        COMMAND "${CMAKE_CXX_COMPILER}" "$(CXX_DEFINES)" "$(CXX_INCLUDES)" "$(CXX_FLAGS)" -x c++-header -o "${_output_cxx}" -c "${_pchfile}"
27
         DEPENDS "${_pchfile}" "${_pch_cpp_flags_file}"
28
         IMPLICIT_DEPENDS CXX "${_pch_header}"
29
         COMMENT "Precompiling ${_name} for ${_target} (C++)")
30
@@ -161,5 +161,5 @@ function(add_precompiled_header _target 
31
           OBJECT_DEPENDS "${_object_depends}")
32
       endif()
33
     endforeach()
34
-  endif(CMAKE_COMPILER_IS_GNUCXX)
35
+  endif(CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
36
 endfunction()
(-)net-im/telegram-desktop/files/patch-Telegram_gyp_common.gypi (+11 lines)
Line 0 Link Here
1
--- Telegram/gyp/common.gypi.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/gyp/common.gypi
3
@@ -42,7 +42,7 @@
4
             }, {
5
               'build_mac': 0,
6
             }],
7
-            [ 'build_os == "linux"', {
8
+            [ 'build_os == "freebsd"', {
9
               'build_linux': 1,
10
             }, {
11
               'build_linux': 0,
(-)net-im/telegram-desktop/files/patch-Telegram_gyp_settings__linux.gypi (+18 lines)
Line 0 Link Here
1
--- Telegram/gyp/settings_linux.gypi.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/gyp/settings_linux.gypi
3
@@ -25,7 +25,6 @@
4
           '-pipe',
5
           '-g',
6
           '-Wall',
7
-          '-Werror',
8
           '-W',
9
           '-fPIC',
10
           '-Wno-unused-variable',
11
@@ -61,7 +60,6 @@
12
       ],
13
       'defines': [
14
         '_REENTRANT',
15
-        'QT_STATICPLUGIN',
16
         'QT_PLUGIN',
17
       ],
18
       'cflags_c': [
(-)net-im/telegram-desktop/files/patch-Telegram_gyp_telegram__sources.txt (+18 lines)
Line 0 Link Here
1
--- Telegram/gyp/telegram_sources.txt.orig	2017-09-05 17:38:38 UTC
2
+++ Telegram/gyp/telegram_sources.txt
3
@@ -598,14 +598,7 @@
4
 <(emoji_suggestions_loc)/emoji_suggestions.cpp
5
 <(emoji_suggestions_loc)/emoji_suggestions.h
6
 
7
-platforms: !win
8
-<(minizip_loc)/crypt.h
9
-<(minizip_loc)/ioapi.c
10
-<(minizip_loc)/ioapi.h
11
-<(minizip_loc)/zip.c
12
-<(minizip_loc)/zip.h
13
-<(minizip_loc)/unzip.c
14
-<(minizip_loc)/unzip.h
15
+<(src_loc)/qt_functions.cpp
16
 
17
 platforms: mac
18
 <(sp_media_key_tap_loc)/SPMediaKeyTap.m
(-)net-im/telegram-desktop/files/patch-lib_xdg_tg.protocol (+9 lines)
Line 0 Link Here
1
--- lib/xdg/tg.protocol.orig	2017-12-11 02:41:11 UTC
2
+++ lib/xdg/tg.protocol
3
@@ -1,5 +1,5 @@
4
 [Protocol]
5
-exec=/usr/bin/telegram-desktop -- %u
6
+exec=telegram-desktop -- %u
7
 protocol=tg
8
 input=none
9
 output=none
(-)net-im/telegram-desktop/pkg-descr (+5 lines)
Line 0 Link Here
1
Telegram Desktop is a messaging app. It is the fast and functional open source
2
desktop app connected to the closed source Telegram server.
3
4
5
WWW: https://desktop.telegram.org/
(-)net-im/telegram-desktop/pkg-plist (+11 lines)
Line 0 Link Here
1
bin/telegram-desktop
2
share/appdata/telegram-desktop.appdata.xml
3
share/applications/telegram-desktop.desktop
4
share/kservices5/tg.protocol
5
share/icons/hicolor/128x128/apps/telegram-desktop.png
6
share/icons/hicolor/16x16/apps/telegram-desktop.png
7
share/icons/hicolor/256x256/apps/telegram-desktop.png
8
share/icons/hicolor/32x32/apps/telegram-desktop.png
9
share/icons/hicolor/48x48/apps/telegram-desktop.png
10
share/icons/hicolor/512x512/apps/telegram-desktop.png
11
share/icons/hicolor/64x64/apps/telegram-desktop.png

Return to bug 224193