LCXL: some more small tweaks
[ardour.git] / libs / gtkmm2ext / wscript
1 #!/usr/bin/env python
2 from waflib.extras import autowaf as autowaf
3 from waflib import Options
4 import os
5 import sys
6 import platform as PLATFORM
7
8 # Version of this package (even if built as a child)
9 MAJOR = '0'
10 MINOR = '8'
11 MICRO = '3'
12 GTKMM2EXT_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO)
13
14 # Library version (UNIX style major, minor, micro)
15 # major increment <=> incompatible changes
16 # minor increment <=> compatible changes (additions)
17 # micro increment <=> no interface changes
18 GTKMM2EXT_LIB_VERSION = '0.8.3'
19
20 # Variables for 'waf dist'
21 APPNAME = 'gtkmm2ext'
22 VERSION = GTKMM2EXT_VERSION
23 I18N_PACKAGE = 'gtkmm2ext3'
24
25 gtkmm2ext_sources = [
26         'actions.cc',
27         'application.cc',
28         'bindings.cc',
29         'cairo_packer.cc',
30         'cairo_widget.cc',
31         'cell_renderer_color_selector.cc',
32         'cell_renderer_pixbuf_multi.cc',
33         'cell_renderer_pixbuf_toggle.cc',
34         'colors.cc',
35         'colorspace.cc',
36         'cursors.cc',
37         'debug.cc',
38         'dndtreeview.cc',
39         'emscale.cc',
40         'gtk_ui.cc',
41         'gtkapplication.c',
42         'keyboard.cc',
43         'menu_elems.cc',
44         'persistent_tooltip.cc',
45         'textviewer.cc',
46         'treeutils.cc',
47         'utils.cc',
48         'visibility_tracker.cc',
49         'window_proxy.cc',
50         'window_title.cc'
51 ]
52
53 # Mandatory variables
54 top = '.'
55 out = 'build'
56
57 path_prefix = 'libs/gtkmm2ext/'
58
59 def options(opt):
60     autowaf.set_options(opt)
61
62 def configure(conf):
63     conf.load('compiler_cxx')
64     autowaf.configure(conf)
65     autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM', atleast_version='2.8')
66     autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK', atleast_version='2.12.1')
67
68
69 def build(bld):
70     # operate on copy to avoid adding sources twice
71     sources = list(gtkmm2ext_sources)
72
73     if bld.is_defined ('INTERNAL_SHARED_LIBS'):
74         obj              = bld.shlib(features = 'c cxx cshlib cxxshlib', source=sources)
75         # defines for this library
76         obj.defines      = [ 'LIBGTKMM2EXT_DLL_EXPORTS', 'ABSTRACT_UI_EXPORTS' ]
77     else:
78         obj              = bld.stlib(features = 'c cxx cstlib cxxstlib', source=sources)
79         obj.cxxflags     = [ bld.env['compiler_flags_dict']['pic'] ]
80         obj.defines      = [ ]
81
82     obj.export_includes = ['.']
83     obj.includes     = ['.']
84     obj.name         = 'libgtkmm2ext'
85     obj.target       = 'gtkmm2ext'
86     obj.uselib       = 'GTKMM GTK XML'
87     obj.use          = [ 'libpbd' ]
88     obj.vnum         = GTKMM2EXT_LIB_VERSION
89     obj.install_path = bld.env['LIBDIR']
90     obj.defines     += [
91                     'PACKAGE="' + I18N_PACKAGE + '"',
92                     'LOCALEDIR="' + os.path.join(
93                             os.path.normpath(bld.env['DATADIR']), 'locale') + '"']
94     if sys.platform == 'darwin':
95         obj.source += ['gtkapplication_quartz.mm', 'nsglview.mm']
96     else:
97         obj.source += ['gtkapplication_x11.c']
98
99     # i18n
100     if bld.is_defined('ENABLE_NLS'):
101         mo_files = bld.path.ant_glob('po/*.mo')
102         for mo in mo_files:
103             lang = os.path.basename(mo.srcpath()).replace('.mo', '')
104             bld.install_as (os.path.join(os.path.normpath(bld.env['LOCALEDIR']), lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
105                             mo)
106
107 def i18n(bld):
108     autowaf.build_i18n(bld, top, 'libs/gtkmm2ext', I18N_PACKAGE, gtkmm2ext_sources,
109                        'Paul Davis')
110
111 def i18n_pot(bld):
112     autowaf.build_i18n_pot(bld, top, 'libs/gtkmm2ext', I18N_PACKAGE, gtkmm2ext_sources,
113                        'Paul Davis')
114
115 def i18n_po(bld):
116     autowaf.build_i18n_po(bld, top, 'libs/gtkmm2ext', I18N_PACKAGE, gtkmm2ext_sources,
117                        'Paul Davis')
118
119 def i18n_mo(bld):
120     autowaf.build_i18n_mo(bld, top, 'libs/gtkmm2ext', I18N_PACKAGE, gtkmm2ext_sources,
121                        'Paul Davis')
122
123 def shutdown():
124     autowaf.shutdown()