[PATCH v2] jhbuildrc: Make configuration and usage easier
Dirk Wallenstein
halsmit at t-online.de
Fri Apr 30 01:13:37 PDT 2010
This adds extensive documentation and examples for the most important
configuration variables of jhbuild. Additionally this allows to specify
paths with a leading tilde, and ensures that the paths are absolute
otherwise.
Signed-off-by: Dirk Wallenstein <halsmit at t-online.de>
---
I've defaulted to the URL for the moduleset, because it seems clearer
for the completely unedited case.
The default for moduleset is 'gnome-*' which is never what we want here.
Therefore the value None can be used to select the util/modular clone
behavior.
jhbuildrc | 296 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 281 insertions(+), 15 deletions(-)
diff --git a/jhbuildrc b/jhbuildrc
index de6a037..288ae38 100644
--- a/jhbuildrc
+++ b/jhbuildrc
@@ -1,25 +1,291 @@
# how to use this file?
#
-# mkdir -p $HOME/xorg/util
-# git clone git://anongit.freedesktop.org/git/xorg/util/modular/ $HOME/xorg/util/modular
-# jhbuild -f $HOME/xorg/util/modular/jhbuildrc
+# Make a copy of this file and edit the two variables in the main configuration
+# section, or leave them at the default values. Then start the build process
+# with:
+# $> jhbuild -f <your-edited-copy-of-this-file>
+
+# You may use a '~' or '~user' preamble in all variables that require a path
+# specification. Currently those are checkoutroot, prefix, buildroot, and
+# moduleset. Otherwise, the paths must be absolute.
+
+#-------- Main Configuration ---------------------------------------
+
+# The variables in this section are all you need to care about, if you want to
+# build all of Xorg with the default build settings.
+
+# Specify the destination path for the sources.
+# The value None will select the directory 'xorg-source' in your home
+# directory, as a path specification compatible with your operating system.
+#checkoutroot = '~/xorg-source'
+checkoutroot = None
+
+# Specify the destination path for the installation.
+# The value None will select the directory 'xorg-install' in your home
+# directory, as a path specification compatible with your operating system.
+#prefix = '~/xorg-install'
+prefix = None
+
+#-------- Advanced Configuration ----------------------------------
+
+# You can specify a directory for the intermediate build files.
+# Default is None, which will use checkoutroot.
+#buildroot = '~/xorg-intermediate-build-files'
+
+# The moduleset variable holds the path or an URL to a file that describes the
+# available modules and their dependencies. It is an XML file that you can edit
+# to create your own groups of modules.
+#
+# Path: If you have a privately modified modules file, you can specify the path
+# to it in the moduleset variable. You can download the default xorg.modules
+# file here: http://cgit.freedesktop.org/xorg/util/modular/blob/xorg.modules.
+#
+# URL: You can also specify the URL, which will involve local caching. The
+# cached file will be located at (~/.cache/jhbuild/xorg.modules)
+#
+# None: If it this variable is set to None, the modular repository will
+# be cloned into the checkoutroot location, if it does not exist, and
+# the default xorg.modules file located in there will be used.
+#moduleset = '~/.xjhbuild/xorg.modules'
+#moduleset = None
+moduleset = 'http://cgit.freedesktop.org/xorg/util/modular/blob/xorg.modules'
+
+# If nonetwork is set to True, the pull for each module will be avoided when
+# using the build or buildone jhbuild-commands. You can request a pull for one
+# or more modules with the update and updateone jhbuild-commands.
+# This option corresponds to the --no-network switch of the build and buildone
+# commands. Tip: Setting this to True prevents accidental conflicts when you
+# just want to build a module.
+#nonetwork = True
+
+# The nobuild option is a convenience setting for people, who only want to
+# track the repositories with jhbuild but never want to build anything of it.
+# You cannot build something then, so this can act as a big lock.
+# Warning: The message when trying to build something anyway is simply
+# "***success***", so you must be very well aware of this, when activating this
+# lock.
+#nobuild = True
+
+# By default, the notification daemon will be used to inform you about build
+# failures. Use nonotify=True to turn it off. (On Windows notification is
+# turned off by default).
+#nonotify = True
+
+# If you have Zenity >= 2.9 installed, you get a tray icon that shows the
+# status of the build process in a tool-tip. You can prevent that icon by
+# setting notrayicon to True.
+#notrayicon = True
+
+# The variable installprog holds a string specifying a program to use as
+# replacement for /usr/bin/install. If available, defaults to the install-check
+# wrapper provided by JHBuild. The install-check wrapper optimizes header
+# installation to reduce the time taken for rebuilds.
+# The $PATH environment variable is taken into account, so you can specify just
+# 'install', for example.
+#installprog = 'install'
+
+# The build_policy holds a string specifying which modules to build. The three
+# possible options are 'all', to build all modules requested, 'updated' to
+# build only modules which have changed, or 'updated-deps' to build modules
+# which have changed or which have dependencies which have changed. Defaults to
+# 'all'.
+# This does not take dirty worktrees into account, but only triggers if HEAD
+# changed. In consequence, it's probably best to only deviate from 'all' if you
+# intend to never edit the source files yourself.
+#build_policy = 'updated-deps'
+#build_policy = 'updated'
+#build_policy = 'all'
+
+# Select modules to build:
+# ------------------------
+# The modules variable holds a list of strings that refer to the values of the
+# id='xyz' attributes in the moduleset file. All ids given here, will be
+# recursively expanded to the dependencies listed in the corresponding tag in
+# the moduleset.
+#
+# You can get a list of all available ids with:
+# $> jhbuild -f <this-file> list -a
+# You can get a list of all the modules that will be build with the current
+# settings by executing:
+# $> jhbuild -f <this-file> list
+# You can override this variable by specifying other module-ids on the
+# command-line for all major jhbuild-commands (build, buildone, update,
+# updateone, clean, uninstall, info, list)
+#
+# The 'xorg' id implies the following ids:
+# 'xorg-protos' 'xorg-libs' 'xorg-apps' 'xorg-fonts' 'xorg-drivers'
+# 'xorg-docs' 'xserver' 'xkeyboard-config'
#
-# Source tree will be in $HOME/xorg
-# Binaries will be in $HOME/xorg-build
+# Metamodule ids not included in 'xorg':
+# 'xorg-unmaintained-broken-drivers' 'xorg-sun-drivers' 'xorg-x86-drivers'
#
+# You can edit the moduleset file, and define your own metamodules. A good
+# template for that is the 'xorg' metamodule at the bottom of the default
+# moduleset file.
+#modules = ['xserver', 'xorg-apps', 'xorg-drivers']
+modules = ['xorg']
+
+# Select modules to skip:
+# -----------------------
+# Skip operations on some modules. This is useful if you are generally content
+# with a metamodule but want to exclude just some module-ids.
+# But, beware. This will not omit every operation. You can for example still
+# uninstall the module through jhbuild. The modules won't be considered for the
+# list, build, update, and clean commands of jhbuild, even if specified
+# directly on the command-line.
+#skip = ['xorg-docs', 'xwud']
+
+# Pass arguments to autogen.sh:
+# -----------------------------
+# The string given in autogenargs will be passed to the autogen.sh script of
+# all modules. You will get 'unrecognized options' warnings for modules that
+# don't know that option, but that is not fatal to the build process.
+#autogenargs = '--cache-file=/usr/src/jhmodular/configure-cache --disable-static'
+#autogenargs = '--without-xmlto'
-#moduleset = 'http://cgit.freedesktop.org/xorg/util/modular/blob/xorg.modules'
-# Requires the module set be in $HOME/xorg/util/modular/
-moduleset = os.path.join(os.environ['HOME'], 'xorg', 'util', 'modular', 'xorg.modules')
+# Per-module arguments passed to autogen.sh. This will override the general
+# arguments from 'autogenargs' for the specified module completely.
+#module_autogenargs = {
+# 'xserver' : '--disable-silent-rules',
+# 'libXfont' : '--disable-silent-rules --without-xmlto',
+#}
-modules = [ 'xorg' ]
+# Pass arguments to make:
+# -----------------------
+# The string given in makeargs will be passed to the make invocation of every
+# module. Defaults to ''.
+#makeargs = '-j4 V=1 CC="ccache distcc"'
+#makeargs = 'CFLAGS="-O0 -g3"'
-# All modules will be in $HOME/xorg/ after the checkout
-checkoutroot = os.environ['HOME']
-prefix = os.path.join(os.environ['HOME'], 'xorg-build')
+# Per-module arguments passed to make. This will override the general
+# arguments from 'makeargs' for the specified module completely.
+#module_makeargs = {
+# 'xserver' : 'CFLAGS="-O0 -g3" V=0',
+# 'libX11' : 'CFLAGS="-O0 -g3"',
+# 'libxcb' : 'CFLAGS="-O0 -g3"',
+#}
+
+# Modify the environment for the build process:
+# ---------------------------------------------
+# The modified environment will also be available to <prg> when you execute
+# $> jhbuild -f <this-file> run <prg>
+# or when you obtain a shell with
+# $> jhbuild -f <this-file> shell
+#
+# The environment for the whole build process is modified with the os.environ
+# dictionary. The environment variables ACLOCAL and PKG_CONFIG_PATH are set at
+# the bottom of this file, after expanding 'prefix' to an absolute path.
+#os.environ['CFLAGS'] = '-O0 -g3'
+#os.environ['V'] = '1'
+
+# You can additionally modify the environment on a per-module basis with
+# elements in the module_extra_env dictionary. This does only selectively
+# override the settings from os.environ. If an environment variable is set both
+# in os.environ and in module_extra_env, the latter takes precedence for a
+# particular module only.
+# Note: If you use the --in-builddir or --in-checkoutdir switches when
+# attempting to execute a programm with `jhbuild run`, the module_extra_env
+# settings do not apply.
+# module_extra_env is a dictionary mapping module-ids to another dictionary
+# that maps environment variable names to their values. Both keys and the
+# nested values are strings.
+#module_extra_env = {
+# 'xkbcomp' : {
+# 'CFLAGS' : '-O0 -g3',
+# 'V' : '1',
+# 'ONE_DE_VAR' : 'de-nodead',
+# },
+# 'libX11' : {
+# 'CFLAGS' : '-O0 -g3',
+# },
+#}
+
+# Notes:
+# ------
+# The keys in the dictionaries are the id='xyz' attributes in the module file
+# (moduleset). Except for a very few modules, the ids correspond to the
+# basename of the repository root directory.
+#
+# The jhbuild option 'branches' seems to be usable only with the repo type
+# 'monotone'. You cannot request branch switches in git repositories.
+#
+# Contemporary versions of python allow the last element of a dictionary
+# definition to be followed by a comma. This can facilitate editing.
+
+#----------------- Additional Variable Processing ---------------------
+
+def checkOutModularIfNonExistent(reporoot):
+ """
+ Obtain the util/modular module.
+
+ Automating this task, simplifies the configuration effort for a user who
+ wants to build all of xorg, and has obtained this file through a direct
+ download.
+ """
+
+ modular_destination = os.path.join(reporoot, 'xorg', 'util', 'modular')
+
+ if not os.path.exists(modular_destination):
+ try:
+ os.makedirs(modular_destination)
+ except OSError, error:
+ sys.exit("Error: Could not create the path to the modular repo "
+ "(%s). The error message is : %s" \
+ % (modular_destination, error))
+
+ if os.system("git clone "
+ "git://anongit.freedesktop.org/git/xorg/util/modular/ '%s'" \
+ % modular_destination) != 0:
+ sys.exit("Error: Could not clone util/modular")
+
+# Expand a leading tilde in prefix, checkoutroot, moduleset and
+# buildroot. Ensure the paths are abolute after that expansion (jhbuild
+# does not enforce that).
+if prefix != None:
+ prefix = os.path.expanduser(prefix)
+ if not os.path.isabs(prefix):
+ sys.exit("Error: The path given for 'prefix' is not absolute : " \
+ "\"%s\"" % prefix)
+else:
+ prefix = os.path.join(os.environ['HOME'], 'xorg-install')
+
+if checkoutroot != None:
+ checkoutroot = os.path.expanduser(checkoutroot)
+ if not os.path.isabs(checkoutroot):
+ sys.exit("Error: The path given for 'checkoutroot' is not absolute : "\
+ "\"%s\"" % checkoutroot)
+else:
+ checkoutroot = os.path.join(os.environ['HOME'], 'xorg-source')
+
+if buildroot != None:
+ buildroot = os.path.expanduser(buildroot)
+ if not os.path.isabs(buildroot):
+ sys.exit("Error: The path given for 'buildroot' is not absolute : " \
+ "\"%s\"" % buildroot)
+
+if moduleset != None:
+ moduleset = os.path.expanduser(moduleset)
+ if not moduleset.startswith('http:') and not os.path.isabs(moduleset):
+ sys.exit("Error: The path given for 'moduleset' is not absolute : " \
+ "\"%s\"" % moduleset)
+
+# If moduleset has been set to None, we will use the default moduleset from the
+# modular repo. If the modular repo does not yet exist, it will be checked out.
+if moduleset == None:
+ checkOutModularIfNonExistent(checkoutroot)
+ moduleset = os.path.join(\
+ checkoutroot, 'xorg', 'util', 'modular', 'xorg.modules')
+
+# At this point we got to have a moduleset.
+if not moduleset.startswith('http:') and not os.path.isfile(moduleset):
+ sys.exit("Module file \"%s\" does not exist" % moduleset)
+
+# Add prefix and checkout to the environment, so that programms run through
+# jhbuild can access those.
+os.environ['XJHBUILD_INSTALLPREFIX'] = prefix
+os.environ['XJHBUILD_CHECKOUTROOT'] = checkoutroot
+
+# Add paths to the environment only after 'prefix' user exansion.
os.environ['ACLOCAL'] = 'aclocal -I ' + os.path.join(prefix, 'share', 'aclocal')
os.environ['PKG_CONFIG_PATH'] = os.path.join(prefix, 'lib', 'pkgconfig') \
+ ':' + os.path.join(prefix, 'share', 'pkgconfig')
-
-#autogenargs='--cache-file=/usr/src/jhmodular/configure-cache --disable-static'
-#os.environ['INSTALL'] = os.path.join(os.environ['HOME'], 'bin', 'install-check')
--
1.7.0.3
More information about the xorg-devel
mailing list