2

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?

abyss.7
  • 13,882
  • 11
  • 56
  • 100

1 Answers1

3

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
neuro
  • 14,948
  • 3
  • 36
  • 59
Doran
  • 4,051
  • 2
  • 27
  • 41