From 640587665632025035dd3cd5a94f433f67db568e Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Thu, 18 Feb 2016 21:09:30 -0300 Subject: [PATCH 1/4] Document how to build via qmake Signed-off-by: Hugo Osvaldo Barrera (github: hobarrera) --- doc/building-qmake.md | 130 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 doc/building-qmake.md diff --git a/doc/building-qmake.md b/doc/building-qmake.md new file mode 100644 index 0000000000..37f091331e --- /dev/null +++ b/doc/building-qmake.md @@ -0,0 +1,130 @@ +Building via qmake +================== + +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`). + * `$pkgdir`: The directory into which installable files are places. This is + `/` for local installations, or can be different directory when preparing a + redistributable package. + +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+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 + source package at some point): + `https://aur.archlinux.org/cgit/aur.git/plain/telegramdesktop.desktop?h=telegram-desktop` + * tg.protocol: `https://aur.archlinux.org/cgit/aur.git/plain/tg.protocol?h=telegram-desktop` + +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" + 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" + echo 'INCLUDEPATH += "/usr/lib/glib-2.0/include"' + echo 'INCLUDEPATH += "/usr/lib/gtk-2.0/include"' + echo 'INCLUDEPATH += "/usr/include/opus"' + ) >> "$srcdir/tdesktop/Telegram/Telegram.pro" + +Building +-------- + + + # Build patched Qt + cd "$srcdir/Libraries/QtStatic" + ./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 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 MetaStyle + mkdir -p "$srcdir/tdesktop/Linux/DebugIntermediateStyle" + cd "$srcdir/tdesktop/Linux/DebugIntermediateStyle" + qmake CONFIG+=debug "../../Telegram/MetaStyle.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 + +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 + +Notes +----- + +These instructions are based on the [ArchLinux package][arch-package] for +telegram-desktop. + +In case these instructions are at some point out of date, the above may serve +as an update reference. + +[arch-package]: https://aur.archlinux.org/packages/telegram-desktop/ From 0315568b80676906481948ee84d1e237460bf8f3 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Thu, 18 Feb 2016 21:23:23 -0300 Subject: [PATCH 2/4] Link to qmake documentation in the README Signed-off-by: Hugo Osvaldo Barrera (github: hobarrera) --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index be9a159774..3c891840dd 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ The source code is published under GPLv3 with OpenSSL exception, the license is * [XCode 7][xcode] * [XCode 7 for OS X 10.6 and 10.7][xcode_old] * [Qt Creator 3.5.1 Ubuntu][qtcreator] +* [Using qmake on GNU/Linux][qmake] ## Projects in Telegram solution @@ -93,3 +94,4 @@ The source code is published under GPLv3 with OpenSSL exception, the license is [xcode]: XCODE.md [xcode_old]: XCODEold.md [qtcreator]: QTCREATOR.md +[qmake]: doc/building-qmake.md From 3546fe421c09e2811d18186e5281baee044e4849 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Thu, 18 Feb 2016 21:23:43 -0300 Subject: [PATCH 3/4] Move all build documentation into /doc Signed-off-by: Hugo Osvaldo Barrera (github: hobarrera) --- README.md | 8 ++++---- MSVC.md => doc/building-msvc.md | 0 QTCREATOR.md => doc/building-qtcreator.md | 0 XCODEold.md => doc/building-xcode-old.md | 0 XCODE.md => doc/building-xcode.md | 0 5 files changed, 4 insertions(+), 4 deletions(-) rename MSVC.md => doc/building-msvc.md (100%) rename QTCREATOR.md => doc/building-qtcreator.md (100%) rename XCODEold.md => doc/building-xcode-old.md (100%) rename XCODE.md => doc/building-xcode.md (100%) diff --git a/README.md b/README.md index 3c891840dd..4f9b406f71 100644 --- a/README.md +++ b/README.md @@ -90,8 +90,8 @@ The source code is published under GPLv3 with OpenSSL exception, the license is [telegram_api]: https://core.telegram.org [telegram_proto]: https://core.telegram.org/mtproto [license]: LICENSE -[msvc]: MSVC.md -[xcode]: XCODE.md -[xcode_old]: XCODEold.md -[qtcreator]: QTCREATOR.md +[msvc]: doc/building-msvc.md +[xcode]: doc/building-xcode.md +[xcode_old]: doc/building-xcode-old.md +[qtcreator]: doc/building-qtcreator.md [qmake]: doc/building-qmake.md diff --git a/MSVC.md b/doc/building-msvc.md similarity index 100% rename from MSVC.md rename to doc/building-msvc.md diff --git a/QTCREATOR.md b/doc/building-qtcreator.md similarity index 100% rename from QTCREATOR.md rename to doc/building-qtcreator.md diff --git a/XCODEold.md b/doc/building-xcode-old.md similarity index 100% rename from XCODEold.md rename to doc/building-xcode-old.md diff --git a/XCODE.md b/doc/building-xcode.md similarity index 100% rename from XCODE.md rename to doc/building-xcode.md From 841daa2a6efa09277f1cfadd0a03dd2a52b5eb2a Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Fri, 19 Feb 2016 18:07:31 -0300 Subject: [PATCH 4/4] Deduplicate links to build instructions Signed-off-by: Hugo Osvaldo Barrera (github: hobarrera) --- CONTRIBUTING.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 435e40e9dc..68c80c0a70 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -73,10 +73,8 @@ For more info, see [GitHub Help][help_change_commit_message]. ## Build instructions -* [Visual Studio 2013][msvc] -* [XCode 6.4][xcode] -* [XCode 6.4 for OS X 10.6 and 10.7][xcode_old] -* [Qt Creator 3.2.0 Ubuntu][qtcreator] +See the [readme][README.md#build-instructions] for details on the various build +environments. ## Pull upstream changes into your fork regularly