allow hardour to build even when --exports-hidden is used with waf configure
[ardour.git] / headless / wscript
1 #!/usr/bin/env python
2 from waflib.extras import autowaf as autowaf
3 from waflib import Options, TaskGen
4 import waflib.Logs as Logs, waflib.Utils as Utils
5 import os
6 import shutil
7 import sys
8 import re
9 import time
10 from waflib.Task import Task
11
12 # Mandatory variables
13 top = '.'
14 out = 'build'
15
16 hardour_sources = [
17         'load_session.cc',
18         'misc.cc',
19 ]
20
21 def options(opt):
22     autowaf.set_options(opt)
23
24 def configure(conf):
25     conf.load('misc')
26     conf.load('compiler_cxx')
27     autowaf.configure(conf)
28
29
30 def build(bld):
31
32     VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
33     if bld.is_defined('WINDOWS_VST_SUPPORT') and bld.env['build_target'] != 'mingw':
34         return
35     
36     # just the normal executable version of the GTK GUI
37     obj = bld (features = 'cxx c cxxprogram')
38     # this program does not do the whole hidden symbols thing
39     obj.cxxflags = [ '-fvisibility=default' ]
40     obj.source    = hardour_sources
41     obj.target = 'hardour-' + bld.env['VERSION']
42     obj.includes = ['.']
43
44     # at this point, "obj" refers to either the normal native executable
45     # OR the shared library built for use with wine on linux.
46
47     obj.use      = [ 'libpbd',
48                      'libardour',
49                      'libardour_cp',
50                      'libtimecode',
51                      'libmidipp',
52                      ]
53
54     obj.defines = [
55         'VERSIONSTRING="' + bld.env['VERSION'] + '"',
56         'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
57         'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
58         'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
59         'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
60         ]
61     obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
62     obj.uselib       = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD OGG CURL DL'
63     obj.uselib       += ' FFTW3F'
64     obj.uselib       += ' AUDIOUNITS OSX LO '
65     obj.uselib       += ' TAGLIB '
66
67     if sys.platform == 'darwin':
68         obj.uselib += ' AUDIOUNITS OSX'
69         obj.use    += ' libappleutility'
70     obj.includes += ['../libs']
71
72     if bld.env['build_target'] == 'mingw':
73         if bld.env['DEBUG'] == False:
74             obj.linkflags = ['-mwindows']
75
76     if bld.is_defined('NEED_INTL'):
77         obj.linkflags = ' -lintl'
78
79     # Wrappers
80
81     wrapper_subst_dict = {
82             'INSTALL_PREFIX' : bld.env['PREFIX'],
83             'LIBDIR'         : os.path.normpath(bld.env['LIBDIR']),
84             'DATADIR'        : os.path.normpath(bld.env['DATADIR']),
85             'SYSCONFDIR'     : os.path.normpath(bld.env['SYSCONFDIR']),
86             'LIBS'           : 'build/libs',
87             'VERSION'        : bld.env['VERSION'],
88             'EXECUTABLE'     : 'build/headless/hardour-' + bld.env['VERSION']
89     }
90
91     def set_subst_dict(obj, dict):
92         for i in dict:
93             setattr(obj, i, dict[i])
94
95     obj              = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
96     obj.source       = 'hardev_common.sh.in'
97     obj.target       = 'hardev_common_waf.sh'
98     obj.chmod        = Utils.O755
99     obj.dict         = wrapper_subst_dict
100     set_subst_dict(obj, wrapper_subst_dict)