waf/demos/subst/wscript

47 lines
1.5 KiB
Plaintext
Raw Normal View History

2011-09-10 11:13:51 +02:00
#! /usr/bin/env python
# encoding: utf-8
top = '.'
out = 'bin'
from waflib import Utils
def configure(conf):
pass
def build(bld):
# the test.pc.in is a special case which is always handled
bld(source='test.pc.in', VERSION='1.1', LIBS='moo', XPM_LIBS='-lxpm', LIBICONV='-liconv', XPM_CFLAGS='-O3')
tg = bld(
features = 'subst', # the feature 'subst' overrides the source/target processing
source = 'foo.in', # list of string or nodes
target = 'foo.txt', # list of strings or nodes
2012-05-08 19:01:30 +02:00
encoding = 'ascii', # file encoding for python3, default is ISO8859-1
2011-09-10 11:13:51 +02:00
install_path = '/tmp/uff/', # installation path, optional
chmod = Utils.O755, # installation mode, optional
PREFIX = bld.env.PREFIX, # variables to use in the substitution
BINDIR = bld.env.BINDIR)
# if you are using an external dict, here is to merge the key/values:
dct = {'BINDIR': '/opt'}
tg.__dict__.update(dct)
2012-03-29 00:04:34 +02:00
# if you want a file copy, pass "is_copy=True"
bld(features='subst', source='wscript', target='wscript', is_copy=True)
# same thing with a simple function
def fun(task, text):
return text
bld(features='subst', subst_fun=fun, source='wscript', target='wscript2')
2011-09-10 11:13:51 +02:00
# this one is just a reminder that simple files can be created (and a test too)
#bld(rule='echo "การไฟ่" > ${TGT}', target='foo.txt')
2012-09-17 23:45:59 +02:00
# and this is an alternate syntax
#@bld.rule(source='wscript', target='wscript2')
#def _(tsk):
# tsk.outputs[0].write(tsk.inputs[0].read())