1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
|
#!/usr/bin/env python
# Licensed under the GNU GPL v2 or later, see COPYING file for details.
# Copyright (C) 2008-2010 David Robillard
# Copyright (C) 2008 Nedko Arnaudov
import os
import autowaf
import Options
# Version of this package (even if built as a child)
PATCHAGE_VERSION = '0.5.0'
# Variables for 'waf dist'
APPNAME = 'patchage'
VERSION = PATCHAGE_VERSION
APP_HUMAN_NAME = 'Patchage'
# Mandatory variables
top = '.'
out = 'build'
def options(opt):
autowaf.set_options(opt)
opt.add_option('--patchage-install-name', type='string', default=APPNAME,
dest='patchage_install_name',
help="Patchage install name. [Default: '" + APPNAME + "']")
opt.add_option('--patchage-human-name', type='string', default=APP_HUMAN_NAME,
dest='patchage_human_name',
help="Patchage human name [Default: '" + APP_HUMAN_NAME + "']")
opt.add_option('--jack-dbus', action='store_true', default=False, dest='jack_dbus',
help="Use Jack via D-Bus [Default: False (use libjack)]")
opt.add_option('--no-lash', action='store_true', default=False, dest='no_lash',
help="Do not build Lash support")
opt.add_option('--no-alsa', action='store_true', default=False, dest='no_alsa',
help="Do not build Alsa Sequencer support")
opt.add_option('--no-binloc', action='store_true', default=False, dest='no_binloc',
help="Do not try to read files from executable's parent directory")
def configure(conf):
autowaf.configure(conf)
autowaf.display_header('Patchage Configuration')
conf.check_tool('compiler_cxx')
autowaf.check_pkg(conf, 'dbus-1', uselib_store='DBUS', mandatory=False)
autowaf.check_pkg(conf, 'dbus-glib-1', uselib_store='DBUS_GLIB', mandatory=False)
autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6', uselib_store='GNOMECANVASMM', mandatory=True)
autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
atleast_version='2.14.0', mandatory=True)
autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM',
atleast_version='2.14.0', mandatory=True)
autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
atleast_version='2.11.12', mandatory=True)
autowaf.check_pkg(conf, 'libglademm-2.4', uselib_store='GLADEMM',
atleast_version='2.6.0', mandatory=True)
autowaf.check_pkg(conf, 'flowcanvas', uselib_store='FLOWCANVAS',
atleast_version='0.7.1', mandatory=True)
autowaf.check_pkg(conf, 'raul', uselib_store='RAUL',
atleast_version='0.5.1', mandatory=True)
# Check for dladdr
conf.check(function_name='dladdr',
header_name='dlfcn.h',
cflags='-D_GNU_SOURCE',
linkflags='-ldl',
define_name='HAVE_DLADDR',
mandatory=False)
# Use Jack D-Bus if requested (only one jack driver is allowed)
conf.env['HAVE_JACK_DBUS'] = conf.env['HAVE_DBUS'] == 1 and conf.env['HAVE_DBUS_GLIB'] == 1 and Options.options.jack_dbus
if conf.env['HAVE_JACK_DBUS']:
autowaf.define(conf, 'HAVE_JACK_DBUS', conf.env['HAVE_JACK_DBUS'])
else:
autowaf.check_pkg(conf, 'jack', uselib_store='JACK', atleast_version='0.107.0', mandatory=False)
if conf.env['HAVE_JACK'] == 1:
autowaf.define(conf, 'PATCHAGE_LIBJACK', 1)
autowaf.define(conf, 'HAVE_JACK_MIDI', int(conf.env['HAVE_JACK'] == 1 or conf.env['HAVE_JACK_DBUS'] == 1))
# Use Alsa if present unless --no-alsa
if not Options.options.no_alsa:
autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA', mandatory=False)
# Use LASH if we have DBUS unless --no-lash
if not Options.options.no_lash and conf.env['HAVE_DBUS_GLIB']:
autowaf.define(conf, 'HAVE_LASH', 1)
# Find files at binary location if we have dladdr unless --no-binloc
if not Options.options.no_binloc and conf.env['HAVE_DLADDR']:
autowaf.define(conf, 'PATCHAGE_BINLOC', 1)
# Boost headers
autowaf.check_header(conf, 'boost/shared_ptr.hpp', mandatory=True)
autowaf.check_header(conf, 'boost/weak_ptr.hpp', mandatory=True)
conf.env['PATCHAGE_VERSION'] = PATCHAGE_VERSION
conf.env['APP_INSTALL_NAME'] = Options.options.patchage_install_name
conf.env['APP_HUMAN_NAME'] = Options.options.patchage_human_name
autowaf.define(conf, 'PATCHAGE_DATA_DIR', os.path.join(
conf.env['DATADIR'], conf.env['APP_INSTALL_NAME']))
conf.write_config_header('patchage-config.h', remove=False)
autowaf.display_msg(conf, "Install name", "'" + conf.env['APP_INSTALL_NAME'] + "'", 'CYAN')
autowaf.display_msg(conf, "App human name", "'" + conf.env['APP_HUMAN_NAME'] + "'", 'CYAN')
autowaf.display_msg(conf, "Jack (D-Bus)", str(conf.env['HAVE_JACK_DBUS']))
autowaf.display_msg(conf, "LASH (D-Bus)", str(conf.env['HAVE_LASH'] == 1))
autowaf.display_msg(conf, "Jack (libjack)", str(conf.env['PATCHAGE_LIBJACK'] == 1))
autowaf.display_msg(conf, "Alsa Sequencer", str(conf.env['HAVE_ALSA'] == 1))
print
def build(bld):
out_base = ''
if Options.platform == 'darwin':
out_base = 'Patchage.app/Contents/'
# Program
prog = bld(features = 'cxx cxxprogram')
prog.includes = ['.', 'src']
prog.target = out_base + bld.env['APP_INSTALL_NAME']
prog.install_path = '${BINDIR}'
autowaf.use_lib(bld, prog, 'DBUS FLOWCANVAS GLADEMM DBUS_GLIB GNOMECANVASMM GTHREAD RAUL')
prog.source = '''
src/Client.cpp
src/Patchage.cpp
src/PatchageCanvas.cpp
src/PatchageEvent.cpp
src/PatchageModule.cpp
src/StateManager.cpp
src/main.cpp
'''
if bld.env['HAVE_JACK_DBUS']:
prog.source += '''
src/JackDbusDriver.cpp
'''
if bld.env['HAVE_LASH']:
prog.source += '''
src/LashProxy.cpp
src/LoadProjectDialog.cpp
src/Project.cpp
src/ProjectList.cpp
src/ProjectPropertiesDialog.cpp
src/Session.cpp
'''
if bld.env['HAVE_LASH'] or bld.env['HAVE_JACK_DBUS']:
prog.source += ' src/DBus.cpp '
if bld.env['PATCHAGE_LIBJACK']:
prog.source += ' src/JackDriver.cpp '
prog.uselib += ' JACK '
if bld.env['HAVE_ALSA'] == 1:
prog.source += ' src/AlsaDriver.cpp '
prog.uselib += ' ALSA '
if bld.env['PATCHAGE_BINLOC']:
prog.linkflags = ['-ldl']
# Glade XML UI definition
bld(features = 'subst',
source = 'src/patchage.glade',
target = out_base + 'patchage.glade',
install_path = '${DATADIR}/' + bld.env['APP_INSTALL_NAME'],
chmod = 0644,
PATCHAGE_VERSION = PATCHAGE_VERSION)
# 'Desktop' file (menu entry, icon, etc)
bld(features = 'subst',
source = 'patchage.desktop.in',
target = 'patchage.desktop',
install_path = '${DATADIR}/applications',
chmod = 0644,
BINDIR = os.path.normpath(bld.env['BINDIR']),
APP_INSTALL_NAME = bld.env['APP_INSTALL_NAME'],
APP_HUMAN_NAME = bld.env['APP_HUMAN_NAME'])
if Options.platform == 'darwin':
# Property list
bld(features = 'subst',
source = 'osx/Info.plist.in',
target = out_base + 'Info.plist',
install_path = '',
chmod = 0644)
# Icons
bld(rule='cp ${SRC} ${TGT}',
source = 'osx/Patchage.icns',
target = out_base + 'Resources/Patchage.icns')
# Gtk/Pango/etc configuration files
for i in ['pangorc', 'pango.modules', 'gtkrc']:
bld(rule = 'cp ${SRC} ${TGT}',
source = 'osx/' + i,
target = out_base + 'Resources/' + i)
# Icons
# After installation, icon cache should be updated using:
# gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
icon_sizes = [16, 22, 24, 32, 48, 128, 256, 512]
for s in icon_sizes:
d = '%dx%d' % (s, s)
bld.install_as(
os.path.join(bld.env['DATADIR'], 'icons', 'hicolor', d, 'apps',
bld.env['APP_INSTALL_NAME'] + '.png'),
'icons/' + d + '/patchage.png')
bld.install_as(
os.path.join(bld.env['DATADIR'], 'icons', 'hicolor', 'scalable', 'apps',
bld.env['APP_INSTALL_NAME'] + '.svg'),
'icons/scalable/patchage.svg')
bld.install_files('${MANDIR}/man1', bld.path.ant_glob('doc/*.1'))
|