Amend 1caef183 (Windows Lua bindings)
[ardour.git] / tools / luadevel / 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 top = '.'
13 out = 'build'
14
15 def options(opt):
16     autowaf.set_options(opt)
17
18 def configure(conf):
19     conf.load('misc')
20     conf.load('compiler_cxx')
21     conf.check_cc(function_name='readline',
22             header_name='stdio.h readline/readline.h',
23             lib='readline',
24             uselib_store='READLINE',
25             mandatory=False)
26     autowaf.configure(conf)
27
28 def build(bld):
29     VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
30     if not bld.is_defined('HAVE_READLINE'):
31             return;
32     # no wine
33     if bld.is_defined('WINDOWS_VST_SUPPORT') and bld.env['build_target'] != 'mingw':
34         return
35
36     if bld.env['build_target'] != 'mingw':
37     # TEST/DEVEL TOOL #######################
38         obj = bld (features = 'cxx c cxxprogram')
39         obj.source       = 'devel.cc'
40         obj.target       = 'devel'
41         obj.uselib       = ['SIGCPP', 'READLINE']
42         obj.use          = ['liblua']
43         obj.install_path = None
44     #########################################
45
46     # commandline luasession wrapper script
47     if bld.env['build_target'] != 'mingw':
48         obj              = bld(features = 'subst')
49         obj.source       = 'ardour-lua.sh.in'
50         obj.target       = 'ardour' + str (bld.env['MAJOR']) + '-lua'
51         obj.chmod        = Utils.O755
52         obj.install_path = bld.env['BINDIR']
53         obj.LIBDIR       = os.path.normpath(bld.env['DLLDIR'])
54         obj.DATADIR      = os.path.normpath(bld.env['DATADIR'])
55         obj.CONFDIR      = os.path.normpath(bld.env['CONFDIR'])
56
57     # commandline luasession
58     obj = bld (features = 'cxx c cxxprogram')
59     obj.source       = 'luasession.cc'
60     obj.target       = 'luasession'
61     obj.includes     = ['../libs']
62     obj.use          = ['liblua'
63                         'libpbd',
64                         'libardour',
65                         'libardour_cp',
66                         'libtemporal',
67                         'libmidipp',
68                      ]
69     obj.defines = [
70         'VERSIONSTRING="' + str(bld.env['VERSION']) + '"',
71         'DATA_DIR="'   + os.path.normpath(bld.env['DATADIR']) + '"',
72         'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
73         'LOCALEDIR="'  + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
74         'PACKAGE="'    + "ARDOURUTILS" + '"',
75         ]
76
77     obj.uselib       = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD OGG CURL DL XML'
78     obj.uselib       += ' FFTW3F'
79     obj.uselib       += ' AUDIOUNITS OSX LO '
80     obj.uselib       += ' TAGLIB '
81     obj.uselib       += ' READLINE '
82
83     if sys.platform == 'darwin':
84         obj.uselib += ' AUDIOUNITS OSX'
85         obj.use    += ' libappleutility'
86
87     #if bld.env['build_target'] == 'mingw':
88     #    if bld.env['DEBUG'] == False:
89     #        obj.linkflags = ['-mwindows']
90
91     if bld.is_defined('NEED_INTL'):
92         obj.linkflags = ' -lintl'
93
94     if bld.env['build_target'] == 'mingw':
95         obj.install_path = bld.env['BINDIR']
96         obj.target       = 'ardour' + str (bld.env['MAJOR']) + '-lua'
97     else:
98         obj.install_path = bld.env['DLLDIR']