Move module identification code to module class
[ladish.git] / wscript
blobec7680ef341c09a5f6ebb30919e431032e361841
1 #!/usr/bin/env python
2 # Licensed under the GNU GPL v2 or later, see COPYING file for details.
3 # Copyright (C) 2008 Dave Robillard
4 # Copyright (C) 2008 Nedko Arnaudov <nedko@arnaudov.name>
5 import os
6 import Params
7 import autowaf
9 # Version of this package (even if built as a child)
10 PATCHAGE_VERSION = '5'
12 # Variables for 'waf dist'
13 APPNAME = 'lpatchage'
14 VERSION = PATCHAGE_VERSION
15 APP_HUMAN_NAME = 'LADI Patchage'
17 # Mandatory variables
18 srcdir = '.'
19 blddir = 'build'
21 def set_options(opt):
22 autowaf.set_options(opt, False, False, False)
23 opt.add_option('--install-name', type='string', default=APPNAME, dest='app_install_name', help="Install name. [Default: '" + APPNAME + "']")
24 opt.add_option('--app-human-name', type='string', default=APP_HUMAN_NAME, dest='app_human_name', help="Human name for app. [Default: '" + APP_HUMAN_NAME + "']")
26 def configure(conf):
27 autowaf.configure(conf)
28 autowaf.check_tool(conf, 'compiler_cxx')
29 autowaf.check_tool(conf, 'compiler_cc')
31 conf.check_tool('misc') # subst tool
33 conf.check_pkg('dbus-1', mandatory=True)
34 conf.check_pkg('dbus-glib-1', mandatory=True)
35 conf.check_pkg('glibmm-2.4', mandatory=True)
36 conf.check_pkg('gtkmm-2.4', mandatory=True, vnum='2.11.12')
37 conf.check_pkg('libgnomecanvasmm-2.6', mandatory=True)
38 conf.check_pkg('libglademm-2.4', mandatory=True)
40 # You need the boost headers package (e.g. libboost-dev)
41 conf.check_header('boost/shared_ptr.hpp', mandatory=True)
42 conf.check_header('boost/weak_ptr.hpp', mandatory=True)
44 conf.check_pkg('flowcanvas', mandatory=True, vnum='0.4.0')
46 conf.env['PATCHAGE_VERSION'] = PATCHAGE_VERSION
47 conf.env['APP_INSTALL_NAME'] = Params.g_options.app_install_name
48 conf.env['APP_HUMAN_NAME'] = Params.g_options.app_human_name
49 if conf.env['BUNDLE']:
50 conf.define('PATCHAGE_DATA_DIR', os.path.normpath(
51 conf.env['DATADIRNAME'] + conf.env['APP_INSTALL_NAME']))
52 else:
53 conf.define('PATCHAGE_DATA_DIR', os.path.normpath(
54 conf.env['DATADIR'] + conf.env['APP_INSTALL_NAME']))
56 conf.write_config_header('config.h')
58 print
59 autowaf.display_msg("Install prefix", conf.env['PREFIX'], 'CYAN')
60 autowaf.display_msg("Install name", "'" + conf.env['APP_INSTALL_NAME'] + "'", 'CYAN')
61 autowaf.display_msg("App human name", "'" + conf.env['APP_HUMAN_NAME'] + "'", 'CYAN')
62 print
64 def build(bld):
65 # Program
66 prog = bld.create_obj('cpp', 'program')
67 prog.includes = 'src' # make waf dependency tracking work
68 prog.target = bld.env()['APP_INSTALL_NAME']
69 prog.inst_dir = bld.env()['BINDIRNAME']
70 prog.uselib = 'DBUS-1 LIBGNOMECANVASMM-2.6 LIBGLADEMM-2.4 FLOWCANVAS DBUS-GLIB-1'
71 prog.source = [
72 'src/main.cpp',
73 'src/Patchage.cpp',
74 'src/PatchageCanvas.cpp',
75 'src/StateManager.cpp',
76 'src/jack_proxy.cpp',
77 'src/lash_client.cpp',
78 'src/lash_proxy.cpp',
79 'src/load_projects_dialog.cpp',
80 'src/project.cpp',
81 'src/project_list.cpp',
82 'src/project_properties.cpp',
83 'src/session.cpp',
84 'src/a2j_proxy.cpp',
85 'src/dbus_helpers.c'
88 # Executable wrapper script (if building a bundle)
89 autowaf.build_wrapper(bld, 'patchage.in', prog)
91 # Glade UI definitions (XML)
92 install_files('DATADIR', bld.env()['APP_INSTALL_NAME'], 'src/patchage.glade')
94 # 'Desktop' file (menu entry, icon, etc)
95 obj = bld.create_obj('subst')
96 obj.source = 'patchage.desktop.in'
97 obj.target = 'patchage.desktop'
98 obj.dict = {
99 'BINDIR' : bld.env()['BINDIR'],
100 'APP_INSTALL_NAME' : bld.env()['APP_INSTALL_NAME'],
101 'APP_HUMAN_NAME' : bld.env()['APP_HUMAN_NAME'],
103 install_as(os.path.normpath(bld.env()['DATADIR'] + 'applications/'), bld.env()['APP_INSTALL_NAME'] + '.desktop', 'build/default/patchage.desktop')
105 # Icons
107 # Installation layout (with /usr prefix)
108 # /usr/bin/patchage
109 # /usr/share/applications/patchage.desktop
110 # /usr/share/icons/hicolor/16x16/apps/patchage.png
111 # /usr/share/icons/hicolor/22x22/apps/patchage.png
112 # /usr/share/icons/hicolor/24x24/apps/patchage.png
113 # /usr/share/icons/hicolor/32x32/apps/patchage.png
114 # /usr/share/icons/hicolor/48x48/apps/patchage.png
115 # /usr/share/icons/hicolor/scalable/apps/patchage.svg
116 # /usr/share/patchage/patchage.glade
118 # icon cache is updated using:
119 # gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
121 # Dave disabled this, ask why before removing this
122 #install_as(os.path.normpath(bld.env()['PREFIX'] + '/share/icons/hicolor/scalable/apps/'), bld.env()['APP_INSTALL_NAME'] + '.svg', 'icons/scalable/patchage.svg')
124 icon_sizes = ['16x16', '22x22', '24x24', '32x32', '48x48']
125 for icon_size in icon_sizes:
126 install_as(os.path.normpath(bld.env()['DATADIR'] + '/icons/hicolor/' + icon_size + '/apps/'), bld.env()['APP_INSTALL_NAME'] + '.png', 'icons/' + icon_size + '/patchage.png')
128 def shutdown():
129 autowaf.shutdown()