~ubuntu-branches/ubuntu/saucy/fomp/saucy

1 by Alessio Treglia
Import upstream version 1.0.0~dfsg0
1
#!/usr/bin/env python
2
import os
3
import shutil
4
import waflib.extras.autowaf as autowaf
5
6
# Version of this package (even if built as a child)
7
FOMP_VERSION = '1.0.0'
8
9
# Mandatory waf variables
10
APPNAME = 'fomp'        # Package name for waf dist
11
VERSION = FOMP_VERSION  # Package version for waf dist
12
top     = '.'           # Source directory
13
out     = 'build'       # Build directory
14
15
def options(opt):
16
    opt.load('compiler_cxx')
17
    autowaf.set_options(opt)
18
19
def configure(conf):
20
    conf.load('compiler_cxx')
21
    autowaf.configure(conf)
22
    autowaf.set_c99_mode(conf)
23
    autowaf.display_header('Fomp.LV2 Configuration')
24
25
    autowaf.check_pkg(conf, 'lv2', atleast_version='1.0.0', uselib_store='LV2')
26
27
    # Set env.pluginlib_PATTERN
28
    pat = conf.env.cxxshlib_PATTERN
29
    if pat[0:3] == 'lib':
30
        pat = pat[3:]
31
    conf.env.pluginlib_PATTERN = pat
32
    conf.env.pluginlib_EXT = pat[pat.rfind('.'):]
33
34
    autowaf.display_msg(conf, 'LV2 bundle directory',
35
                        conf.env.LV2DIR)
36
    print('')
37
38
def build_plugin(bld, lang, bundle, name, source, defines=None):
39
    # Build plugin library
40
    penv = bld.env.derive()
41
    penv.cxxshlib_PATTERN = bld.env.pluginlib_PATTERN
42
    obj = bld(features     = '%s %sshlib' % (lang,lang),
43
              env          = penv,
44
              source       = source,
45
              includes     = ['.', 'src/include'],
46
              name         = name,
47
              target       = os.path.join(bundle, name),
48
              uselib       = ['LV2'],
49
              install_path = '${LV2DIR}/' + bundle)
50
    if defines != None:
51
        obj.defines = defines
52
53
def build(bld):
54
    # Copy data files to build bundle (build/fomp.lv2)
55
    def do_copy(task):
56
        src = task.inputs[0].abspath()
57
        tgt = task.outputs[0].abspath()
58
        return shutil.copy(src, tgt)
59
60
    for i in bld.path.ant_glob('fomp.lv2/*.ttl'):
61
        bld(features     = 'subst',
62
            is_copy      = True,
63
            source       = i,
64
            target       = bld.path.get_bld().make_node('fomp.lv2/%s' % i),
65
            install_path = '${LV2DIR}/fomp.lv2')
66
67
    bld(features     = 'subst',
68
        source       = 'fomp.lv2/manifest.ttl.in',
69
        target       = bld.path.get_bld().make_node('fomp.lv2/manifest.ttl'),
70
        LIB_EXT      = bld.env.pluginlib_EXT,
71
        install_path = '${LV2DIR}/fomp.lv2')
72
73
    plugins = ['autowah',
74
               'blvco',
75
               'cs_chorus',
76
               'cs_phaser',
77
               'filters',
78
               'mvchpf24',
79
               'mvclpf24']
80
    for i in plugins:
81
        build_plugin(bld, 'cxx', 'fomp.lv2', i,
82
                     ['src/%s.cc' % i,
83
                      'src/%s_lv2.cc' % i])