Erste Schritte

JHBuild erfordert einige Konfigurationsschritte, bevor Software erstellt werden kann. JHBuild hat einige Abhängigkeiten, und es ist nötig, einige Werkzeuge zu installieren, um Softwaremodule zu erhalten und zu erstellen.

2.1. Installieren von JHBuild

JHBuild benötigt eine Python-Laufzeitumgebung. Stellen Sie sicher, dass Python >= 2.3 installiert ist.

The recommended way to download JHBuild is via the version control system, git. This can be achieved with the following command. It is recommended to run the command from a new directory where all source code will be installed, for example, ~/jhbuild/checkout.

$ git clone git://git.gnome.org/jhbuild
...
$

Dadurch wird JHBuild in einen neuen Ordner namens jhbuild unterhalb des aktuellen Ordners heruntergeladen. Nun können Sie JHBuild erstellen und installieren:

$ cd jhbuild
$ ./autogen.sh
...
$ make
...
$ make install
...
$

If gnome-common, yelp-tools and autotools are available, autogen.sh will configure JHBuild to install via autotools. If gnome-common, yelp-tools and autotools are not available, autogen.sh will configure JHBuild to install via a plain Makefile. To always use the plain Makefile method pass --simple-install to autogen.sh.

Falls die oben genannten Schritte erfolgreich verlaufen, wird in ~/.local/bin ein kleines Shell-Skript installiert, welches JHBuild startet. Fügen Sie ~/.local/bin zur Variable PATH hinzu:

$ PATH=$PATH:~/.local/bin
$

Um ~/.local/bin dauerhaft zur Variable PATH hinzuzufügen, führen Sie folgenden Befehl aus:

$ echo 'PATH=$PATH:~/.local/bin' >> ~/.bashrc
$

2.2. Konfiguriere von JHBuild

JHBuild can be configured via a configuration file. The default location is ~/.config/jhbuildrc. If a configuration file does not exist, the defaults are used. The configuration file uses Python syntax. An example is provided, see examples/sample.jhbuildrc. Copy examples/sample.jhbuildrc to ~/.config/jhbuildrc and customize as required.

The sample configuration will make JHBuild build the meta-gnome-core and meta-gnome-apps-tested modules and dependencies from the gnome-apps module set. JHBuild will unpack source trees to ~/jhbuild/checkout/ and install all files to subdirectories of ~/jhbuild/install/. The two directories must be writable.

Konfigurationsvariablen sind in Abschnitt 6 ― Referenz der Konfigurationsdatei dokumentiert. Einige der am häufigsten verwendeten Variablen sind:

repos

A dictionary that can be used to specify an alternative repository location for a particular repository. This configuration variable is useful to a module developer. By default, JHBuild will check out code from repositories using an anonymous repository location. The dictionary keys are short repository names and the values are alternative repository location strings. For example:

repos['git.gnome.org'] = 'ssh://Benutzername@git.gnome.org/git/'
moduleset

A string or list of strings specifying the name(s) of the module set(s) to use. This can either be the filename of a moduleset included with JHBuild (excluding the path and extension), or a full HTTP URL to an externally managed moduleset. HTTP URL modulesets are cached locally. If a module with the same name is present in more than one moduleset, the last set listed takes priority. Modulesets provided with JHBuild are updated to match the current GNOME development release.

modules

A list of strings specifying the modules to build. The list of modules actually built will be recursively expanded to include all the dependencies unless the buildone command is used. Defaults to ['meta-gnome-desktop'].

checkoutroot

A string specifying the directory to unpack source trees to. Unless buildroot is set, builds will occur in this directory too. Defaults to ~/jhbuild/checkout.

prefix

A string specifying the prefix to install modules to. prefix must be an absolute path. This directory must be writable. Defaults to '~/jhbuild/install/'.

autogenargs

A string containing arguments passed to the autogen.sh script of all modules. Can be overridden for particular modules using the module_autogenargs dictionary.

makeargs

A string listing additional arguments to be passed to make. JHBuild will automatically append the parallel execution option (-j) based upon available CPU cores. Defaults to ''.

2.3. Voraussetzungen zur Erstellung

Before any modules can be built, it is necessary to have certain build tools installed. Common build tools include the GNU Autotools (autoconf, automake, libtool and gettext), The GNU Toolchain (binutils, gcc, g++), make, pkg-config and Python, depending on which modules will be built.

JHBuild kann das Vorhandensein dieser Werkzeuge mit dem Befehl sanitycheck überprüfen:

$ jhbuild sanitycheck

If this command displays any messages, please install the required package from your distribution's repository. A list of package names for different distributions is maintained on the GNOME wiki. Run the sanitycheck command again after installing the distribution's packages to ensure the required tools are present.

2.4. Verwendung von JHBuild

After set up is complete, JHBuild can be used to build software. To build all the modules selected in the ~/.config/jhbuildrc file, run the following command:

$ jhbuild build

JHBuild lädt jedes der Module herunter, konfiguriert, kompiliert und installiert es. Falls in einer der Stufen Fehler auftreten, öffnet JHBuild ein Menü, um nach der weiteren Vorgehensweise zu fragen. Die Auswahl umfasst die Weiterleitung in eine Shell zum Beheben des Fehlers, die erneute Ausführung aus verschiedenen Stufen, Aufgeben oder Ignorieren des Fehlers und Fortsetzen.

Das Aufgeben eines Moduls wirkt sich auf die davon abhängigen Module aus, wodurch deren Erstellung scheitert.

Es folgt ein Beispiel des angezeigten Menüs:

  [1] Rerun phase build
  [2] Ignore error and continue to install
  [3] Give up on module
  [4] Start shell
  [5] Reload configuration
  [6] Go to phase "wipe directory and start over"
  [7] Go to phase "configure"
  [8] Go to phase "clean"
  [9] Go to phase "distclean"
choice: 

Es ist auch möglich, einen Modulsatz und dessen Abhängigkeiten zu erstellen, indem Sie die Modulnamen als Argumente an den build-Befehl übergeben. So erstellen Sie beispielsweise gtk+:

$ jhbuild build gtk+

If JHBuild is cancelled part way through a build, it is possible to resume the build at a particular module using the --start-at option:

$ jhbuild build --start-at=pango

To build one or more modules, ignoring their dependencies, JHBuild provides the buildone command. For the buildone command to complete successfully, all dependencies must be previously built and installed or provided by distribution packages.

$ jhbuild buildone gtk+

When actively developing a module, you are likely in a source working directory. The make will invoke the build system and install the module. This will be a key part of your edit-compile-install-test cycle.

$ jhbuild make

If JHBuild is cancelled part way through a build, it is possible to resume the build at a particular module using the --start-at option:

To get a list of the modules and dependencies JHBuild will build, and the order they will be built, use the list command:

$ jhbuild list

Um Informationen über ein bestimmtes Modul anzuzeigen, verwenden Sie den Befehl info:

$ jhbuild info gtk+

To download or update all the software sources without building, use the update command. The update command provides an opportunity to modify the sources before building and can be useful if internet bandwidth varies.

$ jhbuild update

Später kann JHBuild alles ohne Herunterladen oder Aktualisieren der Quellen erstellen:

$ jhbuild build --no-network

Um einen Befehl in der auch von JHBuild genutzten Umgebung auszuführen, benutzen Sie den run-Befehl:

$ jhbuild run program

Um eine Shell in der auch von JHBuild genutzten Umgebung auszuführen, benutzen Sie den shell-Befehl:

$ jhbuild shell