#!/usr/bin/env python import os import sys from waflib.extras import autowaf as autowaf import waflib.Options as Options # Version of this package (even if built as a child) LV2CORE_VERSION = '4.1' # Variables for 'waf dist' APPNAME = 'lv2core' VERSION = LV2CORE_VERSION # Mandatory variables top = '.' out = 'build' def options(opt): autowaf.set_options(opt) opt.load('compiler_c') opt.add_option('--default-lv2-path', type='string', default='', dest='default_lv2_path', help="Default LV2 path to use if $LV2_PATH is unset") opt.add_option('--bundle-only', action='store_true', default=False, dest='bundle_only', help="Only install LV2 bundle (not header or pkg-config file)") def configure(conf): autowaf.configure(conf) conf.load('compiler_c') lv2core_path_sep = ':' lv2core_dir_sep = '/' if sys.platform == 'win32': lv2core_path_sep = ';' lv2core_dir_sep = '\\\\' autowaf.define(conf, 'LV2CORE_PATH_SEP', lv2core_path_sep) autowaf.define(conf, 'LV2CORE_DIR_SEP', lv2core_dir_sep) if Options.options.default_lv2_path == '': if Options.platform == 'darwin': Options.options.default_lv2_path = lv2core_path_sep.join([ '~/Library/Audio/Plug-Ins/LV2', '~/.lv2', '/usr/local/lib/lv2', '/usr/lib/lv2', '/Library/Audio/Plug-Ins/LV2']) elif Options.platform == 'haiku': Options.options.default_lv2_path = lv2core_path_sep.join([ '~/.lv2', '/boot/common/add-ons/lv2']) elif Options.platform == 'win32': Options.options.default_lv2_path = 'C:\\\\Program Files\\\\LV2' else: libdirname = os.path.basename(conf.env['LIBDIR']) Options.options.default_lv2_path = lv2core_path_sep.join([ '~/.lv2', '/usr/%s/lv2' % libdirname, '/usr/local/%s/lv2' % libdirname]) autowaf.define(conf, 'LV2CORE_DEFAULT_LV2_PATH', Options.options.default_lv2_path) conf.check(function_name='wordexp', header_name='wordexp.h', define_name='HAVE_WORDEXP', mandatory=False) conf.write_config_header('lv2-config.h', remove=False) autowaf.display_msg(conf, "Path expansion via wordexp", conf.is_defined('HAVE_WORDEXP')) autowaf.display_msg(conf, "Default LV2_PATH", conf.env['LV2CORE_DEFAULT_LV2_PATH']) autowaf.display_msg(conf, "LV2 bundle directory", conf.env['LV2DIR']) print('') def build(bld): # Header "library" obj = bld(export_includes = ['.'], name = 'liblv2core', target = 'lv2core') if not Options.options.bundle_only: # Header bld.install_files('${INCLUDEDIR}', 'lv2.h') bld.install_files('${LV2DIR}/lv2core.lv2', 'lv2.h') # Pkgconfig file autowaf.build_pc(bld, 'LV2CORE', LV2CORE_VERSION, '', []) # Bundle (data) bld.install_files('${LV2DIR}/lv2core.lv2', 'lv2.ttl manifest.ttl') # lv2config program obj = bld(features = 'c cprogram', source = 'lv2config.c serd-0.1.0.c', target = 'lv2config', install_path = '${BINDIR}', cflags = ['-std=c99', '-U__STRICT_ANSI__']) # Man page bld.install_files('${MANDIR}/man1', 'lv2config.1') def dist(): import Scripting Scripting.g_gz = 'gz' Scripting.dist() id='n25' href='#n25'>25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169