6
To use this module do not forget to call
7
opt.tool_options('gnu_dirs')
9
conf.check_tool('gnu_dirs')
11
Add options for the standard GNU directories, this tool will add the options
12
found in autotools, and will update the environment with the following
13
installation variables:
15
* PREFIX : architecture-independent files [/usr/local]
16
* EXEC_PREFIX : architecture-dependent files [PREFIX]
17
* BINDIR : user executables [EXEC_PREFIX/bin]
18
* SBINDIR : user executables [EXEC_PREFIX/sbin]
19
* LIBEXECDIR : program executables [EXEC_PREFIX/libexec]
20
* SYSCONFDIR : read-only single-machine data [PREFIX/etc]
21
* SHAREDSTATEDIR : modifiable architecture-independent data [PREFIX/com]
22
* LOCALSTATEDIR : modifiable single-machine data [PREFIX/var]
23
* LIBDIR : object code libraries [EXEC_PREFIX/lib]
24
* INCLUDEDIR : C header files [PREFIX/include]
25
* OLDINCLUDEDIR : C header files for non-gcc [/usr/include]
26
* DATAROOTDIR : read-only arch.-independent data root [PREFIX/share]
27
* DATADIR : read-only architecture-independent data [DATAROOTDIR]
28
* INFODIR : info documentation [DATAROOTDIR/info]
29
* LOCALEDIR : locale-dependent data [DATAROOTDIR/locale]
30
* MANDIR : man documentation [DATAROOTDIR/man]
31
* DOCDIR : documentation root [DATAROOTDIR/doc/telepathy-glib]
32
* HTMLDIR : html documentation [DOCDIR]
33
* DVIDIR : dvi documentation [DOCDIR]
34
* PDFDIR : pdf documentation [DOCDIR]
35
* PSDIR : ps documentation [DOCDIR]
40
_options = [x.split(', ') for x in '''
41
bindir, user executables, ${EXEC_PREFIX}/bin
42
sbindir, system admin executables, ${EXEC_PREFIX}/sbin
43
libexecdir, program executables, ${EXEC_PREFIX}/libexec
44
sysconfdir, read-only single-machine data, ${PREFIX}/etc
45
sharedstatedir, modifiable architecture-independent data, ${PREFIX}/com
46
localstatedir, modifiable single-machine data, ${PREFIX}/var
47
libdir, object code libraries, ${EXEC_PREFIX}/lib
48
includedir, C header files, ${PREFIX}/include
49
oldincludedir, C header files for non-gcc, /usr/include
50
datarootdir, read-only arch.-independent data root, ${PREFIX}/share
51
datadir, read-only architecture-independent data, ${DATAROOTDIR}
52
infodir, info documentation, ${DATAROOTDIR}/info
53
localedir, locale-dependent data, ${DATAROOTDIR}/locale
54
mandir, man documentation, ${DATAROOTDIR}/man
55
docdir, documentation root, ${DATAROOTDIR}/doc/${PACKAGE}
56
htmldir, html documentation, ${DOCDIR}
57
dvidir, dvi documentation, ${DOCDIR}
58
pdfdir, pdf documentation, ${DOCDIR}
59
psdir, ps documentation, ${DOCDIR}
63
def get_param(varname, default):
64
return getattr(Options.options, varname, '') or default
67
env['EXEC_PREFIX'] = get_param('EXEC_PREFIX', env['PREFIX'])
68
env['PACKAGE'] = Utils.g_module.APPNAME
72
while not complete and iter < len(_options) + 1:
75
for name, help, default in _options:
79
env[name] = Utils.subst_vars(get_param(name, default), env)
83
lst = [name for name, _, _ in _options if not env[name.upper()]]
84
raise Utils.WafError('Variable substitution failure %r' % lst)
88
inst_dir = opt.add_option_group('Installation directories',
89
'By default, "waf install" will put the files in\
90
"/usr/local/bin", "/usr/local/lib" etc. An installation prefix other\
91
than "/usr/local" can be given using "--prefix", for example "--prefix=$HOME"')
93
for k in ('--prefix', '--destdir'):
94
option = opt.parser.get_option(k)
96
opt.parser.remove_option(k)
97
inst_dir.add_option(option)
99
inst_dir.add_option('--exec-prefix',
100
help = 'installation prefix [Default: ${PREFIX}]',
102
dest = 'EXEC_PREFIX')
104
dirs_options = opt.add_option_group('Pre-defined installation directories', '')
106
for name, help, default in _options:
107
option_name = '--' + name
108
str_default = default
109
str_help = '%s [Default: %s]' % (help, str_default)
110
dirs_options.add_option(option_name, help=str_help, default='', dest=name.upper())