akmhoque | fa8ee9b | 2014-03-14 09:06:24 -0500 | [diff] [blame^] | 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 |
| 6 | from waflib import Utils,Options,Context |
| 7 | _options=[x.split(', ')for x in''' |
| 8 | bindir, user executables, ${EXEC_PREFIX}/bin |
| 9 | sbindir, system admin executables, ${EXEC_PREFIX}/sbin |
| 10 | libexecdir, program executables, ${EXEC_PREFIX}/libexec |
| 11 | sysconfdir, read-only single-machine data, ${PREFIX}/etc |
| 12 | sharedstatedir, modifiable architecture-independent data, ${PREFIX}/com |
| 13 | localstatedir, modifiable single-machine data, ${PREFIX}/var |
| 14 | libdir, object code libraries, ${EXEC_PREFIX}/lib |
| 15 | includedir, C header files, ${PREFIX}/include |
| 16 | oldincludedir, C header files for non-gcc, /usr/include |
| 17 | datarootdir, read-only arch.-independent data root, ${PREFIX}/share |
| 18 | datadir, read-only architecture-independent data, ${DATAROOTDIR} |
| 19 | infodir, info documentation, ${DATAROOTDIR}/info |
| 20 | localedir, locale-dependent data, ${DATAROOTDIR}/locale |
| 21 | mandir, man documentation, ${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, ps documentation, ${DOCDIR} |
| 27 | '''.split('\n')if x] |
| 28 | def configure(conf): |
| 29 | def get_param(varname,default): |
| 30 | return getattr(Options.options,varname,'')or default |
| 31 | env=conf.env |
| 32 | env.LIBDIR=env.BINDIR=[] |
| 33 | env.EXEC_PREFIX=get_param('EXEC_PREFIX',env.PREFIX) |
| 34 | env.PACKAGE=getattr(Context.g_module,'APPNAME',None)or env.PACKAGE |
| 35 | complete=False |
| 36 | iter=0 |
| 37 | while not complete and iter<len(_options)+1: |
| 38 | iter+=1 |
| 39 | complete=True |
| 40 | for name,help,default in _options: |
| 41 | name=name.upper() |
| 42 | if not env[name]: |
| 43 | try: |
| 44 | env[name]=Utils.subst_vars(get_param(name,default).replace('/',os.sep),env) |
| 45 | except TypeError: |
| 46 | complete=False |
| 47 | if not complete: |
| 48 | lst=[name for name,_,_ in _options if not env[name.upper()]] |
| 49 | raise conf.errors.WafError('Variable substitution failure %r'%lst) |
| 50 | def options(opt): |
| 51 | inst_dir=opt.add_option_group('Installation directories','By default, "waf install" will put the files in\ |
| 52 | "/usr/local/bin", "/usr/local/lib" etc. An installation prefix other\ |
| 53 | than "/usr/local" can be given using "--prefix", for example "--prefix=$HOME"') |
| 54 | for k in('--prefix','--destdir'): |
| 55 | option=opt.parser.get_option(k) |
| 56 | if option: |
| 57 | opt.parser.remove_option(k) |
| 58 | inst_dir.add_option(option) |
| 59 | inst_dir.add_option('--exec-prefix',help='installation prefix [Default: ${PREFIX}]',default='',dest='EXEC_PREFIX') |
| 60 | dirs_options=opt.add_option_group('Pre-defined installation directories','') |
| 61 | for name,help,default in _options: |
| 62 | option_name='--'+name |
| 63 | str_default=default |
| 64 | str_help='%s [Default: %s]'%(help,str_default) |
| 65 | dirs_options.add_option(option_name,help=str_help,default='',dest=name.upper()) |