From 44c4c5e66e5ab40019dd882325393931559fbf02 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Tue, 21 Jan 2014 00:29:20 +0400 Subject: [PATCH] added paper --- _posts/2014-01-14-about-zshrc.html | 18 +- .../2014-01-21-building-qutim-using-qt5.html | 200 ++++++++++++++++++ resources/docs/qutim-qt5-git/PKGBUILD | 52 +++++ resources/docs/qutim-qt5-git/qbs-qutim.conf | 33 +++ .../docs/qutim-qt5-git/qutim-qbs-1.1.patch | 35 +++ ru/_posts/2014-01-14-about-zshrc.html | 18 +- .../2014-01-21-building-qutim-using-qt5.html | 200 ++++++++++++++++++ 7 files changed, 538 insertions(+), 18 deletions(-) create mode 100644 _posts/2014-01-21-building-qutim-using-qt5.html create mode 100644 resources/docs/qutim-qt5-git/PKGBUILD create mode 100644 resources/docs/qutim-qt5-git/qbs-qutim.conf create mode 100644 resources/docs/qutim-qt5-git/qutim-qbs-1.1.patch create mode 100644 ru/_posts/2014-01-21-building-qutim-using-qt5.html diff --git a/_posts/2014-01-14-about-zshrc.html b/_posts/2014-01-14-about-zshrc.html index 4e3a273..e0b5279 100644 --- a/_posts/2014-01-14-about-zshrc.html +++ b/_posts/2014-01-14-about-zshrc.html @@ -8,14 +8,14 @@ short: about-zshrc description: It is first paper in my blog (I think I need something here for tests =)). There are many similar articles, and I'll not be an exception. I just want to show my .zshrc and explain what it does and why it is needed. Also any comments or additions are welcome. It is a translated paper from Russian (original). commentIssueId: 5 --- -

Prepare

+

Prepare

First install recommended minima:

{% highlight bash %} pacman -Sy pkgfile zsh zsh-completions zsh-syntax-highlighting {% endhighlight %}

pkgfile is a very useful utility. Also this command will install shell, additional completion and syntax highlighting.

-

Shell configuration

+

Shell configuration

All options are avaible here.

Set history file and number of commands in cache of the current session and in the history file:

@@ -112,7 +112,7 @@ setopt HIST_REDUCE_BLANKS source /usr/share/doc/pkgfile/command-not-found.zsh {% endhighlight %} -

Syntax highlighting

+

Syntax highlighting

{% highlight bash %} # highlighting source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh @@ -161,7 +161,7 @@ ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=yellow' {% endhighlight %}

In first line highlighting is turned on. Next main, brackets and pattern highlighting are turned on. Patterns are set below (rm -rf * in the example). Also root and cursor highlighting may be turned on. Colors syntax is understandable, fg is font color, bg is background color.

-

$PROMPT and $RPROMPT

+

$PROMPT and $RPROMPT

The general idea is the use single .zshrc for root and normal user:

{% highlight bash %} # PROMPT && RPROMPT @@ -239,7 +239,7 @@ $returncode\ {% endhighlight %}

My RPROMPT shows current time, battery change and last returned code. precmd() is necessary for automatic updating. The construct $(if.true.false) is conditional statement in zsh.

-

Aliases

+

Aliases

Copy only those aliases that you need. If any alias uses application that is not installed it will leads to fail of loading of configuration file.

Small useful (or maybe not) function:

@@ -327,7 +327,7 @@ alias -g h="| head" alias -g dn="&> /dev/null &" {% endhighlight %} -

Functions

+

Functions

Here is a special function for xrandr:

