#!/usr/bin/env python import os from waflib.extras import autowaf as autowaf import waflib.Logs as Logs import waflib.Options as Options # Variables for 'waf dist' APPNAME = 'lv2-@NAME@' VERSION = '@VERSION@' # Mandatory variables top = '.' out = 'build' def options(opt): autowaf.set_options(opt) opt.add_option('--copy-headers', action='store_true', default=False, dest='copy_headers', help='Copy headers instead of linking to bundle') def configure(conf): autowaf.configure(conf) autowaf.display_header('LV2 @NAME@ Configuration') conf.env['COPY_HEADERS'] = Options.options.copy_headers autowaf.display_msg(conf, "LV2 bundle directory", conf.env['LV2DIR']) print('') def build(bld): uri = '@URI@' include_base = os.path.dirname(uri[uri.find('://') + 3:]) bundle_dir = os.path.join(bld.env['LV2DIR'], '@NAME@.lv2') include_dir = os.path.join(bld.env['INCLUDEDIR'], 'lv2', include_base) # Pkgconfig file obj = bld(features = 'subst', source = '@PKGCONFIG_NAME@.pc.in', target = '@PKGCONFIG_NAME@.pc', install_path = '${LIBDIR}/pkgconfig', INCLUDEDIR = bld.env['INCLUDEDIR']) # Install bundle bld.install_files(bundle_dir, bld.path.ant_glob('?*.*')) # Install URI-like includes if bld.env['COPY_HEADERS']: bld.install_files(os.path.join(include_dir, '@NAME@'), bld.path.ant_glob('*.h')) else: bld.symlink_as(os.path.join(include_dir, '@NAME@'), os.path.relpath(bundle_dir, include_dir))