abyss.7
abyss.7

Reputation: 14452

How to specify library installation path suffix in waf?

I want to install libraries that are built with command bld.shlib(...) into <prefix>/lib<arch_suffix>, where arch_suffix can be 64 or empty according to architecture.

How can I do this?

If it's impossible, then how can I explicitly specify this suffix?

Upvotes: 2

Views: 2675

Answers (1)

Doran
Doran

Reputation: 4091

This is a simple example that should help you. It is really easy to change the install path. In this example, I add the "suffix" option to the "configure options" group in the option context. Then in the configure context, I set an environment variable called SUFFIX. In the build context, I use the environment variable in the "install_path" keyword argument. The import thing here is that you can reference any environment variable that's been set.

def options(opt):
    opt.load('compiler_cxx')
    grp = opt.get_option_group('configure options')
    grp.add_option('--suffix',default='',dest='suffix')

def configure(cfg):
    cfg.load('compiler_cxx')
    cfg.env.SUFFIX = cfg.options.suffix

def build(bld):
    src=['example.cpp']
    inc=['.']
    libs=['']
    bld(features=['cxx','cxxprogram'],
        source=src,
        includes=inc,
        target='example',
        name='example',
        use=libs,
        install_path='${PREFIX}/lib${SUFFIX}'
        )

waf distclean configure build install --prefix=/tmp --suffix=64

Upvotes: 3

Related Questions