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 ~/jhbuild/checkout.
$ git clone https://gitlab.gnome.org/GNOME/jhbuild.git ... $
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 ... $
Wenn gnome-common, yelp-tools und autotools verfügbar sind, so wird autogen.sh JHBuild anweisen mit autotools zu installieren. Wenn gnome-common, yelp-tools und autotools nicht verfügbar sind, so wird autogen.sh JHBuild anweisen, mit einem Makefile zu installieren. Um immer die Methode mit Makefile zu verwenden, verwenden Sie die Option --simple-install für 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. Konfigurieren von JHBuild
JHBuild wird über eine Konfigurationsdatei eingerichtet. Die Datei befindet sich normalerweise unter ~/config/.jhbuildrc. Wenn keine Datei vorhanden ist, so werden die Voreinstellungen verwendet. Die Datei nutzt die Python-Syntax zum Festlegen der Konfigurationsvariablen. Ein Beispiel ist im Ordner examples/sample.jhbuildrc. Kopieren Sie examples/sample.jhbuildrc nach ~/.config/.jhbuildrc und passen Sie die Datei nach Ihren Wünschen an.
Mit der Beispielkonfiguration erstellt JHBuild die Module meta-gnome-desktop und meta-gnome-apps-tested sowie deren Abhängigkeiten aus dem Modulsatz gnome-apps. JHBuild entpackt die Quellbäume nach ~/jhbuild/checkout/ und installiert alle Dateien in Unterordner von ~/jhbuild/install/. Für diese zwei Ordner müssen Schreibrechte vorhanden sein.
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. If buildroot is set to None, 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.
- cmakeargs
-
A string containing arguments passed to the cmake invocation of all modules. Can be overridden for particular modules using the module_cmakeargs 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 ''.
- mesonargs
-
A string containing arguments passed to the meson invocation of all modules. Can be overridden for particular modules using the module_mesonargs dictionary.
- ninjaargs
-
A string listing additional arguments to be passed to ninja. 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++), make, 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
Wenn dieser Befehl eine Meldung ausgibt, dann installieren Sie bitte 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.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 ~/.config/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"
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
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