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.

Der empfohlene Weg zum Herunterladen von JHBuild führt über das Versionsverwaltungssystem git. Dieses erreichen Sie mit dem folgenden Befehl. Es ist empfehlenswert, den Befehl in einem neuen Ordner auszuführen, in welchem der Quellcode installiert wird, beispielsweise ~/checkout/gnome.

$ 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, gnome-doc-utils and autotools are available, autogen.sh will configure JHBuild to install via autotools. If gnome-common, gnome-doc-utils 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
$

Bevor JHBuild ausgeführt werden kann, muss eine Konfiguration eingerichtet werden, die sich in der Datei ~/.jhbuildrc befindet.

2.2. Konfiguriere von JHBuild

The ~/.jhbuildrc file uses Python syntax to set configuration variables for JHBuild. An example is provided with JHBuild, see examples/sample.jhbuildrc. Copy examples/sample.jhbuildrc to ~/.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-3.4 module set. JHBuild will unpack source trees to ~/checkout/gnome and install all files to subdirectories of /opt/gnome. 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 ~/checkout/gnome.

prefix

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

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. Defaults to ''.

2.3. Voraussetzungen zur Erstellung

Bevor irgendwelche Module erstellt werden können, müssen zunächst verschiedenen Erstellungswerkzeuge installiert sein. Diese umfassen die GNU Autotools (autoconf, automake, libtool und gettext), die GNU Toolchain (binutils, gcc, g++), pkg-config und Python, je nachdem, welche Module erstellt werden sollen.

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

$ jhbuild sanitycheck

Falls dieser Befehl Fehlermeldungen ausgibt, können die Fehler auf folgende Arten behoben werden:

  1. Installieren Sie das benötigte Paket aus dem Softwarebestand Ihrer Distribution. Eine Liste von Paketnamen für verschiedene Distributionen finden Sie im GNOME-Wiki. Führen Sie den Befehl sanitycheck nach der Installation der Distributionspakete erneut aus, um sicherzustellen, dass die benötigten Werkzeuge vorhanden sind.

  2. Führen Sie den bootstrap-Befehl aus, um die Voraussetzungen zur Erstellung herunterzuladen, zu erstellen und zu installieren:

    $ jhbuild bootstrap

    Wenn dies abgeschlossen ist, führen Sie den Befehl sanitycheck aus, um sicherzustellen, dass die benötigten Werkzeuge vorhanden sind.

    Der bootstrap-Befehl erstellt nicht alle von den Erstellungswerkzeugen benötigten Paketabhängigkeiten. Falls Ihre Distribution nicht alle benötigten Pakete bereitstellt, müssen diese außerhalb der JHBuild-Umgebung erstellt werden.

    Zu den abhängigen Erstellungswerkzeugen gehören m4 perl und ein C-Compiler (zum Beispiel gcc).

2.4. Verwendung von JHBuild

Nachdem die Einrichtung abgeschlossen ist, kann JHBuild zum Erstellen von Software verwendet werden. Führen Sie zum Erstellen aller in der Datei ~/.jhbuildrc ausgewählten Module den folgenden Befehl aus:

$ 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"
Auswahl: 

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+

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 Programm

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

$ jhbuild shell