Consistent use of abort() /* NOTREACHED */
[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         'action_model.cc',
28         'application.cc',
29         'bindings.cc',
30         'cairo_packer.cc',
31         'cairo_widget.cc',
32         'cell_renderer_color_selector.cc',
33         'cell_renderer_pixbuf_multi.cc',
34         'cell_renderer_pixbuf_toggle.cc',
35         'colors.cc',
36         'colorspace.cc',
37         'cursors.cc',
38         'debug.cc',
39         'dndtreeview.cc',
40         'emscale.cc',
41         'gtk_ui.cc',
42         'gtkapplication.c',
43         'keyboard.cc',
44         'menu_elems.cc',
45         'persistent_tooltip.cc',
46         'textviewer.cc',
47         'treeutils.cc',
48         'utils.cc',
49         'visibility_tracker.cc',
50         'window_proxy.cc',
51         'window_title.cc'
52 ]
53
54 # Mandatory variables
55 top = '.'
56 out = 'build'
57
58 path_prefix = 'libs/gtkmm2ext/'
59
60 def options(opt):
61     autowaf.set_options(opt)
62
63 def configure(conf):
64     conf.load('compiler_cxx')
65     autowaf.configure(conf)
66     autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM', atleast_version='2.8')
67     autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK', atleast_version='2.12.1')
68
69
70 def build(bld):
71     # operate on copy to avoid adding sources twice
72     sources = list(gtkmm2ext_sources)
73
74     if bld.is_defined ('INTERNAL_SHARED_LIBS'):
75         obj              = bld.shlib(features = 'c cxx cshlib cxxshlib', source=sources)
76         # defines for this library
77         obj.defines      = [ 'LIBGTKMM2EXT_DLL_EXPORTS', 'ABSTRACT_UI_EXPORTS' ]
78     else:
79         obj              = bld.stlib(features = 'c cxx cstlib cxxstlib', source=sources)
80         obj.cxxflags     = [ bld.env['compiler_flags_dict']['pic'] ]
81         obj.defines      = [ ]
82
83     obj.export_includes = ['.']
84     obj.includes     = ['.']
85     obj.name         = 'libgtkmm2ext'
86     obj.target       = 'gtkmm2ext'
87     obj.uselib       = 'GTKMM GTK XML'
88     obj.use          = [ 'libpbd' ]
89     obj.vnum         = GTKMM2EXT_LIB_VERSION
90     obj.install_path = bld.env['LIBDIR']
91     obj.defines     += [
92                     'PACKAGE="' + I18N_PACKAGE + '"',
93                     'LOCALEDIR="' + os.path.join(
94                             os.path.normpath(bld.env['DATADIR']), 'locale') + '"']
95     if sys.platform == 'darwin':
96         obj.source += ['gtkapplication_quartz.mm', 'nsglview.mm']
97     else:
98         obj.source += ['gtkapplication_x11.c']
99
100     # i18n
101     if bld.is_defined('ENABLE_NLS'):
102         mo_files = bld.path.ant_glob('po/*.mo')
103         for mo in mo_files:
104             lang = os.path.basename(mo.srcpath()).replace('.mo', '')
105             bld.install_as (os.path.join(os.path.normpath(bld.env['LOCALEDIR']), lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
106                             mo)
107
108 def i18n(bld):
109     autowaf.build_i18n(bld, top, 'libs/gtkmm2ext', I18N_PACKAGE, gtkmm2ext_sources,
110                        'Paul Davis')
111
112 def i18n_pot(bld):
113     autowaf.build_i18n_pot(bld, top, 'libs/gtkmm2ext', I18N_PACKAGE, gtkmm2ext_sources,
114                        'Paul Davis')
115
116 def i18n_po(bld):
117     autowaf.build_i18n_po(bld, top, 'libs/gtkmm2ext', I18N_PACKAGE, gtkmm2ext_sources,
118                        'Paul Davis')
119
120 def i18n_mo(bld):
121     autowaf.build_i18n_mo(bld, top, 'libs/gtkmm2ext', I18N_PACKAGE, gtkmm2ext_sources,
122                        'Paul Davis')
123
124 def shutdown():
125     autowaf.shutdown()