The Mer Wiki now uses your Mer user account and password (create account on https://bugs.merproject.org/)


Nemo/Qt5Porting

From Mer Wiki
< Nemo
Revision as of 20:42, 9 April 2013 by W00t (Talk | contribs)

Jump to: navigation, search

Contents

Introduction

Nemo needs to be ready for Qt 5. This page attempts to document some information on how we're approaching that, as well as common hurdles and approaches.

Approach

With the advent of webhooks, we are now able to easily build software we maintain on OBS just with git interaction. Luckily, it also gives us the capability to build a single source repository in multiple places, possibly with different spec files. We're taking advantage of this to (where possible) to ports in-place by adding qt5 packaging, and hacking the build system and code to handle that conditionally where possible.

NB: this document does not attempt to handle porting of software we do not maintain. Yet.

Rules of thumb:

  • Keep the ports in-place where possible! Same source tree and branch as the qt4 version. If this isn't possible, talk to someone (i.e. w00t) about why to make sure it isn't, and let's figure out an alternative strategy.
  • Keep the ports minimal: use ifdefs and defines to minimize the pain in fairly central places (see below for some examples). This avoids you accidentally breaking something and keeps the maintenance cost minimal.
  • While you're porting, examine opportunities to minimize dependencies. Some code pulls in all sorts of crazy crap (an example: libmlocale pulled *everything in Qt* into the QT variable, even though it used basically none of it.)

Initial setup

Make sure the project has been set up for git packaging:

If these steps aren't OK, then fix it.

Then:

  • Add a new set of packaging following the name convention as follows: libfoo-qt => libfoo-qt5, libfoo => libfoo5
  • Add dependencies to minimal needed Qt 5 modules (e.g. Qt5Core, Qt5Xml, etc in PkgConfigBR)
  • Add a new webhook for it, building to package name following the above naming convention
  • Start hacking using mb to build the new packaging

Build System

Use constructs like the following to handle conditionals:

equals(QT_MAJOR_VERSION, 4): TARGET = foo
equals(QT_MAJOR_VERSION, 5): TARGET = foo5

Use QT_VERSION and QT_VERSION_CHECK in code, like this:

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
# include <QtQml>
# include <QQmlEngine>
# include <QQmlExtensionPlugin>
# define QDeclarativeEngine QQmlEngine
# define QDeclarativeExtensionPlugin QQmlExtensionPlugin
#else
# include <QtDeclarative>
# include <QDeclarativeEngine>
# include <QDeclarativeExtensionPlugin>
#endif
Personal tools