1 | #! /usr/bin/env python |
---|
2 | # encoding: utf-8 |
---|
3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file |
---|
4 | |
---|
5 | import os,re |
---|
6 | from waflib import Utils,Options,Context |
---|
7 | gnuopts=''' |
---|
8 | bindir, user commands, ${EXEC_PREFIX}/bin |
---|
9 | sbindir, system binaries, ${EXEC_PREFIX}/sbin |
---|
10 | libexecdir, program-specific binaries, ${EXEC_PREFIX}/libexec |
---|
11 | sysconfdir, host-specific configuration, ${PREFIX}/etc |
---|
12 | sharedstatedir, architecture-independent variable data, ${PREFIX}/com |
---|
13 | localstatedir, variable data, ${PREFIX}/var |
---|
14 | libdir, object code libraries, ${EXEC_PREFIX}/lib%s |
---|
15 | includedir, header files, ${PREFIX}/include |
---|
16 | oldincludedir, header files for non-GCC compilers, /usr/include |
---|
17 | datarootdir, architecture-independent data root, ${PREFIX}/share |
---|
18 | datadir, architecture-independent data, ${DATAROOTDIR} |
---|
19 | infodir, GNU "info" documentation, ${DATAROOTDIR}/info |
---|
20 | localedir, locale-dependent data, ${DATAROOTDIR}/locale |
---|
21 | mandir, manual pages, ${DATAROOTDIR}/man |
---|
22 | docdir, documentation root, ${DATAROOTDIR}/doc/${PACKAGE} |
---|
23 | htmldir, HTML documentation, ${DOCDIR} |
---|
24 | dvidir, DVI documentation, ${DOCDIR} |
---|
25 | pdfdir, PDF documentation, ${DOCDIR} |
---|
26 | psdir, PostScript documentation, ${DOCDIR} |
---|
27 | '''%Utils.lib64() |
---|
28 | _options=[x.split(', ')for x in gnuopts.splitlines()if x] |
---|
29 | def configure(conf): |
---|
30 | def get_param(varname,default): |
---|
31 | return getattr(Options.options,varname,'')or default |
---|
32 | env=conf.env |
---|
33 | env.LIBDIR=env.BINDIR=[] |
---|
34 | env.EXEC_PREFIX=get_param('EXEC_PREFIX',env.PREFIX) |
---|
35 | env.PACKAGE=getattr(Context.g_module,'APPNAME',None)or env.PACKAGE |
---|
36 | complete=False |
---|
37 | iter=0 |
---|
38 | while not complete and iter<len(_options)+1: |
---|
39 | iter+=1 |
---|
40 | complete=True |
---|
41 | for name,help,default in _options: |
---|
42 | name=name.upper() |
---|
43 | if not env[name]: |
---|
44 | try: |
---|
45 | env[name]=Utils.subst_vars(get_param(name,default).replace('/',os.sep),env) |
---|
46 | except TypeError: |
---|
47 | complete=False |
---|
48 | if not complete: |
---|
49 | lst=[x for x,_,_ in _options if not env[x.upper()]] |
---|
50 | raise conf.errors.WafError('Variable substitution failure %r'%lst) |
---|
51 | def options(opt): |
---|
52 | inst_dir=opt.add_option_group('Installation prefix','By default, "waf install" will put the files in\ |
---|
53 | "/usr/local/bin", "/usr/local/lib" etc. An installation prefix other\ |
---|
54 | than "/usr/local" can be given using "--prefix", for example "--prefix=$HOME"') |
---|
55 | for k in('--prefix','--destdir'): |
---|
56 | option=opt.parser.get_option(k) |
---|
57 | if option: |
---|
58 | opt.parser.remove_option(k) |
---|
59 | inst_dir.add_option(option) |
---|
60 | inst_dir.add_option('--exec-prefix',help='installation prefix for binaries [PREFIX]',default='',dest='EXEC_PREFIX') |
---|
61 | dirs_options=opt.add_option_group('Installation directories') |
---|
62 | for name,help,default in _options: |
---|
63 | option_name='--'+name |
---|
64 | str_default=default |
---|
65 | str_help='%s [%s]'%(help,re.sub(r'\$\{([^}]+)\}',r'\1',str_default)) |
---|
66 | dirs_options.add_option(option_name,help=str_help,default='',dest=name.upper()) |
---|