{% highlight bash %} @@ -439,7 +439,7 @@ yatest () { {% endhighlight %}

But autocomplete for yaourt -Ss will require root privileges.

-

Variables

+

Variables

It is recommended to set own variables in ~/.zshenv. But I have everything stored in the single file.

Here are path, mask of new files, editor and pager:

@@ -463,8 +463,8 @@ hash -d u1=/mnt/usbdev1 hash -d u2=/mnt/usbdev {% endhighlight %} -

Screenshot

+

Screenshot

-

File

+

File

Here is my .zshrc.

diff --git a/_posts/2014-01-21-building-qutim-using-qt5.html b/_posts/2014-01-21-building-qutim-using-qt5.html new file mode 100644 index 0000000..2bc99de --- /dev/null +++ b/_posts/2014-01-21-building-qutim-using-qt5.html @@ -0,0 +1,200 @@ +--- +category: en +type: paper +layout: paper +tags: archlinux, linux, building, qutim +title: Building Qutim using Qt5 +short: building-qutim-using-qt5 +description: Qutim is a multiprotocol and cross platform messenger. It is written on CPP using Qt library. The project is actively developed. In this paper I will say about building this package in Archlinux using Qt5 library (instead of Qt4 which is used in current AUR packages). +commentIssueId: 6 +--- +

What's wrong?

+

This package uses qbs for building, which is a bit strange IMHO. A package, which is necessary for building, is in AUR . I recommend to use git version of the package. When I asked Andrea Scarpino (who maintains KDE and Qt packages into the official repos) about qbs, he told me "we will support it in time". And I agree with him, the project seems to be a little unstable.

+ +

Prepare

+

Install dependences. I had used namcap, so maybe I missed something:

+{% highlight bash %} +pacman -Sy --asdeps clang git libc++abi qt5-quick1 qt5-x11extras +yaourt -S --asdeps jreen-git qbs-git +{% endhighlight %} + +

qbs settings

+

You may read about qbs on the link or see examples which are provides by the package. qbs uses configuration file that firstly you must create and secondly it is stored in your home directory. In theory a configuration file creating ((~/.config/QtProject/qbs.conf)) looks like this:

+{% highlight bash %} +qbs-setup-qt --detect +qbs-detect-toolchains +{% endhighlight %} +

Firstly we find Qt libraries. Then we find toolchains (such as compilers). And next we must insert a toolchain into Qt profile (for example, we need clang toolchain):

+{% highlight bash %} +sed 's/clang\\/qt-5-2-0\\/g' -i ~/.config/QtProject/qbs.conf +{% endhighlight %} +

And there are other ways. You may edit the file manually or use qbs-config-ui or qbs-config.

+

So, we have created the configuration file and put it into build directory:

+{% highlight ini %} +[General] + +[Qt] +filedialog= + +[profiles] +clang\cpp\compilerName=clang++ +clang\cpp\toolchainInstallPath=/usr/bin +clang\qbs\architecture=x86_64 +clang\qbs\endianness=little +clang\qbs\toolchain=clang, llvm, gcc +gcc\cpp\compilerName=g++ +gcc\cpp\toolchainInstallPath=/usr/bin +gcc\qbs\architecture=x86_64 +gcc\qbs\endianness=little +gcc\qbs\toolchain=gcc +qutim\Qt\core\binPath=/usr/lib/qt/bin +qutim\Qt\core\buildVariant=release +qutim\Qt\core\config=shared, qpa, no_mocdepend, release, qt_no_framework +qutim\Qt\core\docPath=/usr/share/doc/qt +qutim\Qt\core\incPath=/usr/include/qt +qutim\Qt\core\libInfix= +qutim\Qt\core\libPath=/usr/lib +qutim\Qt\core\mkspecPath=/usr/lib/qt/mkspecs/linux-g++ +qutim\Qt\core\namespace= +qutim\Qt\core\pluginPath=/usr/lib/qt/plugins +qutim\Qt\core\qtConfig=minimal-config, small-config, medium-config, large-config, full-config, gtk2, gtkstyle, fontconfig, libudev, evdev, xlib, xcb-glx, xcb-xlib, xcb-sm, xrender, accessibility-atspi-bridge, linuxfb, c++11, accessibility, opengl, shared, qpa, reduce_exports, reduce_relocations, clock-gettime, clock-monotonic, mremap, getaddrinfo, ipv6ifname, getifaddrs, inotify, eventfd, system-jpeg, system-png, png, system-freetype, no-harfbuzz, system-zlib, nis, cups, iconv, glib, dbus, dbus-linked, openssl-linked, xcb, xinput2, alsa, pulseaudio, icu, concurrent, audio-backend, release +qutim\Qt\core\version=5.2.0 +qutim\cpp\compilerName=clang++ +qutim\cpp\toolchainInstallPath=/usr/bin +qutim\qbs\architecture=x86_64 +qutim\qbs\endianness=little +qutim\qbs\toolchain=clang, llvm, gcc +{% endhighlight %} +

qbs-qutim.conf

+ +

Patch for sources

+

The first problem is clang (at least in Archlinux):

+{% highlight diff %} +diff -ruN qutim.orig/core/libqutim.qbs qutim/core/libqutim.qbs +--- qutim.orig/core/libqutim.qbs 2014-01-06 15:39:56.000000000 +0400 ++++ qutim/core/libqutim.qbs 2014-01-06 15:44:54.502175067 +0400 +@@ -75,7 +75,7 @@ + cpp.linkerFlags: { + var flags = base; + if (qbs.toolchain.contains("clang") && qbs.targetOS.contains("linux")) +- flags = flags.concat("-stdlib=libc++ -lcxxrt"); ++ flags = flags.concat("-lc++abi"); + return flags; + } + +{% endhighlight %} +

The second one is qbs:

+{% highlight diff %} +diff -ruN qutim.orig/protocols/jabber/jreen/jreen.qbs qutim/protocols/jabber/jreen/jreen.qbs +--- qutim.orig/protocols/jabber/jreen/jreen.qbs 2014-01-06 15:41:33.000000000 +0400 ++++ qutim/protocols/jabber/jreen/jreen.qbs 2014-01-06 15:44:54.502175067 +0400 +@@ -2,7 +2,7 @@ + + Project { + +- moduleSearchPaths: "qbs/modules" ++ qbsSearchPaths: "qbs/modules" + + references: "src/src.qbs" + } +{% endhighlight %} +

And the last one is Vk plugin:

+{% highlight diff %} +diff -ruN qutim.orig/protocols/vkontakte/vreen/vreen.qbs qutim/protocols/vkontakte/vreen/vreen.qbs +--- qutim.orig/protocols/vkontakte/vreen/vreen.qbs 2014-01-06 15:41:42.000000000 +0400 ++++ qutim/protocols/vkontakte/vreen/vreen.qbs 2014-01-06 15:46:47.142178486 +0400 +@@ -5,6 +5,7 @@ + property string vreen_qml_path: "bin" + property string vreen_lib_path: "lib" + property string vreen_libexec_path: "lib" ++ property string lib_path: "lib" + + property string vreen_version_major: 1 + property string vreen_version_minor: 9 +{% endhighlight %} +

qutim-qbs-1.1.patch

+ +

Get sources

+{% highlight bash %} +# clone repo +git clone https://github.com/euroelessar/qutim +# save qbs.conf +mkdir -p .config/QtProject +cp qbs-qutim.conf .config/QtProject/qbs.conf +# create build directory +mkdir build +# update submodules +cd qutim +git submodule update --init --recursive +# patch +cd .. +patch -p0 -i qutim-qbs-1.1.patch +{% endhighlight %} + +

Building

+{% highlight bash %} +cd qutim +HOME=$(pwd) qbs -j $(nproc) -d ../build release profile:qutim +{% endhighlight %} +

I want to create a universal recipe for the building, thus we must set $HOME directory. Flag -j means number of jobs, -d means build directory, release means building type (debug, release), profile is used profile, which is described in the configuration file.

+ +

Installation

+{% highlight bash %} +HOME=$(pwd) sudo qbs install -d ../build --install-root "/usr" profile:qutim +{% endhighlight %} +

We must set root directory (--install-root), because without this option the package will be installed into / (/bin and /lib).

+ +

PKGBUILD

+{% highlight bash %} +pkgname=qutim-qt5-git +_gitname=qutim +pkgver=v0.3.1.967.gc56d61e +pkgrel=1 +pkgdesc="Multiplatform instant messenger (qt5 build). Git version" +arch=('i686' 'x86_64') +url="http://qutim.org" +license=('LGPL' 'GPL3') +depends=('jreen-git' 'libc++abi' 'qt5-quick1' 'qt5-x11extras') +makedepends=('clang' 'qbs') +conflicts=(qutim-0.2_ru-git, qutim-0.3-git, qutim-stable, qutim-git) +source=("${_gitname}::git+https://github.com/euroelessar/qutim.git" + "qutim-qbs-1.1.patch" + "qbs-qutim.conf") +md5sums=('SKIP' + 'c0f151c43c055f76d3fa3efa3b8005e0' + '40f096b269eb00b040035591fce8e259') + +pkgver() { + cd "${_gitname}" + git describe --always | sed 's|-|.|g' +} + +prepare() { + # FIXME: dirty hack + mkdir -p "${srcdir}/.config/QtProject" + cp "${srcdir}/qbs-qutim.conf" "${srcdir}/.config/QtProject/qbs.conf" + # create build directory + if [[ -d ${srcdir}/build ]]; then + rm -rf "${srcdir}/build" + fi + mkdir "${srcdir}/build" + + cd "${_gitname}" + # update modules + git submodule update --init --recursive + # fix qbs build + cd .. + patch -p0 -i "${srcdir}/qutim-qbs-1.1.patch" +} + +build() { + cd "${_gitname}" + HOME="${srcdir}" qbs -j $(nproc) -d ../build release profile:qutim +} + +package() { + cd "${srcdir}/${_gitname}" + HOME="${srcdir}" qbs install -d ../build --install-root "${pkgdir}/usr" profile:qutim +} +{% endhighlight %} +

PKGBUILD

diff --git a/resources/docs/qutim-qt5-git/PKGBUILD b/resources/docs/qutim-qt5-git/PKGBUILD new file mode 100644 index 0000000..e3499f1 --- /dev/null +++ b/resources/docs/qutim-qt5-git/PKGBUILD @@ -0,0 +1,52 @@ +# Maintainer: Evgeniy Alekseev + +pkgname=qutim-qt5-git +_gitname=qutim +pkgver=v0.3.1.967.gc56d61e +pkgrel=1 +pkgdesc="Multiplatform instant messenger (qt5 build). Git version" +arch=('i686' 'x86_64') +url="http://qutim.org" +license=('LGPL' 'GPL3') +depends=('jreen-git' 'libc++abi' 'qt5-quick1' 'qt5-x11extras') +makedepends=('clang' 'qbs') +conflicts=(qutim-0.2_ru-git, qutim-0.3-git, qutim-stable, qutim-git) +source=("${_gitname}::git+https://github.com/euroelessar/qutim.git" + "qutim-qbs-1.1.patch" + "qbs-qutim.conf") +md5sums=('SKIP' + 'c0f151c43c055f76d3fa3efa3b8005e0' + '40f096b269eb00b040035591fce8e259') + +pkgver() { + cd "${_gitname}" + git describe --always | sed 's|-|.|g' +} + +prepare() { + # FIXME: dirty hack + mkdir -p "${srcdir}/.config/QtProject" + cp "${srcdir}/qbs-qutim.conf" "${srcdir}/.config/QtProject/qbs.conf" + # create build directory + if [[ -d ${srcdir}/build ]]; then + rm -rf "${srcdir}/build" + fi + mkdir "${srcdir}/build" + + cd "${_gitname}" + # update modules + git submodule update --init --recursive + # fix qbs build + cd .. + patch -p0 -i "${srcdir}/qutim-qbs-1.1.patch" +} + +build() { + cd "${_gitname}" + HOME="${srcdir}" qbs -j $(nproc) -d ../build release profile:qutim +} + +package() { + cd "${srcdir}/${_gitname}" + HOME="${srcdir}" qbs install -d ../build --install-root "${pkgdir}/usr" profile:qutim +} diff --git a/resources/docs/qutim-qt5-git/qbs-qutim.conf b/resources/docs/qutim-qt5-git/qbs-qutim.conf new file mode 100644 index 0000000..daf8c4f --- /dev/null +++ b/resources/docs/qutim-qt5-git/qbs-qutim.conf @@ -0,0 +1,33 @@ +[General] + +[Qt] +filedialog= + +[profiles] +clang\cpp\compilerName=clang++ +clang\cpp\toolchainInstallPath=/usr/bin +clang\qbs\architecture=x86_64 +clang\qbs\endianness=little +clang\qbs\toolchain=clang, llvm, gcc +gcc\cpp\compilerName=g++ +gcc\cpp\toolchainInstallPath=/usr/bin +gcc\qbs\architecture=x86_64 +gcc\qbs\endianness=little +gcc\qbs\toolchain=gcc +qutim\Qt\core\binPath=/usr/lib/qt/bin +qutim\Qt\core\buildVariant=release +qutim\Qt\core\config=shared, qpa, no_mocdepend, release, qt_no_framework +qutim\Qt\core\docPath=/usr/share/doc/qt +qutim\Qt\core\incPath=/usr/include/qt +qutim\Qt\core\libInfix= +qutim\Qt\core\libPath=/usr/lib +qutim\Qt\core\mkspecPath=/usr/lib/qt/mkspecs/linux-g++ +qutim\Qt\core\namespace= +qutim\Qt\core\pluginPath=/usr/lib/qt/plugins +qutim\Qt\core\qtConfig=minimal-config, small-config, medium-config, large-config, full-config, gtk2, gtkstyle, fontconfig, libudev, evdev, xlib, xcb-glx, xcb-xlib, xcb-sm, xrender, accessibility-atspi-bridge, linuxfb, c++11, accessibility, opengl, shared, qpa, reduce_exports, reduce_relocations, clock-gettime, clock-monotonic, mremap, getaddrinfo, ipv6ifname, getifaddrs, inotify, eventfd, system-jpeg, system-png, png, system-freetype, no-harfbuzz, system-zlib, nis, cups, iconv, glib, dbus, dbus-linked, openssl-linked, xcb, xinput2, alsa, pulseaudio, icu, concurrent, audio-backend, release +qutim\Qt\core\version=5.2.0 +qutim\cpp\compilerName=clang++ +qutim\cpp\toolchainInstallPath=/usr/bin +qutim\qbs\architecture=x86_64 +qutim\qbs\endianness=little +qutim\qbs\toolchain=clang, llvm, gcc diff --git a/resources/docs/qutim-qt5-git/qutim-qbs-1.1.patch b/resources/docs/qutim-qt5-git/qutim-qbs-1.1.patch new file mode 100644 index 0000000..6fcfe35 --- /dev/null +++ b/resources/docs/qutim-qt5-git/qutim-qbs-1.1.patch @@ -0,0 +1,35 @@ +diff -ruN qutim.orig/core/libqutim.qbs qutim/core/libqutim.qbs +--- qutim.orig/core/libqutim.qbs 2014-01-06 15:39:56.000000000 +0400 ++++ qutim/core/libqutim.qbs 2014-01-06 15:44:54.502175067 +0400 +@@ -75,7 +75,7 @@ + cpp.linkerFlags: { + var flags = base; + if (qbs.toolchain.contains("clang") && qbs.targetOS.contains("linux")) +- flags = flags.concat("-stdlib=libc++ -lcxxrt"); ++ flags = flags.concat("-lc++abi"); + return flags; + } + +diff -ruN qutim.orig/protocols/jabber/jreen/jreen.qbs qutim/protocols/jabber/jreen/jreen.qbs +--- qutim.orig/protocols/jabber/jreen/jreen.qbs 2014-01-06 15:41:33.000000000 +0400 ++++ qutim/protocols/jabber/jreen/jreen.qbs 2014-01-06 15:44:54.502175067 +0400 +@@ -2,7 +2,7 @@ + + Project { + +- moduleSearchPaths: "qbs/modules" ++ qbsSearchPaths: "qbs/modules" + + references: "src/src.qbs" + } +diff -ruN qutim.orig/protocols/vkontakte/vreen/vreen.qbs qutim/protocols/vkontakte/vreen/vreen.qbs +--- qutim.orig/protocols/vkontakte/vreen/vreen.qbs 2014-01-06 15:41:42.000000000 +0400 ++++ qutim/protocols/vkontakte/vreen/vreen.qbs 2014-01-06 15:46:47.142178486 +0400 +@@ -5,6 +5,7 @@ + property string vreen_qml_path: "bin" + property string vreen_lib_path: "lib" + property string vreen_libexec_path: "lib" ++ property string lib_path: "lib" + + property string vreen_version_major: 1 + property string vreen_version_minor: 9 diff --git a/ru/_posts/2014-01-14-about-zshrc.html b/ru/_posts/2014-01-14-about-zshrc.html index d878337..f71f5c1 100644 --- a/ru/_posts/2014-01-14-about-zshrc.html +++ b/ru/_posts/2014-01-14-about-zshrc.html @@ -8,14 +8,14 @@ short: about-zshrc description: Это моя статья в моем блоге (я думаю, мне нужно что-нибудь для тестов =)). Существует множество похожих статей и, я думаю, не буду отличаться от большинства. Я просто хочу показать мой .zshrc и объяснить, что в нем есть и зачем оно нужно. Также, любые комментарии или дополнения приветствуются. Оригинал статьи. commentIssueId: 5 --- -

Подготовка

+

Подготовка

Сначала установите необходимый минимум:

{% highlight bash %} pacman -Sy pkgfile zsh zsh-completions zsh-syntax-highlighting {% endhighlight %}

pkgfile очень полезная утилита. Данная команда также установит шелл, дополнения к нему и подсветку синтаксиса.

-

Настройка шелла

+

Настройка шелла

Все доступные опции приведены здесь.

Указываем файл с историей, число команд хранящихся в кэше текущего сеанса и число команд, хранящихся в файле:

@@ -112,7 +112,7 @@ setopt HIST_REDUCE_BLANKS source /usr/share/doc/pkgfile/command-not-found.zsh {% endhighlight %} -

Подсветка синтаксиса

+

Подсветка синтаксиса

{% highlight bash %} # highlighting source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh @@ -161,7 +161,7 @@ ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=yellow' # конс {% endhighlight %}

В первой строке включаем подсветку. Затем включаем основную подсветку, а также подсветку скобок и шаблонов. Шаблоны указываются ниже (rm -rf * в примере). Также может быть включена подсветка команд от root и курсора cursor. Синтаксис настроек понятен, fg цвет шрифта, bg цвет фона.

-

$PROMPT и $RPROMPT

+

$PROMPT и $RPROMPT

Я хочу использовать один файл .zshrc для рута и обычного пользователя:

{% highlight bash %} # PROMPT && RPROMPT @@ -239,7 +239,7 @@ $returncode\ {% endhighlight %}

Мой RPROMPT показывает текущее время, заряд батареи и код возврата последнего приложения. precmd() необходимо для автоматического обновления. Конструкция $(if.true.false) является условным оператором в zsh.

-

Аллиасы

+

Аллиасы

Копируйте только те аллиасы, которые Вам необходимы. Если какой-либо аллиас использует приложение, которое не установлено, это приведет к сбою загрузки конфигурационного файла.

Полезная (или не очень) функция:

@@ -327,7 +327,7 @@ alias -g h="| head" alias -g dn="&> /dev/null &" {% endhighlight %} -

Функции

+

Функции

Специальная функция для xrandr:

{% highlight bash %} @@ -439,7 +439,7 @@ yatest () { {% endhighlight %}

Но автодополнение для yaourt -Ss будет требовать привилегий рута.

-

Переменные

+

Переменные

Рекомендуется хранить свои переменные в ~/.zshenv. Но я все храню в одном файле.

Пути, маска создаваемых файлов, редактор и пейджер:

@@ -463,8 +463,8 @@ hash -d u1=/mnt/usbdev1 hash -d u2=/mnt/usbdev2 {% endhighlight %} -

Скриншот

+

Скриншот

-

Файл

+

Файл

Мой .zshrc.

diff --git a/ru/_posts/2014-01-21-building-qutim-using-qt5.html b/ru/_posts/2014-01-21-building-qutim-using-qt5.html new file mode 100644 index 0000000..d667264 --- /dev/null +++ b/ru/_posts/2014-01-21-building-qutim-using-qt5.html @@ -0,0 +1,200 @@ +--- +category: ru +type: paper +layout: paper +tags: archlinux, linux, сборка, qutim +title: Сборка Qutim с Qt5 +short: building-qutim-using-qt5 +description: Если кто-то не знает, Qutim - мультипротокольный кросс-платформенный месседжер. Написан он на CPP с использованием библиотек Qt. Проект активно развивается. В этой статье речь пойдет о реализации сборки данного пакета в Archlinux с использованием библиотек Qt5 (а не Qt4, как это делают текущие пакеты в AUR). +commentIssueId: 6 +--- +

Что не так?

+

Да все так. Просто пакет использует для сборки систему qbs, которая, на мой взгляд, немного странная. Пакет, необходимый для сборки, находится в AUR (рекомендую git-версию). Когда я спросил у Andrea Scarpino (который сопровождает все KDE и Qt пакеты в официальные репозитории) по поводу переноса этого пакета в репозитории, он ответил, что всему свое время. В принципе, я с ним согласен, так как проект, судя по всему, еще немного сыроват.

+ +

Подготовка

+

Установим зависимости. Что-то может быть пропустил, зависимости сканировал с использованием namcap:

+{% highlight bash %} +pacman -Sy --asdeps clang git libc++abi qt5-quick1 qt5-x11extras +yaourt -S --asdeps jreen-git qbs-git +{% endhighlight %} + +

Настройка qbs

+

Желающие могут почитать документацию по ссылке или посмотреть примеры (включены в пакет). Загвоздка в том, что эта штука использует файл настроек, который, во-первых, нужно сначала сгенерировать, во-вторых, хранится в домашней директории (и только там). В теории, генерация файла настроек (~/.config/QtProject/qbs.conf) происходит следующим образом:

+{% highlight bash %} +qbs-setup-qt --detect +qbs-detect-toolchains +{% endhighlight %} +

Сначала находим Qt для сборки, потом находим инструментарий (компиляторы, например). Дальше вставляем инструментарий (например, нам для Qutim нужен clang) в Qt, например, так:

+{% highlight bash %} +sed 's/clang\\/qt-5-2-0\\/g' -i ~/.config/QtProject/qbs.conf +{% endhighlight %} +

Альтернативные варианты - править файл вручную или воспользоваться qbs-config-ui или qbs-config на Ваш выбор.

+

Так или иначе, нужный файл мы сгенерировали, сохраним его в будущей директории сборки:

+{% highlight ini %} +[General] + +[Qt] +filedialog= + +[profiles] +clang\cpp\compilerName=clang++ +clang\cpp\toolchainInstallPath=/usr/bin +clang\qbs\architecture=x86_64 +clang\qbs\endianness=little +clang\qbs\toolchain=clang, llvm, gcc +gcc\cpp\compilerName=g++ +gcc\cpp\toolchainInstallPath=/usr/bin +gcc\qbs\architecture=x86_64 +gcc\qbs\endianness=little +gcc\qbs\toolchain=gcc +qutim\Qt\core\binPath=/usr/lib/qt/bin +qutim\Qt\core\buildVariant=release +qutim\Qt\core\config=shared, qpa, no_mocdepend, release, qt_no_framework +qutim\Qt\core\docPath=/usr/share/doc/qt +qutim\Qt\core\incPath=/usr/include/qt +qutim\Qt\core\libInfix= +qutim\Qt\core\libPath=/usr/lib +qutim\Qt\core\mkspecPath=/usr/lib/qt/mkspecs/linux-g++ +qutim\Qt\core\namespace= +qutim\Qt\core\pluginPath=/usr/lib/qt/plugins +qutim\Qt\core\qtConfig=minimal-config, small-config, medium-config, large-config, full-config, gtk2, gtkstyle, fontconfig, libudev, evdev, xlib, xcb-glx, xcb-xlib, xcb-sm, xrender, accessibility-atspi-bridge, linuxfb, c++11, accessibility, opengl, shared, qpa, reduce_exports, reduce_relocations, clock-gettime, clock-monotonic, mremap, getaddrinfo, ipv6ifname, getifaddrs, inotify, eventfd, system-jpeg, system-png, png, system-freetype, no-harfbuzz, system-zlib, nis, cups, iconv, glib, dbus, dbus-linked, openssl-linked, xcb, xinput2, alsa, pulseaudio, icu, concurrent, audio-backend, release +qutim\Qt\core\version=5.2.0 +qutim\cpp\compilerName=clang++ +qutim\cpp\toolchainInstallPath=/usr/bin +qutim\qbs\architecture=x86_64 +qutim\qbs\endianness=little +qutim\qbs\toolchain=clang, llvm, gcc +{% endhighlight %} +

qbs-qutim.conf

+ +

Готовим патч для исходников

+

Первая проблема - clang (по крайней мере, в Archlinux):

+{% highlight diff %} +diff -ruN qutim.orig/core/libqutim.qbs qutim/core/libqutim.qbs +--- qutim.orig/core/libqutim.qbs 2014-01-06 15:39:56.000000000 +0400 ++++ qutim/core/libqutim.qbs 2014-01-06 15:44:54.502175067 +0400 +@@ -75,7 +75,7 @@ + cpp.linkerFlags: { + var flags = base; + if (qbs.toolchain.contains("clang") && qbs.targetOS.contains("linux")) +- flags = flags.concat("-stdlib=libc++ -lcxxrt"); ++ flags = flags.concat("-lc++abi"); + return flags; + } + +{% endhighlight %} +

Далее пофиксить устаревший стандарт qbs:

+{% highlight diff %} +diff -ruN qutim.orig/protocols/jabber/jreen/jreen.qbs qutim/protocols/jabber/jreen/jreen.qbs +--- qutim.orig/protocols/jabber/jreen/jreen.qbs 2014-01-06 15:41:33.000000000 +0400 ++++ qutim/protocols/jabber/jreen/jreen.qbs 2014-01-06 15:44:54.502175067 +0400 +@@ -2,7 +2,7 @@ + + Project { + +- moduleSearchPaths: "qbs/modules" ++ qbsSearchPaths: "qbs/modules" + + references: "src/src.qbs" + } +{% endhighlight %} +

И пофиксить сборку библиотеки для Vk:

+{% highlight diff %} +diff -ruN qutim.orig/protocols/vkontakte/vreen/vreen.qbs qutim/protocols/vkontakte/vreen/vreen.qbs +--- qutim.orig/protocols/vkontakte/vreen/vreen.qbs 2014-01-06 15:41:42.000000000 +0400 ++++ qutim/protocols/vkontakte/vreen/vreen.qbs 2014-01-06 15:46:47.142178486 +0400 +@@ -5,6 +5,7 @@ + property string vreen_qml_path: "bin" + property string vreen_lib_path: "lib" + property string vreen_libexec_path: "lib" ++ property string lib_path: "lib" + + property string vreen_version_major: 1 + property string vreen_version_minor: 9 +{% endhighlight %} +

qutim-qbs-1.1.patch

+ +

Получаем исходники

+{% highlight bash %} +# клонируем репозиторий +git clone https://github.com/euroelessar/qutim +# кладем файл настроек qbs +mkdir -p .config/QtProject +cp qbs-qutim.conf .config/QtProject/qbs.conf +# создаем директорию сборки +mkdir build +# обновляем подмодули +cd qutim +git submodule update --init --recursive +# патчим +cd .. +patch -p0 -i qutim-qbs-1.1.patch +{% endhighlight %} + +

Сборка

+{% highlight bash %} +cd qutim +HOME=$(pwd) qbs -j $(nproc) -d ../build release profile:qutim +{% endhighlight %} +

Я пытался сделать универсальный способ сборки пакета, поэтому такое странное переназначение домашней директории. Флаг -j указывает число потоков сборки, флаг -d директорию сборки, release тип сборки (debug, release), profile используемый профиль, описанный в файле настроек.

+ +

Установка

+{% highlight bash %} +HOME=$(pwd) sudo qbs install -d ../build --install-root "/usr" profile:qutim +{% endhighlight %} +

Из нового - указание корневого каталога (--install-root). Без этого пакет будет установлен в / (/bin и /lib).

+ +

PKGBUILD

+{% highlight bash %} +pkgname=qutim-qt5-git +_gitname=qutim +pkgver=v0.3.1.967.gc56d61e +pkgrel=1 +pkgdesc="Multiplatform instant messenger (qt5 build). Git version" +arch=('i686' 'x86_64') +url="http://qutim.org" +license=('LGPL' 'GPL3') +depends=('jreen-git' 'libc++abi' 'qt5-quick1' 'qt5-x11extras') +makedepends=('clang' 'qbs') +conflicts=(qutim-0.2_ru-git, qutim-0.3-git, qutim-stable, qutim-git) +source=("${_gitname}::git+https://github.com/euroelessar/qutim.git" + "qutim-qbs-1.1.patch" + "qbs-qutim.conf") +md5sums=('SKIP' + 'c0f151c43c055f76d3fa3efa3b8005e0' + '40f096b269eb00b040035591fce8e259') + +pkgver() { + cd "${_gitname}" + git describe --always | sed 's|-|.|g' +} + +prepare() { + # FIXME: dirty hack + mkdir -p "${srcdir}/.config/QtProject" + cp "${srcdir}/qbs-qutim.conf" "${srcdir}/.config/QtProject/qbs.conf" + # create build directory + if [[ -d ${srcdir}/build ]]; then + rm -rf "${srcdir}/build" + fi + mkdir "${srcdir}/build" + + cd "${_gitname}" + # update modules + git submodule update --init --recursive + # fix qbs build + cd .. + patch -p0 -i "${srcdir}/qutim-qbs-1.1.patch" +} + +build() { + cd "${_gitname}" + HOME="${srcdir}" qbs -j $(nproc) -d ../build release profile:qutim +} + +package() { + cd "${srcdir}/${_gitname}" + HOME="${srcdir}" qbs install -d ../build --install-root "${pkgdir}/usr" profile:qutim +} +{% endhighlight %} +

PKGBUILD