1#!/usr/bin/env python
2from waflib.extras import autowaf as autowaf
3import re
4
5# Variables for 'waf dist'
6APPNAME = 'eg-scope.lv2'
7VERSION = '1.0.0'
8
9# Mandatory variables
10top = '.'
11out = 'build'
12
13def options(opt):
14    opt.load('compiler_c')
15    opt.load('lv2')
16    autowaf.set_options(opt)
17
18def configure(conf):
19    conf.load('compiler_c', cache=True)
20    conf.load('lv2', cache=True)
21    conf.load('autowaf', cache=True)
22
23    conf.check_pkg('lv2 >= 1.2.1', uselib_store='LV2')
24    conf.check_pkg('cairo >= 1.8.10', uselib_store='CAIRO')
25    conf.check_pkg('gtk+-2.0 >= 2.18.0',
26                   uselib_store='GTK2',
27                   system=True,
28                   mandatory=False)
29
30def build(bld):
31    bundle = 'eg-scope.lv2'
32
33    # Build manifest.ttl by substitution (for portable lib extension)
34    for i in ['manifest.ttl', 'examploscope.ttl']:
35        bld(features     = 'subst',
36            source       = i + '.in',
37            target       = 'lv2/%s/%s' % (bundle, i),
38            install_path = '${LV2DIR}/%s' % bundle,
39            LIB_EXT      = bld.env.LV2_LIB_EXT)
40
41    # Build plugin library
42    obj = bld(features     = 'c cshlib lv2lib',
43              source       = 'examploscope.c',
44              name         = 'examploscope',
45              target       = 'lv2/%s/examploscope' % bundle,
46              install_path = '${LV2DIR}/%s' % bundle,
47              use          = 'LV2')
48
49    # Build UI library
50    if bld.env.HAVE_GTK2:
51        obj = bld(features     = 'c cshlib lv2lib',
52                  source       = 'examploscope_ui.c',
53                  name         = 'examploscope_ui',
54                  target       = 'lv2/%s/examploscope_ui' % bundle,
55                  install_path = '${LV2DIR}/%s' % bundle,
56                  use          = 'GTK2 CAIRO LV2')
57