Telegram: add recipe for 1.5.9 version. disabled for now.

This commit is contained in:
Gerasim Troeglazov
2019-02-01 19:44:01 +10:00
parent 3ae34270f0
commit 51793b1a01
6 changed files with 4515 additions and 0 deletions

View File

@@ -0,0 +1 @@
--api-id 17349 --api-hash 344583e45741c457fe1862106095a5eb

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -0,0 +1,985 @@
From ea45a14cb93dd0bfff3598ef24910c0f90db2b2c Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Thu, 31 Jan 2019 12:47:54 +1000
Subject: Add haiku support
diff --git a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/OpusDecoder.cpp b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/OpusDecoder.cpp
old mode 100755
new mode 100644
index 0ecd63e..61081f9
--- a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/OpusDecoder.cpp
+++ b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/OpusDecoder.cpp
@@ -10,7 +10,7 @@
#include <assert.h>
#include <math.h>
#include <algorithm>
-#ifdef HAVE_CONFIG_H
+#if defined(HAVE_CONFIG_H) || defined(__HAIKU__)
#include <opus/opus.h>
#else
#include "opus.h"
diff --git a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/OpusEncoder.cpp b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/OpusEncoder.cpp
old mode 100755
new mode 100644
index cf66590..c2123a7
--- a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/OpusEncoder.cpp
+++ b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/OpusEncoder.cpp
@@ -9,7 +9,7 @@
#include <algorithm>
#include "logging.h"
#include "VoIPServerConfig.h"
-#ifdef HAVE_CONFIG_H
+#if defined(HAVE_CONFIG_H) || defined(__HAIKU__)
#include <opus/opus.h>
#else
#include "opus.h"
diff --git a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/OpusEncoder.h b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/OpusEncoder.h
old mode 100755
new mode 100644
diff --git a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/VoIPController.cpp b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/VoIPController.cpp
old mode 100755
new mode 100644
index a0574d5..457c8b9
--- a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/VoIPController.cpp
+++ b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/VoIPController.cpp
@@ -8,6 +8,9 @@
#include <unistd.h>
#include <sys/time.h>
#endif
+#ifdef __HAIKU__
+#include <OS.h>
+#endif
#include <errno.h>
#include <string.h>
#include <wchar.h>
@@ -2844,6 +2847,10 @@ double VoIPController::GetCurrentTime(){
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return ts.tv_sec+(double)ts.tv_nsec/1000000000.0;
+#elif defined(__HAIKU__)
+ struct timeval tm;
+ gettimeofday(&tm, NULL);
+ return tm.tv_sec+(double)tm.tv_usec/1000000.0;
#elif defined(__APPLE__)
static pthread_once_t token = PTHREAD_ONCE_INIT;
pthread_once(&token, &initMachTimestart);
diff --git a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/audio/AudioIO.cpp b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/audio/AudioIO.cpp
index 2c16ca7..e00c731 100644
--- a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/audio/AudioIO.cpp
+++ b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/audio/AudioIO.cpp
@@ -39,6 +39,9 @@
#ifndef WITHOUT_PULSE
#include "../os/linux/AudioPulse.h"
#endif
+#elif defined(__HAIKU__)
+#include "../os/haiku/AudioInputHaiku.h"
+#include "../os/haiku/AudioOutputHaiku.h"
#else
#error "Unsupported operating system"
#endif
@@ -65,6 +68,8 @@ AudioIO* AudioIO::Create(std::string inputDevice, std::string outputDevice){
return new ContextlessAudioIO<AudioInputWave, AudioOutputWave>(inputDevice, outputDevice);
#endif
return new ContextlessAudioIO<AudioInputWASAPI, AudioOutputWASAPI>(inputDevice, outputDevice);
+#elif defined(__HAIKU__)
+ return new ContextlessAudioIO<AudioInputHaiku, AudioOutputHaiku>();
#elif defined(__linux__)
#ifndef WITHOUT_ALSA
#ifndef WITHOUT_PULSE
diff --git a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/audio/AudioInput.cpp b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/audio/AudioInput.cpp
index dae647a..4bab98c 100644
--- a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/audio/AudioInput.cpp
+++ b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/audio/AudioInput.cpp
@@ -33,6 +33,8 @@
#ifndef WITHOUT_PULSE
#include "../os/linux/AudioPulse.h"
#endif
+#elif defined(__HAIKU__)
+#include "../os/haiku/AudioInputHaiku.h"
#else
#error "Unsupported operating system"
#endif
diff --git a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/audio/AudioOutput.cpp b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/audio/AudioOutput.cpp
index 458e8a5..1890350 100644
--- a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/audio/AudioOutput.cpp
+++ b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/audio/AudioOutput.cpp
@@ -37,6 +37,8 @@
#include "../os/linux/AudioOutputPulse.h"
#include "../os/linux/AudioPulse.h"
#endif
+#elif defined(__HAIKU__)
+#include "../os/haiku/AudioOutputHaiku.h"
#else
#error "Unsupported operating system"
#endif
diff --git a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/libtgvoip.gyp b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/libtgvoip.gyp
index 8c62b56..2528ba0 100644
--- a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/libtgvoip.gyp
+++ b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/libtgvoip.gyp
@@ -113,6 +113,14 @@
'<(tgvoip_src_loc)/os/linux/AudioPulse.cpp',
'<(tgvoip_src_loc)/os/linux/AudioPulse.h',
+ # Haiku
+ '<(tgvoip_src_loc)/os/haiku/AudioInputHaiku.cpp',
+ '<(tgvoip_src_loc)/os/haiku/AudioInputHaiku.h',
+ '<(tgvoip_src_loc)/os/haiku/AudioOutputHaiku.cpp',
+ '<(tgvoip_src_loc)/os/haiku/AudioOutputHaiku.h',
+ '<(tgvoip_src_loc)/os/haiku/RingBuffer.cpp',
+ '<(tgvoip_src_loc)/os/haiku/RingBuffer.h',
+
# POSIX
'<(tgvoip_src_loc)/os/posix/NetworkSocketPosix.cpp',
'<(tgvoip_src_loc)/os/posix/NetworkSocketPosix.h',
@@ -735,6 +743,11 @@
'sources/': [['exclude', '<(tgvoip_src_loc)/os/posix/']],
},
],
+ [
+ '"<(OS)" != "haiku"', {
+ 'sources/': [['exclude', '<(tgvoip_src_loc)/os/haiku/']],
+ },
+ ],
[
'"<(OS)" != "mac"', {
'sources/': [['exclude', '<(tgvoip_src_loc)/os/darwin/']],
@@ -866,6 +879,22 @@
},
],
[
+ '"<(OS)" == "haiku"', {
+ 'defines': [
+ 'WEBRTC_POSIX',
+ 'WEBRTC_HAIKU',
+ ],
+ 'cflags_cc': [
+ '-msse2',
+ '-std=gnu++14',
+ ],
+ 'direct_dependent_settings': {
+ 'libraries': [
+
+ ],
+ },
+ },
+ ], [
'"<(OS)" == "linux"', {
'defines': [
'WEBRTC_POSIX',
diff --git a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/AudioInputHaiku.cpp b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/AudioInputHaiku.cpp
new file mode 100644
index 0000000..7cce3e3
--- /dev/null
+++ b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/AudioInputHaiku.cpp
@@ -0,0 +1,276 @@
+//
+// libtgvoip is free and unencumbered public domain software.
+// For more information, see http://unlicense.org or the UNLICENSE file
+// you should have received with this source code distribution.
+//
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+#include <dlfcn.h>
+#include "AudioInputHaiku.h"
+#include "../../logging.h"
+#include "../../audio/Resampler.h"
+#include "../../VoIPController.h"
+
+#include "RingBuffer.h"
+
+using namespace tgvoip::audio;
+
+void RecordData(void* cookie, bigtime_t timestamp, void* data, size_t size, const media_format &format)
+{
+ AudioInputHaiku *audioInput = (AudioInputHaiku*)cookie;
+ if (!audioInput->IsRecording())
+ return;
+
+ if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_SHORT &&
+ format.u.raw_audio.channel_count == 1) {
+ audioInput->fRingBuffer->Write((unsigned char*)data, size);
+ return;
+ }
+
+ uint32 bytesPerSample = 2;
+ switch (format.u.raw_audio.format) {
+ case media_raw_audio_format::B_AUDIO_CHAR:
+ bytesPerSample = 1;
+ break;
+ case media_raw_audio_format::B_AUDIO_SHORT:
+ bytesPerSample = 2;
+ break;
+ case media_raw_audio_format::B_AUDIO_INT:
+ bytesPerSample = 4;
+ break;
+ case media_raw_audio_format::B_AUDIO_FLOAT:
+ bytesPerSample = 4;
+ break;
+ default:
+ break;
+ }
+
+ int frames = size / (format.u.raw_audio.channel_count * bytesPerSample);
+ int16_t *dst = audioInput->workBuffer;
+
+ if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_CHAR) {
+ unsigned char* src=reinterpret_cast<unsigned char*>(data);
+ for (int n=0; n < frames; n++) {
+ int32_t value = 0;
+ for (int j=0; j < format.u.raw_audio.channel_count; j++, src++) {
+ value += ((int32_t)(*src) - INT8_MAX) * UINT8_MAX;
+ }
+ value /= format.u.raw_audio.channel_count;
+ dst[n] = (int16_t)value;
+ }
+ } else if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_SHORT) {
+ int16_t* src=reinterpret_cast<int16_t*>(data);
+ for (int n=0; n < frames; n++) {
+ int32_t value = 0;
+ for (int j=0; j < format.u.raw_audio.channel_count; j++, src++) {
+ value += *src;
+ }
+ value /= format.u.raw_audio.channel_count;
+ dst[n] = (int16_t)value;
+ }
+ } else if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_INT) {
+ int32_t* src=reinterpret_cast<int32_t*>(data);
+ for (int n=0; n < frames; n++) {
+ int64_t value = 0;
+ for (int j=0; j < format.u.raw_audio.channel_count; j++, src++) {
+ value += (int64_t)(*src);
+ }
+ value /= format.u.raw_audio.channel_count;
+ dst[n] = (int16_t)(value / (UINT16_MAX + 1));
+ }
+ } else if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_FLOAT) {
+ float* src=reinterpret_cast<float*>(data);
+ for (int n=0; n < frames; n++) {
+ float value = 0;
+ for (int j=0; j < format.u.raw_audio.channel_count; j++, src++) {
+ value += *src;
+ }
+ value /= format.u.raw_audio.channel_count;
+ dst[n] = (int16_t)(value*INT16_MAX);
+ }
+ }
+
+ if(format.u.raw_audio.frame_rate != audioInput->tgFrameRate) {
+ size_t len = tgvoip::audio::Resampler::Convert(dst, audioInput->convertBuffer,
+ frames, frames, audioInput->tgFrameRate, format.u.raw_audio.frame_rate) * audioInput->tgBytesPerSample;
+ audioInput->fRingBuffer->Write((unsigned char*)audioInput->convertBuffer, len);
+ } else {
+ audioInput->fRingBuffer->Write((unsigned char*)dst, frames * audioInput->tgBytesPerSample);
+ }
+}
+
+void NotifyRecordData(void * cookie, BMediaRecorder::notification code, ...)
+{
+ AudioInputHaiku *audioInput = (AudioInputHaiku*)cookie;
+ if (code == BMediaRecorder::B_WILL_STOP) {
+ if (audioInput->IsRecording()) {
+ audioInput->Stop();
+ }
+ }
+}
+
+AudioInputHaiku::AudioInputHaiku()
+{
+ fRecorder = NULL;
+ fRingBuffer = NULL;
+ isRecording = false;
+
+ tgFrameRate = 48000;
+ tgChannelsCount = 1;
+ tgBytesPerSample = 2;
+
+ status_t error;
+
+ fRoster = BMediaRoster::Roster(&error);
+ if (!fRoster) {
+ failed=true;
+ return;
+ }
+ error = fRoster->GetAudioInput(&fAudioInputNode);
+ if (error < B_OK) {
+ failed=true;
+ return;
+ }
+ error = fRoster->GetAudioMixer(&fAudioMixerNode);
+ if (error < B_OK) {
+ failed=true;
+ return;
+ }
+ fRecorder = new BMediaRecorder("Telegram", B_MEDIA_RAW_AUDIO);
+ if (fRecorder->InitCheck() < B_OK) {
+ failed=true;
+ return;
+ }
+ media_format output_format;
+ output_format.type = B_MEDIA_RAW_AUDIO;
+ output_format.u.raw_audio = media_raw_audio_format::wildcard;
+ output_format.u.raw_audio.channel_count = 1;
+ fRecorder->SetAcceptedFormat(output_format);
+
+ const int maxInputCount = 64;
+ dormant_node_info dni[maxInputCount];
+
+ int32 real_count = maxInputCount;
+
+ error = fRoster->GetDormantNodes(dni, &real_count, 0, &output_format, 0, B_BUFFER_PRODUCER | B_PHYSICAL_INPUT);
+ if (real_count > maxInputCount)
+ real_count = maxInputCount;
+ char selected_name[B_MEDIA_NAME_LENGTH] = "Default input";
+
+ for (int i = 0; i < real_count; i++) {
+ media_node_id ni[12];
+ int32 ni_count = 12;
+ error = fRoster->GetInstancesFor(dni[i].addon, dni[i].flavor_id, ni, &ni_count);
+ if (error == B_OK) {
+ for (int j = 0; j < ni_count; j++) {
+ if (ni[j] == fAudioInputNode.node) {
+ strcpy(selected_name, dni[i].name);
+ break;
+ }
+ }
+ }
+ }
+
+ media_output audioOutput;
+ if (!fRecorder->IsConnected()) {
+ int32 count = 0;
+ error = fRoster->GetFreeOutputsFor(fAudioInputNode, &audioOutput, 1, &count, B_MEDIA_RAW_AUDIO);
+ if (error < B_OK) {
+ failed=true;
+ return;
+ }
+
+ if (count < 1) {
+ failed=true;
+ return;
+ }
+ fRecordFormat.u.raw_audio = audioOutput.format.u.raw_audio;
+ } else {
+ fRecordFormat.u.raw_audio = fRecorder->AcceptedFormat().u.raw_audio;
+ }
+ fRecordFormat.type = B_MEDIA_RAW_AUDIO;
+
+ error = fRecorder->SetHooks(RecordData, NotifyRecordData, this);
+ if (error < B_OK) {
+ failed=true;
+ return;
+ }
+
+ if (!fRecorder->IsConnected()) {
+ error = fRecorder->Connect(fAudioInputNode, &audioOutput, &fRecordFormat);
+ if (error < B_OK) {
+ fRecorder->SetHooks(NULL, NULL, NULL);
+ failed=true;
+ return;
+ }
+ }
+
+ fRingBuffer = new RingBuffer(BUFFER_SIZE * 2 * 3);
+ if (fRingBuffer->InitCheck() != B_OK) {
+ failed=true;
+ return;
+ }
+}
+
+AudioInputHaiku::~AudioInputHaiku(){
+ if (fRecorder != NULL) {
+ if (fRecorder->InitCheck() == B_OK) {
+ if (fRecorder->IsConnected())
+ fRecorder->Disconnect();
+ }
+ delete fRecorder;
+ }
+ if (fRingBuffer != NULL)
+ delete fRingBuffer;
+}
+
+void AudioInputHaiku::Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels){
+ tgFrameRate = sampleRate;
+ tgChannelsCount = channels;
+ tgBytesPerSample = bitsPerSample / 8;
+}
+
+bool AudioInputHaiku::IsRecording(){
+ return isRecording;
+}
+
+void AudioInputHaiku::Start(){
+ if(failed || isRecording)
+ return;
+
+ isRecording=true;
+
+ thread = new Thread(std::bind(&AudioInputHaiku::RunThread, this));
+ thread->SetName("AudioInputHaiku");
+ thread->Start();
+
+ fRecorder->Start();
+}
+
+void AudioInputHaiku::Stop(){
+ if(!isRecording)
+ return;
+
+ isRecording=false;
+
+ fRecorder->Stop();
+
+ thread->Join();
+ delete thread;
+ thread=NULL;
+}
+
+void AudioInputHaiku::RunThread(){
+ unsigned char buffer[BUFFER_SIZE*2];
+ while (isRecording){
+ if (fRingBuffer->GetReadAvailable() >= sizeof(buffer)) {
+ int readed = fRingBuffer->Read(buffer, sizeof(buffer));
+ if (readed < sizeof(buffer))
+ memset(buffer + readed, 0, sizeof(buffer) - readed);
+ InvokeCallback(buffer, sizeof(buffer));
+ } else
+ snooze(100);
+ }
+}
diff --git a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/AudioInputHaiku.h b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/AudioInputHaiku.h
new file mode 100644
index 0000000..1c63afe
--- /dev/null
+++ b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/AudioInputHaiku.h
@@ -0,0 +1,66 @@
+//
+// libtgvoip is free and unencumbered public domain software.
+// For more information, see http://unlicense.org or the UNLICENSE file
+// you should have received with this source code distribution.
+//
+
+#ifndef LIBTGVOIP_AUDIOINPUTHAIKU_H
+#define LIBTGVOIP_AUDIOINPUTHAIKU_H
+
+#include "../../audio/AudioInput.h"
+#include "../../threading.h"
+
+#include <OS.h>
+#include <MediaFile.h>
+#include <MediaNode.h>
+#include <MediaRecorder.h>
+#include <MediaTrack.h>
+#include <MediaRoster.h>
+#include <TimeSource.h>
+#include <NodeInfo.h>
+#include <MediaAddOn.h>
+
+#include "RingBuffer.h"
+
+#define BUFFER_SIZE 960
+
+namespace tgvoip{
+namespace audio{
+
+class AudioInputHaiku : public AudioInput{
+
+public:
+ AudioInputHaiku();
+ virtual ~AudioInputHaiku();
+ virtual void Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels);
+ virtual void Start();
+ virtual void Stop();
+ virtual bool IsRecording();
+
+ RingBuffer *fRingBuffer;
+ int16_t workBuffer[BUFFER_SIZE * 64];
+ int16_t convertBuffer[BUFFER_SIZE * 64];
+
+ uint32 tgFrameRate;
+ uint32 tgChannelsCount;
+ uint32 tgBytesPerSample;
+
+private:
+ void RunThread();
+
+ bool isConfigured;
+ bool isRecording;
+
+ BMediaRoster * fRoster;
+ BMediaRecorder * fRecorder;
+ media_format fRecordFormat;
+ media_node fAudioInputNode;
+ media_node fAudioMixerNode;
+
+ Thread* thread;
+};
+
+}
+}
+
+#endif //LIBTGVOIP_AUDIOINPUTHAIKU_H
diff --git a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/AudioOutputHaiku.cpp b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/AudioOutputHaiku.cpp
new file mode 100644
index 0000000..3dc052c
--- /dev/null
+++ b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/AudioOutputHaiku.cpp
@@ -0,0 +1,98 @@
+//
+// libtgvoip is free and unencumbered public domain software.
+// For more information, see http://unlicense.org or the UNLICENSE file
+// you should have received with this source code distribution.
+//
+
+
+#include <assert.h>
+#include <dlfcn.h>
+#include "AudioOutputHaiku.h"
+#include "../../logging.h"
+#include "../../VoIPController.h"
+
+#define BUFFER_SIZE 960
+
+using namespace tgvoip::audio;
+
+static void playerProc(void *cookie, void *buffer, size_t len, const media_raw_audio_format &format)
+{
+ AudioOutputHaiku *obj = (AudioOutputHaiku*)cookie;
+ obj->InvokeCallback((unsigned char*)buffer, len);
+}
+
+
+AudioOutputHaiku::AudioOutputHaiku(){
+ soundPlayer = NULL;
+ isPlaying = false;
+ isConfigured = false;
+ return;
+}
+
+AudioOutputHaiku::~AudioOutputHaiku(){
+ if (isConfigured) {
+ if (soundPlayer != NULL) {
+ soundPlayer->Stop();
+ delete soundPlayer;
+ }
+ }
+}
+
+void AudioOutputHaiku::Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels){
+ media_raw_audio_format mediaKitFormat = {
+ (float)sampleRate,
+ (uint32)channels,
+ media_raw_audio_format::B_AUDIO_SHORT,
+ B_MEDIA_LITTLE_ENDIAN,
+ (uint32)BUFFER_SIZE * (bitsPerSample / 8) * channels
+ };
+
+ switch (bitsPerSample) {
+ case 8:
+ mediaKitFormat.format = media_raw_audio_format::B_AUDIO_CHAR;
+ break;
+ case 16:
+ mediaKitFormat.format = media_raw_audio_format::B_AUDIO_SHORT;
+ break;
+ case 32:
+ mediaKitFormat.format = media_raw_audio_format::B_AUDIO_INT;
+ break;
+ default:
+ mediaKitFormat.format = media_raw_audio_format::B_AUDIO_SHORT;
+ break;
+ }
+
+ soundPlayer = new BSoundPlayer(&mediaKitFormat, "Telegram", playerProc, NULL, (void*)this);
+
+ if(soundPlayer->InitCheck() != B_OK) {
+ delete soundPlayer;
+ soundPlayer = NULL;
+ isPlaying = false;
+ failed = true;
+ return;
+ }
+
+ isConfigured = true;
+}
+
+void AudioOutputHaiku::Start(){
+ if(soundPlayer == NULL || isPlaying)
+ return;
+
+ soundPlayer->Start();
+ soundPlayer->SetHasData(true);
+
+ isPlaying=true;
+}
+
+void AudioOutputHaiku::Stop(){
+ if(!isPlaying)
+ return;
+
+ soundPlayer->Stop();
+ isPlaying=false;
+}
+
+bool AudioOutputHaiku::IsPlaying(){
+ return isPlaying;
+}
diff --git a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/AudioOutputHaiku.h b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/AudioOutputHaiku.h
new file mode 100644
index 0000000..91f2521
--- /dev/null
+++ b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/AudioOutputHaiku.h
@@ -0,0 +1,35 @@
+//
+// libtgvoip is free and unencumbered public domain software.
+// For more information, see http://unlicense.org or the UNLICENSE file
+// you should have received with this source code distribution.
+//
+
+#ifndef LIBTGVOIP_AUDIOOUTPUTHAIKU_H
+#define LIBTGVOIP_AUDIOOUTPUTHAIKU_H
+
+#include "../../audio/AudioOutput.h"
+#include "../../threading.h"
+
+#include <SoundPlayer.h>
+
+namespace tgvoip{
+namespace audio{
+
+class AudioOutputHaiku : public AudioOutput{
+public:
+ AudioOutputHaiku();
+ virtual ~AudioOutputHaiku();
+ virtual void Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels);
+ virtual void Start();
+ virtual void Stop();
+ virtual bool IsPlaying() override;
+private:
+ bool isPlaying;
+ bool isConfigured;
+ BSoundPlayer *soundPlayer;
+};
+
+}
+}
+
+#endif //LIBTGVOIP_AUDIOOUTPUTHAIKU_H
diff --git a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/RingBuffer.cpp b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/RingBuffer.cpp
new file mode 100644
index 0000000..43236d3
--- /dev/null
+++ b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/RingBuffer.cpp
@@ -0,0 +1,130 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <OS.h>
+
+#include "RingBuffer.h"
+
+RingBuffer::RingBuffer( int size )
+{
+ initialized = false;
+ Buffer = new unsigned char[size];
+ if(Buffer!=NULL) {
+ memset( Buffer, 0, size );
+ BufferSize = size;
+ } else {
+ BufferSize = 0;
+ }
+ reader = 0;
+ writer = 0;
+ writeBytesAvailable = size;
+ if((locker=create_sem(1,"locker")) >= B_OK) {
+ initialized = true;
+ } else {
+ if(Buffer!=NULL) {
+ delete[] Buffer;
+ }
+ }
+}
+
+RingBuffer::~RingBuffer( )
+{
+ if(initialized) {
+ delete[] Buffer;
+ delete_sem(locker);
+ }
+}
+
+bool
+RingBuffer::Empty( void )
+{
+ memset( Buffer, 0, BufferSize );
+ reader = 0;
+ writer = 0;
+ writeBytesAvailable = BufferSize;
+ return true;
+}
+
+int
+RingBuffer::Read( unsigned char *data, int size )
+{
+ acquire_sem(locker);
+
+ if( data == 0 || size <= 0 || writeBytesAvailable == BufferSize ) {
+ release_sem(locker);
+ return 0;
+ }
+
+ int readBytesAvailable = BufferSize - writeBytesAvailable;
+
+ if( size > readBytesAvailable ) {
+ size = readBytesAvailable;
+ }
+
+ if(size > BufferSize - reader) {
+ int len = BufferSize - reader;
+ memcpy(data, Buffer + reader, len);
+ memcpy(data + len, Buffer, size-len);
+ } else {
+ memcpy(data, Buffer + reader, size);
+ }
+
+ reader = (reader + size) % BufferSize;
+ writeBytesAvailable += size;
+
+ release_sem(locker);
+ return size;
+}
+
+int
+RingBuffer::Write( unsigned char *data, int size )
+{
+ acquire_sem(locker);
+
+ if( data == 0 || size <= 0 || writeBytesAvailable == 0 ) {
+ release_sem(locker);
+ return 0;
+ }
+
+ if( size > writeBytesAvailable ) {
+ size = writeBytesAvailable;
+ }
+
+ if(size > BufferSize - writer) {
+ int len = BufferSize - writer;
+ memcpy(Buffer + writer, data, len);
+ memcpy(Buffer, data+len, size-len);
+ } else {
+ memcpy(Buffer + writer, data, size);
+ }
+
+ writer = (writer + size) % BufferSize;
+ writeBytesAvailable -= size;
+
+ release_sem(locker);
+ return size;
+}
+
+int
+RingBuffer::GetSize( void )
+{
+ return BufferSize;
+}
+
+int
+RingBuffer::GetWriteAvailable( void )
+{
+ return writeBytesAvailable;
+}
+
+int
+RingBuffer::GetReadAvailable( void )
+{
+ return BufferSize - writeBytesAvailable;
+}
+
+status_t
+RingBuffer::InitCheck( void )
+{
+ return initialized?B_OK:B_ERROR;
+}
diff --git a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/RingBuffer.h b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/RingBuffer.h
new file mode 100644
index 0000000..4715632
--- /dev/null
+++ b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/RingBuffer.h
@@ -0,0 +1,31 @@
+#ifndef __RING_BUFFER_H__
+#define __RING_BUFFER_H__
+
+#include <OS.h>
+
+class RingBuffer {
+
+public:
+ RingBuffer(int size);
+ ~RingBuffer();
+ int Read( unsigned char* dataPtr, int numBytes );
+ int Write( unsigned char *dataPtr, int numBytes );
+
+ bool Empty( void );
+ int GetSize( );
+ int GetWriteAvailable( );
+ int GetReadAvailable( );
+ status_t InitCheck( );
+private:
+ unsigned char *Buffer;
+ int BufferSize;
+ int reader;
+ int writer;
+ int writeBytesAvailable;
+
+ sem_id locker;
+
+ bool initialized;
+};
+
+#endif
diff --git a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/posix/NetworkSocketPosix.cpp b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/posix/NetworkSocketPosix.cpp
index 9eff048..5e28b0f 100644
--- a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/posix/NetworkSocketPosix.cpp
+++ b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/posix/NetworkSocketPosix.cpp
@@ -245,12 +245,13 @@ void NetworkSocketPosix::Open(){
}
int flag=0;
int res=setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &flag, sizeof(flag));
+#ifndef __HAIKU__
if(res<0){
LOGE("error enabling dual stack socket: %d / %s", errno, strerror(errno));
failed=true;
return;
}
-
+#endif
SetMaxPriority();
fcntl(fd, F_SETFL, O_NONBLOCK);
@@ -400,6 +401,8 @@ std::string NetworkSocketPosix::GetLocalInterfaceInfo(IPv4Address *v4addr, IPv6A
if(didAttach){
sharedJVM->DetachCurrentThread();
}
+#elif defined(__HAIKU__)
+ return name;
#else
struct ifaddrs* interfaces;
if(!getifaddrs(&interfaces)){
diff --git a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/threading.h b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/threading.h
old mode 100755
new mode 100644
index 9dc2554..fc68fd4
--- a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/threading.h
+++ b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/threading.h
@@ -9,7 +9,7 @@
#include <functional>
-#if defined(_POSIX_THREADS) || defined(_POSIX_VERSION) || defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))
+#if defined(_POSIX_THREADS) || defined(_POSIX_VERSION) || defined(__unix__) || defined(__unix) || defined(__HAIKU__) || (defined(__APPLE__) && defined(__MACH__))
#include <pthread.h>
#include <semaphore.h>
@@ -92,6 +92,7 @@ namespace tgvoip{
static void* ActualEntryPoint(void* arg){
Thread* self=reinterpret_cast<Thread*>(arg);
if(self->name){
+#ifndef __HAIKU__
#if !defined(__APPLE__) && !defined(__gnu_hurd__)
pthread_setname_np(self->thread, self->name);
#elif !defined(__gnu_hurd__)
@@ -100,6 +101,7 @@ namespace tgvoip{
DarwinSpecific::SetCurrentThreadPriority(DarwinSpecific::THREAD_PRIO_USER_INTERACTIVE);
}
#endif
+#endif //__HAIKU__
}
self->entry();
return NULL;
diff --git a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/webrtc_dsp/rtc_base/logging_webrtc.cc b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/webrtc_dsp/rtc_base/logging_webrtc.cc
old mode 100755
new mode 100644
index a8d1522..991241b
--- a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/webrtc_dsp/rtc_base/logging_webrtc.cc
+++ b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/webrtc_dsp/rtc_base/logging_webrtc.cc
@@ -28,6 +28,10 @@
static const int kMaxLogLineSize = 1024 - 60;
#endif // WEBRTC_MAC && !defined(WEBRTC_IOS) || WEBRTC_ANDROID
+#if defined(WEBRTC_HAIKU)
+#include <OS.h>
+#endif
+
#include <stdio.h>
#include <string.h>
#include <time.h>
@@ -120,7 +124,12 @@ LogMessage::LogMessage(const char* file,
if (thread_) {
PlatformThreadId id = CurrentThreadId();
+#if defined(WEBRTC_HAIKU)
+ thread_id tid = get_pthread_thread_id(id);
+ print_stream_ << "[" << tid << "] ";
+#else
print_stream_ << "[" << id << "] ";
+#endif
}
if (file != nullptr) {
diff --git a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/webrtc_dsp/rtc_base/platform_file.h b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/webrtc_dsp/rtc_base/platform_file.h
old mode 100755
new mode 100644
diff --git a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/webrtc_dsp/rtc_base/platform_thread_types.cc b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/webrtc_dsp/rtc_base/platform_thread_types.cc
index 70cf237..e48948e 100644
--- a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/webrtc_dsp/rtc_base/platform_thread_types.cc
+++ b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/webrtc_dsp/rtc_base/platform_thread_types.cc
@@ -20,6 +20,8 @@ namespace rtc {
PlatformThreadId CurrentThreadId() {
#if defined(WEBRTC_WIN)
return GetCurrentThreadId();
+#elif defined(WEBRTC_HAIKU)
+ return pthread_self();
#elif defined(WEBRTC_POSIX)
#if defined(WEBRTC_MAC) || defined(WEBRTC_IOS)
return pthread_mach_thread_np(pthread_self());
diff --git a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/webrtc_dsp/rtc_base/platform_thread_types.h b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/webrtc_dsp/rtc_base/platform_thread_types.h
index 0bc42eb..c87cde9 100644
--- a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/webrtc_dsp/rtc_base/platform_thread_types.h
+++ b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/webrtc_dsp/rtc_base/platform_thread_types.h
@@ -35,6 +35,9 @@ typedef DWORD PlatformThreadRef;
#elif defined(WEBRTC_FUCHSIA)
typedef zx_handle_t PlatformThreadId;
typedef zx_handle_t PlatformThreadRef;
+#elif defined(WEBRTC_HAIKU)
+typedef pthread_t PlatformThreadId;
+typedef pthread_t PlatformThreadRef;
#elif defined(WEBRTC_POSIX)
typedef pid_t PlatformThreadId;
typedef pthread_t PlatformThreadRef;
--
2.19.1
From 46e431a59fcb445f3f164b55a41ccfb05843a337 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Thu, 31 Jan 2019 13:54:24 +1000
Subject: Configure output device
diff --git a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/AudioOutputHaiku.cpp b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/AudioOutputHaiku.cpp
index 3dc052c..2fca8a1 100644
--- a/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/AudioOutputHaiku.cpp
+++ b/libtgvoip-59a975bf66c19ebddd8c82d9d501fddc02584d7c/os/haiku/AudioOutputHaiku.cpp
@@ -26,6 +26,7 @@ AudioOutputHaiku::AudioOutputHaiku(){
soundPlayer = NULL;
isPlaying = false;
isConfigured = false;
+ Configure(48000, 16, 1);
return;
}
--
2.19.1

View File

@@ -0,0 +1,565 @@
From 42b5d5eb9eda6a1efd5c7111d0bea81a337b125b Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 1 Feb 2019 16:36:35 +1000
Subject: Use system Qt
diff --git a/Telegram/Resources/qrc/telegram_linux.qrc b/Telegram/Resources/qrc/telegram_linux.qrc
index 164e8d4..12319be 100644
--- a/Telegram/Resources/qrc/telegram_linux.qrc
+++ b/Telegram/Resources/qrc/telegram_linux.qrc
@@ -1,6 +1,5 @@
<RCC>
<qresource prefix="/qt">
- <file alias="etc/qt.conf">../etc/qt_linux.conf</file>
</qresource>
<qresource prefix="/fc">
<file alias="fc-custom.conf">../fc-custom.conf</file>
diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp
index 1294075..faf45cd 100644
--- a/Telegram/SourceFiles/core/launcher.cpp
+++ b/Telegram/SourceFiles/core/launcher.cpp
@@ -228,6 +228,13 @@ int Launcher::exec() {
Logs::start(this); // must be started before Platform is started
Platform::start(); // must be started before Sandbox is created
+ // I don't know why path is not in QT_PLUGIN_PATH by default
+ QCoreApplication::addLibraryPath("/usr/lib/qt/plugins");
+ // without this Telegram doesn't start on Ubuntu 17.04 due GTK errors
+ setenv("QT_STYLE_OVERRIDE", "qwerty", false);
+ // Telegram doesn't start when extraordinary theme is set, see launchpad.net/bugs/1680943
+ unsetenv("QT_QPA_PLATFORMTHEME");
+
auto result = executeApplication();
DEBUG_LOG(("Telegram finished, result: %1").arg(result));
diff --git a/Telegram/SourceFiles/platform/linux/linux_libs.h b/Telegram/SourceFiles/platform/linux/linux_libs.h
index 4834fee..2e60a65 100644
--- a/Telegram/SourceFiles/platform/linux/linux_libs.h
+++ b/Telegram/SourceFiles/platform/linux/linux_libs.h
@@ -21,7 +21,7 @@ extern "C" {
} // extern "C"
#ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION
-#include <unity/unity/unity.h>
+typedef void UnityLauncherEntry;
#endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
diff --git a/Telegram/SourceFiles/qt_functions.cpp b/Telegram/SourceFiles/qt_functions.cpp
new file mode 100644
index 0000000..4a722b8
--- /dev/null
+++ b/Telegram/SourceFiles/qt_functions.cpp
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file contains some parts of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/* TODO: find a dynamic library with these symbols. */
+
+/* Debian maintainer: this function is taken from qfiledialog.cpp */
+/*
+ Makes a list of filters from ;;-separated text.
+ Used by the mac and windows implementations
+*/
+QStringList qt_make_filter_list(const QString &filter)
+{
+ QString f(filter);
+
+ if (f.isEmpty())
+ return QStringList();
+
+ QString sep(QLatin1String(";;"));
+ int i = f.indexOf(sep, 0);
+ if (i == -1) {
+ if (f.indexOf(QLatin1Char('\n'), 0) != -1) {
+ sep = QLatin1Char('\n');
+ i = f.indexOf(sep, 0);
+ }
+ }
+
+ return f.split(sep);
+}
+
+/* Debian maintainer: this constructor is taken from qtextengine.cpp for TextPainter::drawLine */
+QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe, const QTextCharFormat &format)
+ : flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline), charFormat(format),
+ num_chars(numChars), chars(chars_), logClusters(0), f(font), glyphs(g), fontEngine(fe)
+{
+}
+
+/* Debian maintainer: this method is also taken from qtextengine.cpp */
+// Fix up flags and underlineStyle with given info
+void QTextItemInt::initWithScriptItem(const QScriptItem &si)
+{
+ // explicitly initialize flags so that initFontAttributes can be called
+ // multiple times on the same TextItem
+ flags = 0;
+ if (si.analysis.bidiLevel %2)
+ flags |= QTextItem::RightToLeft;
+ ascent = si.ascent;
+ descent = si.descent;
+
+ if (charFormat.hasProperty(QTextFormat::TextUnderlineStyle)) {
+ underlineStyle = charFormat.underlineStyle();
+ } else if (charFormat.boolProperty(QTextFormat::FontUnderline)
+ || f->d->underline) {
+ underlineStyle = QTextCharFormat::SingleUnderline;
+ }
+
+ // compat
+ if (underlineStyle == QTextCharFormat::SingleUnderline)
+ flags |= QTextItem::Underline;
+
+ if (f->d->overline || charFormat.fontOverline())
+ flags |= QTextItem::Overline;
+ if (f->d->strikeOut || charFormat.fontStrikeOut())
+ flags |= QTextItem::StrikeOut;
+}
diff --git a/Telegram/SourceFiles/qt_static_plugins.cpp b/Telegram/SourceFiles/qt_static_plugins.cpp
index a757d08..122ff0f 100644
--- a/Telegram/SourceFiles/qt_static_plugins.cpp
+++ b/Telegram/SourceFiles/qt_static_plugins.cpp
@@ -15,14 +15,4 @@ Q_IMPORT_PLUGIN(QWebpPlugin)
Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)
Q_IMPORT_PLUGIN(QGenericEnginePlugin)
#elif defined Q_OS_LINUX // Q_OS_WIN | Q_OS_MAC
-Q_IMPORT_PLUGIN(QWebpPlugin)
-Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
-Q_IMPORT_PLUGIN(QConnmanEnginePlugin)
-Q_IMPORT_PLUGIN(QGenericEnginePlugin)
-Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin)
-Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin)
-Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin)
-Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin)
-Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin)
-Q_IMPORT_PLUGIN(NimfInputContextPlugin)
#endif // Q_OS_WIN | Q_OS_MAC | Q_OS_LINUX
diff --git a/Telegram/SourceFiles/ui/text/text.cpp b/Telegram/SourceFiles/ui/text/text.cpp
index bc4d3d5..370e5fe 100644
--- a/Telegram/SourceFiles/ui/text/text.cpp
+++ b/Telegram/SourceFiles/ui/text/text.cpp
@@ -1760,11 +1760,11 @@ private:
if (item == -1)
return;
-#ifdef OS_MAC_OLD
+#if defined(OS_MAC_OLD) || QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
auto end = _e->findItem(line.from + line.length - 1);
-#else // OS_MAC_OLD
+#else
auto end = _e->findItem(line.from + line.length - 1, item);
-#endif // OS_MAC_OLD
+#endif
auto blockIndex = _lineStartBlock;
auto currentBlock = _t->_blocks[blockIndex].get();
diff --git a/Telegram/SourceFiles/ui/text/text_block.cpp b/Telegram/SourceFiles/ui/text/text_block.cpp
index 2959cec..04ad006 100644
--- a/Telegram/SourceFiles/ui/text/text_block.cpp
+++ b/Telegram/SourceFiles/ui/text/text_block.cpp
@@ -332,6 +332,9 @@ TextBlock::TextBlock(const style::font &font, const QString &str, QFixed minResi
QStackTextEngine engine(part, blockFont->f);
BlockParser parser(&engine, this, minResizeWidth, _from, part);
+ QTextLayout layout(part, blockFont->f);
+ layout.beginLayout();
+ layout.createLine();
CrashReports::ClearAnnotationRef("CrashString");
}
diff --git a/Telegram/SourceFiles/ui/twidget.cpp b/Telegram/SourceFiles/ui/twidget.cpp
index d105f78..9a6ad1a 100644
--- a/Telegram/SourceFiles/ui/twidget.cpp
+++ b/Telegram/SourceFiles/ui/twidget.cpp
@@ -249,9 +249,9 @@ void sendSynteticMouseEvent(QWidget *widget, QEvent::Type type, Qt::MouseButton
, button
, QGuiApplication::mouseButtons() | button
, QGuiApplication::keyboardModifiers()
-#ifndef OS_MAC_OLD
+#if !defined(OS_MAC_OLD) && QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
, Qt::MouseEventSynthesizedByApplication
-#endif // OS_MAC_OLD
+#endif
);
ev.setTimestamp(getms());
QGuiApplication::sendEvent(windowHandle, &ev);
diff --git a/Telegram/gyp/PrecompiledHeader.cmake b/Telegram/gyp/PrecompiledHeader.cmake
index a0e1e04..2231130 100644
--- a/Telegram/gyp/PrecompiledHeader.cmake
+++ b/Telegram/gyp/PrecompiledHeader.cmake
@@ -114,7 +114,7 @@ function(add_precompiled_header _target _input)
set(_compiler_FLAGS "@${_pch_c_flags_file}")
add_custom_command(
OUTPUT "${_output_c}"
- COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} -x c-header -o "${_output_c}" -c "${_pchfile}"
+ COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} "$(C_DEFINES)" "$(C_INCLUDES)" "$(C_FLAGS)" -x c-header -o "${_output_c}" -c "${_pchfile}"
DEPENDS "${_pchfile}" "${_pch_c_flags_file}"
IMPLICIT_DEPENDS C "${_pch_header}"
COMMENT "Precompiling ${_name} for ${_target} (C)")
@@ -125,7 +125,7 @@ function(add_precompiled_header _target _input)
set(_compiler_FLAGS "@${_pch_cpp_flags_file}")
add_custom_command(
OUTPUT "${_output_cxx}"
- COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} -x c++-header -o "${_output_cxx}" -c "${_pchfile}"
+ COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} "$(CXX_DEFINES)" "$(CXX_INCLUDES)" "$(CXX_FLAGS)" -x c++-header -o "${_output_cxx}" -c "${_pchfile}"
DEPENDS "${_pchfile}" "${_pch_cpp_flags_file}"
IMPLICIT_DEPENDS CXX "${_pch_header}"
COMMENT "Precompiling header ${_name} for ${_target} (C++)")
diff --git a/Telegram/gyp/Telegram.gyp b/Telegram/gyp/Telegram.gyp
index ac7696e..07193cf 100644
--- a/Telegram/gyp/Telegram.gyp
+++ b/Telegram/gyp/Telegram.gyp
@@ -75,7 +75,6 @@
'codegen.gyp:codegen_numbers',
'codegen.gyp:codegen_style',
'tests/tests.gyp:tests',
- 'utils.gyp:Updater',
'../ThirdParty/libtgvoip/libtgvoip.gyp:libtgvoip',
'crl.gyp:crl',
'lib_base.gyp:lib_base',
@@ -84,7 +83,6 @@
],
'defines': [
- 'AL_LIBTYPE_STATIC',
'AL_ALEXT_PROTOTYPES',
'TGVOIP_USE_CXX11_LIB',
'XXH_INLINE_ALL',
@@ -96,16 +94,8 @@
'include_dirs': [
'<(src_loc)',
'<(SHARED_INTERMEDIATE_DIR)',
- '<(libs_loc)/breakpad/src',
- '<(libs_loc)/lzma/C',
- '<(libs_loc)/zlib',
- '<(libs_loc)/ffmpeg',
- '<(libs_loc)/openal-soft/include',
- '<(libs_loc)/opus/include',
- '<(libs_loc)/range-v3/include',
- '<(minizip_loc)',
- '<(sp_media_key_tap_loc)',
'<(emoji_suggestions_loc)',
+ '/usr/include/minizip',
'<(submodules_loc)/GSL/include',
'<(submodules_loc)/variant/include',
'<(submodules_loc)/crl/src',
diff --git a/Telegram/gyp/qt.gypi b/Telegram/gyp/qt.gypi
index 0b783ec..3f91776 100644
--- a/Telegram/gyp/qt.gypi
+++ b/Telegram/gyp/qt.gypi
@@ -14,25 +14,21 @@
[ 'build_macold', {
'qt_version%': '5.3.2',
}, {
- 'qt_version%': '5.6.2',
+ 'qt_version%': '<!(echo /usr/include/qt/QtCore/*/ | grep -Po "\d+\.\d+\.\d+")',
}]
],
},
'qt_libs': [
- 'qwebp',
- 'Qt5PrintSupport',
- 'Qt5PlatformSupport',
'Qt5Network',
'Qt5Widgets',
'Qt5Gui',
- 'qtharfbuzzng',
],
'qt_version%': '<(qt_version)',
'conditions': [
[ 'build_macold', {
'linux_path_qt%': '/usr/local/macold/Qt-<(qt_version)',
}, {
- 'linux_path_qt%': '/usr/local/tdesktop/Qt-<(qt_version)',
+ 'linux_path_qt%': '/usr/lib/qt',
}]
]
},
@@ -72,32 +68,13 @@
],
}],
[ 'build_linux', {
- 'qt_lib_prefix': 'lib',
- 'qt_lib_debug_postfix': '.a',
- 'qt_lib_release_postfix': '.a',
+ 'qt_lib_prefix': '',
+ 'qt_lib_debug_postfix': '',
+ 'qt_lib_release_postfix': '',
'qt_libs': [
- 'qxcb',
- 'Qt5XcbQpa',
- 'qconnmanbearer',
- 'qgenericbearer',
- 'qnmbearer',
'<@(qt_libs)',
'Qt5DBus',
'Qt5Core',
- 'qtpcre',
- 'Xi',
- 'Xext',
- 'Xfixes',
- 'SM',
- 'ICE',
- 'fontconfig',
- 'expat',
- 'freetype',
- 'z',
- 'xcb-shm',
- 'xcb-xfixes',
- 'xcb-render',
- 'xcb-static',
],
}],
],
@@ -127,11 +104,6 @@
# '<!@(python <(DEPTH)/list_sources.py [sources] <(qt_moc_list_sources_arg))'
# where [sources] contains all your source files
'qt_moc_list_sources_arg': '--moc-prefix SHARED_INTERMEDIATE_DIR/<(_target_name)/moc/moc_',
-
- 'linux_path_xkbcommon%': '/usr/local',
- 'linux_lib_ssl%': '/usr/local/ssl/lib/libssl.a',
- 'linux_lib_crypto%': '/usr/local/ssl/lib/libcrypto.a',
- 'linux_lib_icu%': 'libicutu.a libicui18n.a libicuuc.a libicudata.a',
},
'configurations': {
@@ -180,14 +152,14 @@
},
'include_dirs': [
- '<(qt_loc)/include',
- '<(qt_loc)/include/QtCore',
- '<(qt_loc)/include/QtGui',
- '<(qt_loc)/include/QtDBus',
- '<(qt_loc)/include/QtCore/<(qt_version)',
- '<(qt_loc)/include/QtGui/<(qt_version)',
- '<(qt_loc)/include/QtCore/<(qt_version)/QtCore',
- '<(qt_loc)/include/QtGui/<(qt_version)/QtGui',
+ '/usr/include/qt',
+ '/usr/include/qt/QtCore',
+ '/usr/include/qt/QtGui',
+ '/usr/include/qt/QtDBus',
+ '/usr/include/qt/QtCore/<(qt_version)',
+ '/usr/include/qt/QtGui/<(qt_version)',
+ '/usr/include/qt/QtCore/<(qt_version)/QtCore',
+ '/usr/include/qt/QtGui/<(qt_version)/QtGui',
],
'library_dirs': [
'<(qt_loc)/lib',
@@ -212,17 +184,10 @@
],
'libraries': [
'<(PRODUCT_DIR)/obj.target/liblinux_glibc_wraps.a',
- '<(linux_path_xkbcommon)/lib/libxkbcommon.a',
'<@(qt_libs_release)',
- '<(linux_lib_ssl)',
- '<(linux_lib_crypto)',
- '<!@(python -c "for s in \'<(linux_lib_icu)\'.split(\' \'): print(s)")',
- '-lxcb',
+ '-lcrypto',
'-lX11',
- '-lX11-xcb',
- '-ldbus-1',
'-ldl',
- '-lgthread-2.0',
'-lglib-2.0',
'-lpthread',
],
@@ -230,7 +195,6 @@
'<(qt_loc)/mkspecs/linux-g++',
],
'ldflags': [
- '-static-libstdc++',
'-pthread',
'-rdynamic',
],
diff --git a/Telegram/gyp/qt_moc.gypi b/Telegram/gyp/qt_moc.gypi
index 464d3c8..f350da8 100644
--- a/Telegram/gyp/qt_moc.gypi
+++ b/Telegram/gyp/qt_moc.gypi
@@ -12,7 +12,7 @@
'<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/moc/moc_<(RULE_INPUT_ROOT).cpp',
],
'action': [
- '<(qt_loc)/bin/moc<(exe_ext)',
+ '/usr/bin/moc',
# Silence "Note: No relevant classes found. No output generated."
'--no-notes',
diff --git a/Telegram/gyp/qt_rcc.gypi b/Telegram/gyp/qt_rcc.gypi
index f5624a8..1129a95 100644
--- a/Telegram/gyp/qt_rcc.gypi
+++ b/Telegram/gyp/qt_rcc.gypi
@@ -15,7 +15,7 @@
'<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/qrc/qrc_<(RULE_INPUT_ROOT).cpp',
],
'action': [
- '<(qt_loc)/bin/rcc<(exe_ext)',
+ '/usr/bin/rcc',
'-name', '<(RULE_INPUT_ROOT)',
'-no-compress',
'<(RULE_INPUT_PATH)',
diff --git a/Telegram/gyp/settings_linux.gypi b/Telegram/gyp/settings_linux.gypi
index 17219fa..b00fd50 100644
--- a/Telegram/gyp/settings_linux.gypi
+++ b/Telegram/gyp/settings_linux.gypi
@@ -11,7 +11,6 @@
'linux_common_flags': [
'-pipe',
'-Wall',
- '-Werror',
'-W',
'-fPIC',
'-Wno-unused-variable',
@@ -43,7 +42,7 @@
'sources': [ '__Wrong_Official_Build_Target_<(official_build_target)_' ],
}],
],
- }], [ '"<!(uname -p)" == "x86_64"', {
+ }], [ '"<!(uname -m)" == "x86_64"', {
# 32 bit version can't be linked with debug info or LTO,
# virtual memory exhausted :(
'cflags_c': [ '-g' ],
@@ -60,7 +59,6 @@
],
'defines': [
'_REENTRANT',
- 'QT_STATICPLUGIN',
'QT_PLUGIN',
],
'cflags_c': [
diff --git a/Telegram/gyp/telegram_linux.gypi b/Telegram/gyp/telegram_linux.gypi
index ffe0e5a..82316d1 100644
--- a/Telegram/gyp/telegram_linux.gypi
+++ b/Telegram/gyp/telegram_linux.gypi
@@ -23,10 +23,11 @@
'linux_path_va%': '/usr/local',
'linux_path_vdpau%': '/usr/local',
'linux_path_breakpad%': '/usr/local',
- 'linux_path_opus_include%': '<(libs_loc)/opus/include',
+ 'linux_path_opus_include%': '/usr/include/opus',
'linux_path_range%': '/usr/local',
},
'include_dirs': [
+ '/usr/include/openssl',
'/usr/local/include',
'<(linux_path_ffmpeg)/include',
'<(linux_path_openal)/include',
@@ -35,6 +36,7 @@
'<(linux_path_range)/include',
],
'library_dirs': [
+ '/usr/lib/openssl',
'/usr/local/lib',
'<(linux_path_ffmpeg)/lib',
'<(linux_path_openal)/lib',
@@ -43,26 +45,16 @@
'<(linux_path_breakpad)/lib',
],
'libraries': [
- 'breakpad_client',
- 'composeplatforminputcontextplugin',
- 'ibusplatforminputcontextplugin',
- 'fcitxplatforminputcontextplugin',
- 'himeplatforminputcontextplugin',
- 'nimfplatforminputcontextplugin',
- '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',
+ 'openal',
+ 'avformat',
+ 'avcodec',
+ 'swresample',
+ 'swscale',
+ 'avutil',
+ 'minizip',
+ 'opus',
+ 'z',
+ 'lzma',
# '<!(pkg-config 2> /dev/null --libs <@(pkgconfig_libs))',
],
'cflags_cc': [
@@ -91,15 +83,14 @@
},
},
'conditions': [
- [ '"<!(uname -p)" != "x86_64"', {
+ [ '"<!(uname -m)" != "x86_64"', {
'ldflags': [
'-Wl,-wrap,__divmoddi4',
],
}], ['not_need_gtk!="True"', {
'cflags_cc': [
- '<!(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 2> /dev/null --cflags appindicator3-0.1)',
+ '<!(pkg-config 2> /dev/null --cflags gtk+-3.0)',
],
}], ['<!(pkg-config ayatana-appindicator3-0.1; echo $?) == 0', {
'cflags_cc': [ '<!(pkg-config --cflags ayatana-appindicator3-0.1)' ],
diff --git a/Telegram/gyp/telegram_sources.txt b/Telegram/gyp/telegram_sources.txt
index a914a0a..0e49bec 100644
--- a/Telegram/gyp/telegram_sources.txt
+++ b/Telegram/gyp/telegram_sources.txt
@@ -830,14 +830,7 @@
<(emoji_suggestions_loc)/emoji_suggestions.cpp
<(emoji_suggestions_loc)/emoji_suggestions.h
-platforms: !win
-<(minizip_loc)/crypt.h
-<(minizip_loc)/ioapi.c
-<(minizip_loc)/ioapi.h
-<(minizip_loc)/zip.c
-<(minizip_loc)/zip.h
-<(minizip_loc)/unzip.c
-<(minizip_loc)/unzip.h
+<(src_loc)/qt_functions.cpp
platforms: win
<(res_loc)/winrc/Telegram.rc
--
2.19.1

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,175 @@
SUMMARY="Telegram Desktop Messenger"
DESCRIPTION="Official desktop version of Telegram messaging app."
HOMEPAGE="https://www.telegram.org/"
COPYRIGHT="2013-2019 Telegram"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/telegramdesktop/tdesktop/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="9f38732e9e90bbe94fc43a6b6502a5da322782001b9d19c56551856ded84025b"
SOURCE_FILENAME="tdesktop-$portVersion.tar.gz"
SOURCE_DIR="tdesktop-$portVersion"
srcGitRev_2="59a975bf66c19ebddd8c82d9d501fddc02584d7c"
SOURCE_URI_2="https://github.com/telegramdesktop/libtgvoip/archive/$srcGitRev_2.tar.gz"
CHECKSUM_SHA256_2="def54b1aa4f9e0fcd8d1134eec8a86cbe804247ed9270cb479ceee5adc05383a"
SOURCE_FILENAME_2="libtgvoip-$srcGitRev_2.tar.gz"
srcGitRev_3="550ac2f159ca883d360c196149b466955c77a573"
SOURCE_URI_3="https://github.com/mapbox/variant/archive/$srcGitRev_3.tar.gz"
CHECKSUM_SHA256_3="aa794dfefe0a90501587e36d977b958d0df888503117a8d9aa43dc14f8526d9d"
SOURCE_FILENAME_3="variant-$srcGitRev_3.tar.gz"
srcGitRev_4="d846fe50a3f0bb7767c7e087a05f4be95f4da0ec"
SOURCE_URI_4="https://github.com/Microsoft/GSL/archive/$srcGitRev_4.tar.gz"
CHECKSUM_SHA256_4="be81db4ab1b57102a0fa1cd0c4a6469294eb9daf24294347592245b754f65ff6"
SOURCE_FILENAME_4="GSL-$srcGitRev_4.tar.gz"
srcGitRev_5="5ca44b68721833ae3731802ed99af67c6f38a53a"
SOURCE_URI_5="https://github.com/philsquared/Catch/archive/$srcGitRev_5.tar.gz"
CHECKSUM_SHA256_5="d24e6d9df2b8aa5739d3b9077c6b0ff0ef4d5ef8acc52c3a57e32893854d8d18"
SOURCE_FILENAME_5="Catch-$srcGitRev_5.tar.gz"
srcGitRev_6="9b7c6b5d9f1b59d2160bf6e9c4e74510f955efe1"
SOURCE_URI_6="https://github.com/telegramdesktop/crl/archive/$srcGitRev_6.tar.gz"
CHECKSUM_SHA256_6="e605df0dc5d27066e8856b089a308f353c5e71ea7aa6cb102e50a64c7103ff8d"
SOURCE_FILENAME_6="crl-$srcGitRev_6.tar.gz"
srcGitRev_7="4b10be9cbadd7d0880437f48f875185589fd86d3"
SOURCE_URI_7="https://github.com/ericniebler/range-v3/archive/$srcGitRev_7.tar.gz"
CHECKSUM_SHA256_7="86f6b8a2e2d8196d62312042af1953d0b16935550130a73ae0ec69f623b0b947"
SOURCE_FILENAME_7="range-$srcGitRev_7.tar.gz"
srcGitRev_8="7cc9639699f64b750c0b82333dced9ea77e8436e"
SOURCE_URI_8="https://github.com/Cyan4973/xxHash/archive/$srcGitRev_8.tar.gz"
CHECKSUM_SHA256_8="0d1e2b4ae15f98acc49084e23ba94853dba2b0f654865ecedb1072b3959421bf"
SOURCE_FILENAME_8="xxHash-$srcGitRev_8.tar.gz"
PATCHES="
telegram_desktop-$portVersion-systemqt.patch
telegram_desktop-$portVersion.patchset
"
PATCHES_2="
telegram_desktop-$portVersion-libtgvoip.patchset
"
ADDITIONAL_FILES="
telegram_desktop.rdef.in
logo_256_no_margin.png
"
ARCHITECTURES="!x86_gcc2 !x86_64"
SECONDARY_ARCHITECTURES="!x86"
PROVIDES="
telegram_desktop$secondaryArchSuffix = $portVersion
app:Telegram$secondaryArchSuffix
cmd:tg_notify_gate
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libavcodec$secondaryArchSuffix
lib:libavformat$secondaryArchSuffix
lib:libavutil$secondaryArchSuffix
lib:libcrypto$secondaryArchSuffix
lib:libglib_2.0$secondaryArchSuffix
lib:libgthread_2.0$secondaryArchSuffix
lib:liblzma$secondaryArchSuffix
lib:libminizip$secondaryArchSuffix
lib:libopenal$secondaryArchSuffix
lib:libopus$secondaryArchSuffix
lib:libQt5Core$secondaryArchSuffix
lib:libQt5Gui$secondaryArchSuffix
lib:libQt5Network$secondaryArchSuffix
lib:libQt5Widgets$secondaryArchSuffix
lib:libswresample$secondaryArchSuffix
lib:libswscale$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libavcodec$secondaryArchSuffix
devel:libavformat$secondaryArchSuffix
devel:libavutil$secondaryArchSuffix
devel:libcrypto$secondaryArchSuffix
devel:libglib_2.0$secondaryArchSuffix
devel:libgthread_2.0$secondaryArchSuffix
devel:liblzma$secondaryArchSuffix
devel:libminizip$secondaryArchSuffix
devel:libopenal$secondaryArchSuffix
devel:libopus$secondaryArchSuffix
devel:libQt5Core$secondaryArchSuffix
devel:libQt5Gui$secondaryArchSuffix
devel:libQt5Network$secondaryArchSuffix
devel:libQt5Widgets$secondaryArchSuffix
devel:libswresample$secondaryArchSuffix
devel:libswscale$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:gyp
cmd:make
cmd:pkg_config$secondaryArchSuffix
"
PATCH()
{
sed -i "s|@HAIKU_HEADERS@|/system/$relativeIncludeDir|" Telegram/gyp/telegram_haiku.gypi
sed -i "s|@HAIKU_HEADERS@|/system/$relativeIncludeDir|" Telegram/gyp/qt.gypi
sed -i "s|@HAIKU_LIBS@|/system/$relativeLibDir|" Telegram/gyp/telegram_haiku.gypi
cp -f $sourceDir/../../../additional-files/logo_256_no_margin.png Telegram/Resources/art
if [ -f $sourceDir/../../../additional-files/apikey.txt ]; then
echo "*********************************************************************"
echo "* INFO: additional-files/apikey.txt file found, use custom api key. *"
echo "*********************************************************************"
cp -f $sourceDir/../../../additional-files/apikey.txt Telegram/gyp/apikey.txt
else
echo "**************************************************************************"
echo "* WARNING: additional-files/apikey.txt file not found, use demo api key. *"
echo "**************************************************************************"
cp -f $sourceDir/../../../additional-files/demo_apikey.txt Telegram/gyp/apikey.txt
fi
}
BUILD()
{
# link submodules
rm -rf Telegram/ThirdParty/{libtgvoip,variant,GSL,Catch,crl,range,xxHash}
ln -sfn $sourceDir2/libtgvoip-$srcGitRev_2 Telegram/ThirdParty/libtgvoip
ln -sfn $sourceDir3/variant-$srcGitRev_3 Telegram/ThirdParty/variant
ln -sfn $sourceDir4/GSL-$srcGitRev_4 Telegram/ThirdParty/GSL
ln -sfn $sourceDir5/Catch2-$srcGitRev_5 Telegram/ThirdParty/Catch
ln -sfn $sourceDir6/crl-$srcGitRev_6 Telegram/ThirdParty/crl
ln -sfn $sourceDir7/range-v3-$srcGitRev_7 Telegram/ThirdParty/range
ln -sfn $sourceDir8/xxHash-$srcGitRev_8 Telegram/ThirdParty/xxHash
Telegram/gyp/refresh.sh `cat Telegram/gyp/apikey.txt`
cd out/Release
# multi-job takes too much memory
make
#build notify gate tool
gcc -o tg-notify-gate $sourceDir/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.cpp -lbe
rc -o tg-notify-gate.rsrc $sourceDir/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.rdef
xres -o tg-notify-gate tg-notify-gate.rsrc
mimeset --all tg-notify-gate
}
INSTALL()
{
mkdir -p $appsDir $prefix/bin
cp out/Release/tg-notify-gate $prefix/bin
cp out/Release/Telegram $appsDir
strip $appsDir/Telegram
local APP_SIGNATURE="application/x-vnd.telegram"
local MAJOR="`echo "$portVersion" | cut -d. -f1`"
local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
local MINOR="`echo "$portVersion" | cut -d. -f3`"
local LONG_INFO="$SUMMARY"
sed \
-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
-e "s|@MAJOR@|$MAJOR|" \
-e "s|@MIDDLE@|$MIDDLE|" \
-e "s|@MINOR@|$MINOR|" \
-e "s|@LONG_INFO@|$LONG_INFO|" \
$portDir/additional-files/telegram_desktop.rdef.in > telegram_desktop.rdef
addResourcesToBinaries telegram_desktop.rdef $appsDir/Telegram
addAppDeskbarSymlink $appsDir/Telegram
}