Moving to Qt 5.6.0, instructions can be broken.

This commit is contained in:
John Preston 2016-04-23 14:40:42 +03:00
parent 4aa1f1334c
commit 2834ce0344
18 changed files with 413 additions and 339 deletions

View File

@ -19,21 +19,22 @@ downloadLibs() {
# Download libraries
info_msg "QT-Version: ${_qtver}, SRC-Dir: ${srcdir}"
echo -e "\nDownload and extract qt"
qt_file=qt-everywhere-opensource-src-$_qtver.tar.xz
echo -e "QT-File: ${qt_file}"
echo -e "Clone Qt\n"
git clone git://code.qt.io/qt/qt5.git qt5_6_0
cd qt5_6_0
git checkout 5.6
perl init-repository --module-subset=qtbase,qtimageformats
git checkout v5.6.0
cd qtbase && git checkout v5.6.0 && cd ..
cd qtimageformats && git checkout v5.6.0 && cd ..
wget "http://download.qt.io/official_releases/qt/${_qtver%.*}/$_qtver/single/$qt_file"
tar xf $qt_file
rm $qt_file
echo -e "Clone Breakpad"
echo -e "Clone Breakpad\n"
git clone https://chromium.googlesource.com/breakpad/breakpad breakpad
echo -e "\nClone Linux Syscall Support"
echo -e "Clone Linux Syscall Support\n"
git clone https://chromium.googlesource.com/linux-syscall-support breakpad-lss
echo -e "\nLets view the folder content"
echo -e "Lets view the folder content\n"
ls
travis_fold_end "download_libs"
}
@ -46,13 +47,9 @@ prepare() {
mkdir -p "$srcdir/Libraries"
local qt_patch_file="$srcdir/tdesktop/Telegram/_qtbase_${_qtver//./_}_patch.diff"
if [ "$qt_patch_file" -nt "$srcdir/Libraries/QtStatic" ]; then
rm -rf "$srcdir/Libraries/QtStatic"
mv "$srcdir/qt-everywhere-opensource-src-$_qtver" "$srcdir/Libraries/QtStatic"
cd "$srcdir/Libraries/QtStatic/qtbase"
patch -p1 -i "$qt_patch_file"
fi
ln -s "$srcdir/qt5_6_0" "$srcdir/Libraries/qt5_6_0"
cd "$srcdir/Libraries/qt5_6_0/qtbase"
git apply "$srcdir/tdesktop/Telegram/_qtbase_5_6_0_patch.diff"
if [ ! -h "$srcdir/Libraries/breakpad" ]; then
ln -s "$srcdir/breakpad" "$srcdir/Libraries/breakpad"
@ -64,7 +61,7 @@ prepare() {
sed -i 's,LIBS += /usr/local/lib/libz.a,LIBS += -lz,g' "$srcdir/tdesktop/Telegram/Telegram.pro"
local options=""
if [[ $BUILD_VERSION == *"disable_autoupdate"* ]]; then
options+="\nDEFINES += TDESKTOP_DISABLE_AUTOUPDATE"
fi
@ -85,9 +82,9 @@ prepare() {
options+='\nINCLUDEPATH += "/usr/lib/gtk-2.0/include"'
options+='\nINCLUDEPATH += "/usr/include/opus"'
options+='\nLIBS += -lcrypto -lssl'
info_msg "Build options: ${options}"
echo -e "${options}" >> "$srcdir/tdesktop/Telegram/Telegram.pro"
success_msg "Prepare done! :)"
@ -99,12 +96,12 @@ build() {
info_msg "Build patched Qt"
# Build patched Qt
cd "$srcdir/Libraries/QtStatic"
cd "$srcdir/Libraries/qt5_6_0"
./configure -prefix "$srcdir/qt" -release -opensource -confirm-license -qt-zlib \
-qt-libpng -qt-libjpeg -qt-freetype -qt-harfbuzz -qt-pcre -qt-xcb \
-qt-xkbcommon-x11 -no-opengl -static -nomake examples -nomake tests
make --silent module-qtbase module-qtimageformats
make --silent module-qtbase-install_subtargets module-qtimageformats-install_subtargets
make --silent
make --silent install
export PATH="$srcdir/qt/bin:$PATH"
@ -114,19 +111,19 @@ build() {
./configure
make --silent
info_msg "Build codegen_style"
# Build codegen_style
mkdir -p "$srcdir/tdesktop/Linux/obj/codegen_style/Debug"
cd "$srcdir/tdesktop/Linux/obj/codegen_style/Debug"
qmake CONFIG+=debug "../../../../Telegram/build/qmake/codegen_style/codegen_style.pro"
make --silent
info_msg "Build codegen_style"
# Build codegen_style
mkdir -p "$srcdir/tdesktop/Linux/obj/codegen_style/Debug"
cd "$srcdir/tdesktop/Linux/obj/codegen_style/Debug"
qmake CONFIG+=debug "../../../../Telegram/build/qmake/codegen_style/codegen_style.pro"
make --silent
info_msg "Build codegen_numbers"
# Build codegen_numbers
mkdir -p "$srcdir/tdesktop/Linux/obj/codegen_numbers/Debug"
cd "$srcdir/tdesktop/Linux/obj/codegen_numbers/Debug"
qmake CONFIG+=debug "../../../../Telegram/build/qmake/codegen_numbers/codegen_numbers.pro"
make --silent
info_msg "Build codegen_numbers"
# Build codegen_numbers
mkdir -p "$srcdir/tdesktop/Linux/obj/codegen_numbers/Debug"
cd "$srcdir/tdesktop/Linux/obj/codegen_numbers/Debug"
qmake CONFIG+=debug "../../../../Telegram/build/qmake/codegen_numbers/codegen_numbers.pro"
make --silent
info_msg "Build MetaLang"
# Build MetaLang

View File

@ -16,7 +16,7 @@ The source code is published under GPLv3 with OpenSSL exception, the license is
## Third-party libraries
* Qt 5.3.2 and 5.5.1, slightly patched ([LGPL](http://doc.qt.io/qt-5/lgpl.html))
* Qt 5.3.2 and 5.6.0, slightly patched ([LGPL](http://doc.qt.io/qt-5/lgpl.html))
* OpenSSL 1.0.1g ([OpenSSL License](https://www.openssl.org/source/license.html))
* zlib 1.2.8 ([zlib License](http://www.zlib.net/zlib_license.html))
* libexif 0.6.20 ([LGPL](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html))

View File

@ -599,6 +599,11 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_forwarded_channel_via" = "Forwarded from {channel} via {inline_bot}";
"lng_forwarded_signed" = "{channel} ({user})";
"lng_in_reply_to" = "In reply to";
"lng_edited" = "Edited";
"lng_edited_date" = "Edited: {date}";
"lng_cancel_edit_post_sure" = "Cancel editing?";
"lng_cancel_edit_post_yes" = "Yes";
"lng_cancel_edit_post_no" = "No";
"lng_bot_share_location_unavailable" = "Sorry, the location sharing is currently unavailable in Telegram Desktop.";
"lng_bot_inline_geo_unavailable" = "Sorry, this bot requires location sharing.\nIt is not available in Telegram Desktop.";

View File

@ -1705,7 +1705,7 @@ MsgId History::inboxRead(MsgId upTo) {
}
}
showFrom = 0;
showFrom = nullptr;
App::wnd()->notifyClear(this);
clearNotifications();
@ -2177,6 +2177,9 @@ void History::clear(bool leaveItems) {
if (showFrom) {
showFrom = nullptr;
}
if (lastSentMsg) {
lastSentMsg = nullptr;
}
if (scrollTopItem) {
forgetScrollState();
}
@ -2447,6 +2450,9 @@ void HistoryBlock::removeItem(HistoryItem *item) {
if (history->showFrom == item) {
history->getNextShowFrom(this, itemIndex);
}
if (history->lastSentMsg == item) {
history->lastSentMsg = nullptr;
}
if (history->unreadBar == item) {
history->unreadBar = nullptr;
}
@ -3088,8 +3094,8 @@ void HistoryItem::setId(MsgId newId) {
}
bool HistoryItem::canEdit(const QDateTime &cur) const {
ChannelData *channel = _history->peer->asChannel();
int32 s = date.secsTo(cur);
auto channel = _history->peer->asChannel();
if (!channel || id < 0 || date.secsTo(cur) >= Global::EditTimeLimit()) return false;
if (const HistoryMessage *msg = toHistoryMessage()) {
@ -6458,6 +6464,17 @@ int HistoryMessageSigned::maxWidth() const {
return _signature.maxWidth();
}
void HistoryMessageEdited::create(const QDateTime &editDate, const QDateTime &date) {
_editDate = editDate;
QString time = date.toString(cTimeFormat());
_edited.setText(st::msgDateFont, time, _textNameOptions);
}
int HistoryMessageEdited::maxWidth() const {
return _edited.maxWidth();
}
void HistoryMessageForwarded::create(const HistoryMessageVia *via) const {
QString text;
if (_authorOriginal != _fromOriginal) {
@ -6705,6 +6722,7 @@ HistoryMessage::HistoryMessage(History *history, const MTPDmessage &msg)
if (msg.has_via_bot_id()) config.viaBotId = msg.vvia_bot_id.v;
if (msg.has_views()) config.viewsCount = msg.vviews.v;
if (msg.has_reply_markup()) config.markup = &msg.vreply_markup;
if (msg.has_edit_date()) config.editDate = ::date(msg.vedit_date);
createComponents(config);
@ -6787,6 +6805,9 @@ void HistoryMessage::createComponents(const CreateConfig &config) {
if (isPost() && _from->isUser()) {
mask |= HistoryMessageSigned::Bit();
}
if (wasEdited()) {
mask |= HistoryMessageEdited::Bit();
}
if (config.authorIdOriginal && config.fromIdOriginal) {
mask |= HistoryMessageForwarded::Bit();
}
@ -6813,6 +6834,9 @@ void HistoryMessage::createComponents(const CreateConfig &config) {
if (auto msgsigned = Get<HistoryMessageSigned>()) {
msgsigned->create(_from->asUser(), date);
}
if (auto edited = Get<HistoryMessageEdited>()) {
edited->create(config.editDate, date);
}
if (auto fwd = Get<HistoryMessageForwarded>()) {
fwd->_authorOriginal = App::peer(config.authorIdOriginal);
fwd->_fromOriginal = App::peer(config.fromIdOriginal);
@ -6849,6 +6873,8 @@ QString formatViewsCount(int32 views) {
void HistoryMessage::initTime() {
if (auto msgsigned = Get<HistoryMessageSigned>()) {
_timeWidth = msgsigned->maxWidth();
} else if (auto edited = Get<HistoryMessageEdited>()) {
_timeWidth = edited->maxWidth();
} else {
_timeText = date.toString(cTimeFormat());
_timeWidth = st::msgDateFont->width(_timeText);
@ -7046,6 +7072,16 @@ void HistoryMessage::applyEdition(const MTPDmessage &message) {
if (message.has_entities()) {
entities = entitiesFromMTP(message.ventities.c_vector().v);
}
if (message.has_edit_date()) {
_flags |= MTPDmessage::Flag::f_edit_date;
if (!Has<HistoryMessageEdited>()) {
AddComponents(HistoryMessageEdited::Bit());
}
Get<HistoryMessageEdited>()->create(::date(message.vedit_date), date);
initTime();
}
setText(qs(message.vmessage), entities);
setMedia(message.has_media() ? (&message.vmedia) : nullptr);
setReplyMarkup(message.has_reply_markup() ? (&message.vreply_markup) : nullptr);
@ -7298,6 +7334,8 @@ void HistoryMessage::drawInfo(Painter &p, int32 right, int32 bottom, int32 width
if (auto msgsigned = Get<HistoryMessageSigned>()) {
msgsigned->_signature.drawElided(p, dateX, dateY, _timeWidth);
} else if (auto edited = Get<HistoryMessageEdited>()) {
edited->_edited.drawElided(p, dateX, dateY, _timeWidth);
} else {
p.drawText(dateX, dateY + st::msgDateFont->ascent, _timeText);
}

View File

@ -356,6 +356,7 @@ public:
bool oldLoaded = false;
bool newLoaded = true;
HistoryItem *lastMsg = nullptr;
HistoryItem *lastSentMsg = nullptr;
QDateTime lastMsgDate;
typedef QList<HistoryItem*> NotifyQueue;
@ -809,6 +810,14 @@ struct HistoryMessageSigned : public BaseComponent<HistoryMessageSigned> {
Text _signature;
};
struct HistoryMessageEdited : public BaseComponent<HistoryMessageEdited> {
void create(const QDateTime &editDate, const QDateTime &date);
int maxWidth() const;
QDateTime _editDate;
Text _edited;
};
struct HistoryMessageForwarded : public BaseComponent<HistoryMessageForwarded> {
void create(const HistoryMessageVia *via) const;
@ -1322,6 +1331,9 @@ public:
}
bool canEdit(const QDateTime &cur) const;
bool wasEdited() const {
return _flags & MTPDmessage::Flag::f_edit_date;
}
bool suggestBanReportDeleteAll() const {
ChannelData *channel = history()->peer->asChannel();
@ -2774,6 +2786,7 @@ private:
PeerId authorIdOriginal = 0;
PeerId fromIdOriginal = 0;
MsgId originalId = 0;
QDateTime editDate;
const MTPReplyMarkup *markup = nullptr;
};
void createComponentsHelper(MTPDmessage::Flags flags, MsgId replyTo, int32 viaBotId, const MTPReplyMarkup &markup);

View File

@ -2018,7 +2018,11 @@ void HistoryInner::applyDragSelection(SelectedItems *toItems) const {
QString HistoryInner::tooltipText() const {
if (_dragCursorState == HistoryInDateCursorState && _dragAction == NoDrag) {
if (App::hoveredItem()) {
return App::hoveredItem()->date.toString(QLocale::system().dateTimeFormat(QLocale::LongFormat));
QString dateText = App::hoveredItem()->date.toString(QLocale::system().dateTimeFormat(QLocale::LongFormat));
//if (auto edited = App::hoveredItem()->Get<HistoryMessageEdited>()) {
// dateText += '\n' + lng_edited_date(lt_date, edited->_editDate.toString(QLocale::system().dateTimeFormat(QLocale::LongFormat)));
//}
return dateText;
}
} else if (_dragCursorState == HistoryInForwardedCursorState && _dragAction == NoDrag) {
if (App::hoveredItem()) {
@ -6916,7 +6920,13 @@ void HistoryWidget::keyPressEvent(QKeyEvent *e) {
}
} else if (e->key() == Qt::Key_Up) {
if (!(e->modifiers() & (Qt::ShiftModifier | Qt::MetaModifier | Qt::ControlModifier))) {
_scroll.keyPressEvent(e);
if (_history && _history->lastSentMsg) {
if (_field.getLastText().isEmpty() && !_editMsgId && !_replyToId) {
App::contextItem(_history->lastSentMsg);
onEditMessage();
}
}
// _scroll.keyPressEvent(e);
}
} else {
e->ignore();
@ -7485,6 +7495,7 @@ void HistoryWidget::cancelForwarding() {
}
void HistoryWidget::onFieldBarCancel() {
Ui::hideLayer();
_replyForwardPressed = false;
if (_previewData && _previewData->pendingTill >= 0) {
_previewCancelled = true;
@ -7640,6 +7651,14 @@ void HistoryWidget::updatePreview() {
void HistoryWidget::onCancel() {
if (_inlineBotCancel) {
onInlineBotCancel();
} else if (_editMsgId) {
if (_replyEditMsg && textApplyEntities(_replyEditMsg->originalText(), _replyEditMsg->originalEntities()) != _field.getLastText()) {
auto box = new ConfirmBox(lang(lng_cancel_edit_post_sure), lang(lng_cancel_edit_post_yes), st::defaultBoxButton, lang(lng_cancel_edit_post_no));
connect(box, SIGNAL(confirmed()), this, SLOT(onFieldBarCancel()));
Ui::showLayer(box);
} else {
onFieldBarCancel();
}
} else if (!_attachMention.isHidden()) {
_attachMention.hideStart();
} else {

View File

@ -1098,6 +1098,7 @@ void MainWidget::sendMessage(History *hist, const QString &text, MsgId replyTo,
QString sendingText, leftText = prepareTextWithEntities(text, leftEntities, itemTextOptions(hist, App::self()).flags);
QString command = parseCommandFromMessage(hist, text);
HistoryItem *lastMessage = nullptr;
if (replyTo < 0) replyTo = _history->replyToId();
while (command.isEmpty() && textSplit(sendingText, sendingEntities, leftText, leftEntities, MaxMessageSize)) {
@ -1142,10 +1143,12 @@ void MainWidget::sendMessage(History *hist, const QString &text, MsgId replyTo,
if (!sentEntities.c_vector().v.isEmpty()) {
sendFlags |= MTPmessages_SendMessage::Flag::f_entities;
}
hist->addNewMessage(MTP_message(MTP_flags(flags), MTP_int(newId.msg), MTP_int(showFromName ? MTP::authedId() : 0), peerToMTP(hist->peer->id), MTPnullFwdHeader, MTPint(), MTP_int(replyTo), MTP_int(unixtime()), msgText, media, MTPnullMarkup, localEntities, MTP_int(1), MTPint()), NewMessageUnread);
lastMessage = hist->addNewMessage(MTP_message(MTP_flags(flags), MTP_int(newId.msg), MTP_int(showFromName ? MTP::authedId() : 0), peerToMTP(hist->peer->id), MTPnullFwdHeader, MTPint(), MTP_int(replyTo), MTP_int(unixtime()), msgText, media, MTPnullMarkup, localEntities, MTP_int(1), MTPint()), NewMessageUnread);
hist->sendRequestId = MTP::send(MTPmessages_SendMessage(MTP_flags(sendFlags), hist->peer->input, MTP_int(replyTo), msgText, MTP_long(randomId), MTPnullMarkup, sentEntities), rpcDone(&MainWidget::sentUpdatesReceived, randomId), rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId);
}
hist->lastSentMsg = lastMessage;
finishForwarding(hist, broadcast, silent);
executeParsedCommand(command);

View File

@ -1900,7 +1900,7 @@ int32 ConnectionPrivate::handleOneReceived(const mtpPrime *from, const mtpPrime
DEBUG_LOG(("Message Info: resend of msgs requested, ids: %1").arg(Logs::vector(ids)));
if (!idsCount) return (badTime ? 0 : 1);
QVector<quint64> toResend(ids.size(), Qt::Uninitialized);
QVector<quint64> toResend(ids.size());
for (int32 i = 0, l = ids.size(); i < l; ++i) {
toResend[i] = ids.at(i).v;
}

View File

@ -1314,7 +1314,7 @@ void psRegisterCustomScheme() {
s << "StartupWMClass=Telegram\n";
s << "Type=Application\n";
s << "Categories=Network;\n";
s << "MimeType=application/x-xdg-protocol-tg;x-scheme-handler/tg;\n";
s << "MimeType=x-scheme-handler/tg;\n";
f.close();
if (_psRunCommand("desktop-file-install --dir=" + escapeShell(QFile::encodeName(home + qsl(".local/share/applications"))) + " --delete-original " + escapeShell(QFile::encodeName(file)))) {

View File

@ -213,13 +213,8 @@ void FlatInput::resizeEvent(QResizeEvent *e) {
}
}
//#include "../../../QtStatic/qtbase/src/widgets/widgets/qwidgettextcontrol_p.h"
void FlatInput::contextMenuEvent(QContextMenuEvent *e) {
if (QMenu *menu = createStandardContextMenu()) {
//menu->addSeparator(); // testing two level menu
//QUnicodeControlCharacterMenu *ctrlCharacterMenu = new QUnicodeControlCharacterMenu(this, menu);
//menu->addMenu(ctrlCharacterMenu);
(new PopupMenu(menu))->popup(e->globalPos());
}
}

View File

@ -20,7 +20,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include "../../../QtStatic/qtbase/src/gui/text/qfontengine_p.h"
#include "private/qfontengine_p.h"
#include "core/click_handler.h"
#include "ui/text/text_entity.h"

View File

@ -20,7 +20,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include "../../../QtStatic/qtbase/src/gui/text/qfontengine_p.h"
#include "private/qfontengine_p.h"
enum TextBlockType {
TextBlockTNewline = 0x01,

File diff suppressed because it is too large Load Diff

View File

@ -144,7 +144,7 @@ Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **Start Menu >
make
make install
####Qt 5.5.1, slightly patched
####Qt 5.6.0, slightly patched
* Install Python 3.3.2 from https://www.python.org/download/releases/3.3.2 > [**Windows x86 MSI Installer (3.3.2)**](https://www.python.org/ftp/python/3.3.2/python-3.3.2.msi)
* Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **Start Menu > Programs > Visual Studio 2015** menu folder)
@ -156,17 +156,17 @@ There go to Libraries directory
and run
git clone git://code.qt.io/qt/qt5.git QtStatic
cd QtStatic
git checkout 5.5
git clone git://code.qt.io/qt/qt5.git qt5_6_0
cd qt5_6_0
git checkout 5.6
perl init-repository --module-subset=qtbase,qtimageformats
git checkout v5.5.1
cd qtimageformats && git checkout v5.5.1 && cd ..
cd qtbase && git checkout v5.5.1 && cd ..
git checkout v5.6.0
cd qtimageformats && git checkout v5.6.0 && cd ..
cd qtbase && git checkout v5.6.0 && cd ..
#####Apply the patch
cd qtbase && git apply ../../../tdesktop/Telegram/_qtbase_5_5_1_patch.diff && cd ..
cd qtbase && git apply ../../../tdesktop/Telegram/_qtbase_5_6_0_patch.diff && cd ..
#####Install Windows SDKs
@ -218,8 +218,8 @@ and run
* Launch VS2015 for configuring Qt5Package
* QT5 > Qt Options > Add
* Version name: **QtStatic.5.5.1**
* Path: **D:\TBuild\Libraries\QtStatic\qtbase**
* Default Qt/Win version: **QtStatic.5.5.1** **OK**
* Version name: **Qt 5.6.0 Win32**
* Path: **D:\TBuild\Libraries\qt5_6_0\qtbase**
* Default Qt/Win version: **Qt 5.6.0 Win32** **OK**
* File > Open > Project/Solution > **D:\TBuild\tdesktop\Telegram.sln**
* Build \ Build Solution (Debug and Release configurations)

View File

@ -5,7 +5,7 @@ The following commands assume the following environment variables are set:
* `$srcdir`: The directory into which the source has been downloaded and
unpacked.
* `_qtver`: The Qt version being used (eg: `5.5.1`).
* `_qtver`: The Qt version being used (eg: `5.6.0`).
* `$pkgdir`: The directory into which installable files are places. This is
`/` for local installations, or can be different directory when preparing a
redistributable package.
@ -15,7 +15,7 @@ Either set them accordingly, or replace them in the below commands as desired.
The following sources should be downloaded and unpacked into `$srcdir`:
* This repository (either `master` or a specific tag).
* The Qt sources: `http://download.qt-project.org/official_releases/qt/${_qtver%.*}/$_qtver/single/qt-everywhere-opensource-src-$_qtver.tar.xz`
* `git clone git://code.qt.io/qt/qt5.git`
* `git clone git+https://chromium.googlesource.com/breakpad/breakpad breakpad`
* `git clone git+https://chromium.googlesource.com/linux-syscall-support breakpad-lss`
* telegramdesktop.desktop (The intention is to include this file inside the
@ -27,26 +27,34 @@ Preparation
-----------
cd "$srcdir/tdesktop"
mkdir -p "$srcdir/Libraries"
local qt_patch_file="$srcdir/tdesktop/Telegram/_qtbase_${_qtver//./_}_patch.diff"
if [ "$qt_patch_file" -nt "$srcdir/Libraries/QtStatic" ]; then
rm -rf "$srcdir/Libraries/QtStatic"
mv "$srcdir/qt-everywhere-opensource-src-$_qtver" "$srcdir/Libraries/QtStatic"
cd "$srcdir/Libraries/QtStatic/qtbase"
patch -p1 -i "$qt_patch_file"
local qt_dir="$srcdir/Libraries/qt${_qtver//./_}"
if [ "$qt_patch_file" -nt "$qt_dir" ]; then
rm -rf "$qt_dir"
git clone git://code.qt.io/qt/qt5.git
cd "$qt_dir"
git checkout 5.6
perl init-repository --module-subset=qtbase,qtimageformats
git checkout v$_qtver
cd qtimageformats
git checkout v$_qtver
cd ../qtbase
git checkout v$_qtver
git apply "$qt_patch_file"
fi
if [ ! -h "$srcdir/Libraries/breakpad" ]; then
ln -s "$srcdir/breakpad" "$srcdir/Libraries/breakpad"
ln -s "$srcdir/breakpad-lss" "$srcdir/Libraries/breakpad/src/third_party/lss"
fi
sed -i 's/CUSTOM_API_ID//g' "$srcdir/tdesktop/Telegram/Telegram.pro"
sed -i 's,LIBS += /usr/local/lib/libxkbcommon.a,,g' "$srcdir/tdesktop/Telegram/Telegram.pro"
sed -i 's,LIBS += /usr/local/lib/libz.a,LIBS += -lz,g' "$srcdir/tdesktop/Telegram/Telegram.pro"
(
echo "DEFINES += TDESKTOP_DISABLE_AUTOUPDATE"
echo "DEFINES += TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME"
@ -67,14 +75,14 @@ Building
-qt-xkbcommon-x11 -no-opengl -static -nomake examples -nomake tests
make module-qtbase module-qtimageformats
make module-qtbase-install_subtargets module-qtimageformats-install_subtargets
export PATH="$srcdir/qt/bin:$PATH"
# Build breakpad
cd "$srcdir/Libraries/breakpad"
./configure
make
# Build codegen_style
mkdir -p "$srcdir/tdesktop/Linux/obj/codegen_style/Debug"
cd "$srcdir/tdesktop/Linux/obj/codegen_style/Debug"
@ -86,21 +94,17 @@ Building
cd "$srcdir/tdesktop/Linux/obj/codegen_numbers/Debug"
qmake CONFIG+=debug ../../../../Telegram/build/qmake/codegen_numbers/codegen_numbers.pro
make
# Build MetaLang
mkdir -p "$srcdir/tdesktop/Linux/DebugIntermediateLang"
cd "$srcdir/tdesktop/Linux/DebugIntermediateLang"
qmake CONFIG+=debug "../../Telegram/MetaLang.pro"
make
# Build Telegram Desktop
mkdir -p "$srcdir/tdesktop/Linux/ReleaseIntermediate"
cd "$srcdir/tdesktop/Linux/ReleaseIntermediate"
qmake CONFIG+=release "../../Telegram/Telegram.pro"
local pattern="^PRE_TARGETDEPS +="
grep "$pattern" "$srcdir/tdesktop/Telegram/Telegram.pro" | sed "s/$pattern//g" | xargs make
qmake CONFIG+=release "../../Telegram/Telegram.pro"
make
@ -110,17 +114,17 @@ Installation
install -dm755 "$pkgdir/usr/bin"
install -m755 "$srcdir/tdesktop/Linux/Release/Telegram" "$pkgdir/usr/bin/telegram-desktop"
install -d "$pkgdir/usr/share/applications"
install -m644 "$srcdir/telegramdesktop.desktop" "$pkgdir/usr/share/applications/telegramdesktop.desktop"
install -d "$pkgdir/usr/share/kde4/services"
install -m644 "$srcdir/tg.protocol" "$pkgdir/usr/share/kde4/services/tg.protocol"
local icon_size icon_dir
for icon_size in 16 32 48 64 128 256 512; do
icon_dir="$pkgdir/usr/share/icons/hicolor/${icon_size}x${icon_size}/apps"
install -d "$icon_dir"
install -m644 "$srcdir/tdesktop/Telegram/SourceFiles/art/icon${icon_size}.png" "$icon_dir/telegram-desktop.png"
done

View File

@ -6,13 +6,13 @@
* Install g++ by command **sudo apt-get install g++** in Terminal
* Install Qt Creator from [**Downloads page**](https://www.qt.io/download/)
For 32 bit Ubuntu you need to install g++ version 4.8 manually by such commands
You need to install g++ version 4.9 manually by such commands
* sudo add-apt-repository ppa:ubuntu-toolchain-r/test
* sudo apt-get update
* sudo apt-get install gcc-4.8 g++-4.8
* sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20
* sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20
* sudo apt-get install gcc-4.9 g++-4.9
* sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 21
* sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 21
###Prepare folder
@ -123,33 +123,33 @@ In Terminal go to **/home/user/TBuild/Libraries** and run
make
sudo make install
####Qt 5.5.1, slightly patched
####Qt 5.6.0, slightly patched
In Terminal go to **/home/user/TBuild/Libraries** and run
git clone git://code.qt.io/qt/qt5.git QtStatic
cd QtStatic
git checkout 5.5
git clone git://code.qt.io/qt/qt5.git qt5_6_0
cd qt5_6_0
git checkout 5.6
perl init-repository --module-subset=qtbase,qtimageformats
git checkout v5.5.1
cd qtimageformats && git checkout v5.5.1 && cd ..
cd qtbase && git checkout v5.5.1 && cd ..
git checkout v5.6.0
cd qtimageformats && git checkout v5.6.0 && cd ..
cd qtbase && git checkout v5.6.0 && cd ..
#####Apply the patch
cd qtbase && git apply ../../../tdesktop/Telegram/_qtbase_5_5_1_patch.diff && cd ..
cd qtbase && git apply ../../../tdesktop/Telegram/_qtbase_5_6_0_patch.diff && cd ..
#####Building library
Install some packages for Qt (see **/home/user/TBuild/Libraries/QtStatic/qtbase/src/plugins/platforms/xcb/README**)
Install some packages for Qt (see **/home/user/TBuild/Libraries/qt5_6_0/qtbase/src/plugins/platforms/xcb/README**)
sudo apt-get install libxcb1-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-icccm4-dev libxcb-render-util0-dev libxcb-util0-dev libxrender-dev libasound-dev libpulse-dev libxcb-sync0-dev libxcb-xfixes0-dev libxcb-randr0-dev libx11-xcb-dev libffi-dev
In Terminal go to **/home/user/TBuild/Libraries/QtStatic** and there run
In Terminal go to **/home/user/TBuild/Libraries/qt5_6_0** and there run
OPENSSL_LIBS='-L/usr/local/ssl/lib -lssl -lcrypto' ./configure -release -force-debug-info -opensource -confirm-license -qt-zlib -qt-libpng -qt-libjpeg -qt-freetype -qt-harfbuzz -qt-pcre -qt-xcb -qt-xkbcommon-x11 -no-opengl -static -openssl-linked -nomake examples -nomake tests
OPENSSL_LIBS='-L/usr/local/ssl/lib -lssl -lcrypto' ./configure -prefix "/usr/local/tdesktop/Qt-5.6.0" -release -force-debug-info -opensource -confirm-license -qt-zlib -qt-libpng -qt-libjpeg -qt-freetype -qt-harfbuzz -qt-pcre -qt-xcb -qt-xkbcommon-x11 -no-opengl -static -openssl-linked -nomake examples -nomake tests
make -j4
sudo make -j4 install
sudo make install
building (**make** command) will take really long time.
@ -170,18 +170,18 @@ In Terminal go to **/home/user/TBuild/tdesktop** and run
mkdir -p Linux/obj/codegen_style/Debug
cd Linux/obj/codegen_style/Debug
/usr/local/Qt-5.5.1/bin/qmake CONFIG+=debug ../../../../Telegram/build/qmake/codegen_style/codegen_style.pro
/usr/local/tdesktop/Qt-5.6.0/bin/qmake CONFIG+=debug ../../../../Telegram/build/qmake/codegen_style/codegen_style.pro
make
mkdir -p ../../codegen_numbers/Debug
cd ../../codegen_numbers/Debug
/usr/local/Qt-5.5.1/bin/qmake CONFIG+=debug ../../../../Telegram/build/qmake/codegen_numbers/codegen_numbers.pro
/usr/local/tdesktop/Qt-5.6.0/bin/qmake CONFIG+=debug ../../../../Telegram/build/qmake/codegen_numbers/codegen_numbers.pro
make
###Building Telegram Desktop
* Launch Qt Creator, all projects will be taken from **/home/user/TBuild/tdesktop/Telegram**
* Tools > Options > Build & Run > Qt Versions tab > Add > File System /usr/local/Qt-5.5.1/bin/qmake > **Qt 5.5.1 (Qt-5.5.1)** > Apply
* Tools > Options > Build & Run > Kits tab > Desktop (default) > change **Qt version** to **Qt 5.5.1 (Qt-5.5.1)** > Apply
* Tools > Options > Build & Run > Qt Versions tab > Add > File System /usr/local/tdesktop/Qt-5.6.0/bin/qmake > **Qt 5.6.0 (Qt-5.6.0)** > Apply
* Tools > Options > Build & Run > Kits tab > Desktop (default) > change **Qt version** to **Qt 5.6.0 (Qt-5.6.0)** > Apply
* Open MetaLang.pro, configure project with paths **/home/user/TBuild/tdesktop/Linux/DebugIntermediateLang** and **/home/user/TBuild/tdesktop/Linux/ReleaseIntermediateLang** and build for Debug
* Open Telegram.pro, configure project with paths **/home/user/TBuild/tdesktop/Linux/DebugIntermediate** and **/home/user/TBuild/tdesktop/Linux/ReleaseIntermediate** and build for Debug, if GeneratedFiles are not found click **Run qmake** from **Build** menu and try again
* Open Updater.pro, configure project with paths **/home/user/TBuild/tdesktop/Linux/DebugIntermediateUpdater** and **/home/user/TBuild/tdesktop/Linux/ReleaseIntermediateUpdater** and build for Debug

View File

@ -4,7 +4,7 @@
Choose a folder for the future build, for example **/Users/user/TBuild** There you will have two folders, **Libraries** for third-party libs and **tdesktop** (or **tdesktop-master**) for the app.
**IMPORTANT** You are required to build and install Qt 5.5.1 from the [Xcode 7](building-xcode.md) instructions first.
**IMPORTANT** You are required to build and install Qt 5.6.0 from the [Xcode 7](building-xcode.md) instructions first.
###Clone source code

View File

@ -192,32 +192,32 @@ Then in Terminal go to **/Users/user/TBuild/Libraries/ffmpeg** and run:
make
sudo make install
####Qt 5.5.1, slightly patched
####Qt 5.6.0, slightly patched
#####Get the source code
In Terminal go to **/Users/user/TBuild/Libraries** and run:
git clone git://code.qt.io/qt/qt5.git QtStatic
cd QtStatic
git checkout 5.5
git clone git://code.qt.io/qt/qt5.git qt5_6_0
cd qt5_6_0
git checkout 5.6
perl init-repository --module-subset=qtbase,qtimageformats
git checkout v5.5.1
cd qtimageformats && git checkout v5.5.1 && cd ..
cd qtbase && git checkout v5.5.1 && cd ..
git checkout v5.6.0
cd qtimageformats && git checkout v5.6.0 && cd ..
cd qtbase && git checkout v5.6.0 && cd ..
#####Apply the patch
From **/Users/user/TBuild/Libraries/QtStatic/qtbase**, run:
From **/Users/user/TBuild/Libraries/qt5_6_0/qtbase**, run:
git apply ../../../tdesktop/Telegram/_qtbase_5_5_1_patch.diff
git apply ../../../tdesktop/Telegram/_qtbase_5_6_0_patch.diff
#####Building library
Go to **/Users/user/TBuild/Libraries/QtStatic** and run:
Go to **/Users/user/TBuild/Libraries/qt5_6_0** and run:
./configure -debug-and-release -force-debug-info -opensource -confirm-license -static -opengl desktop -no-openssl -securetransport -nomake examples -nomake tests -platform macx-clang
./configure -prefix "/usr/local/tdesktop/Qt-5.6.0" -debug-and-release -force-debug-info -opensource -confirm-license -static -opengl desktop -no-openssl -securetransport -nomake examples -nomake tests -platform macx-clang
make -j4
sudo make -j4 install
sudo make install
Building (**make** command) will take a really long time.