| [160] | 1 | # |
|---|
| 2 | # Hydrogen build script |
|---|
| 3 | # |
|---|
| 4 | |
|---|
| 5 | # vim: set filetype=python |
|---|
| 6 | # kate: syntax python |
|---|
| 7 | |
|---|
| 8 | import urllib |
|---|
| 9 | import os |
|---|
| 10 | import subprocess |
|---|
| 11 | import sys |
|---|
| [162] | 12 | import glob |
|---|
| [160] | 13 | |
|---|
| [204] | 14 | def printStatus( value ): |
|---|
| [672] | 15 | if str(value) == "1": |
|---|
| [204] | 16 | return "enabled" |
|---|
| 17 | else: |
|---|
| 18 | return "disabled" |
|---|
| 19 | |
|---|
| [162] | 20 | def recursiveDirs(root) : |
|---|
| 21 | return filter( ( lambda a : a.rfind( ".svn") == -1 ), [ a[0] for a in os.walk( root ) ] ) |
|---|
| [160] | 22 | |
|---|
| [162] | 23 | def unique( list ) : |
|---|
| 24 | return dict.fromkeys( list ).keys() |
|---|
| 25 | |
|---|
| 26 | def scanFiles(dir, accept=[ "*.cpp" ], reject=[] ) : |
|---|
| 27 | sources = [] |
|---|
| 28 | paths = recursiveDirs( dir ) |
|---|
| 29 | for path in paths: |
|---|
| 30 | for pattern in accept: |
|---|
| 31 | sources += glob.glob( path + "/" + pattern ) |
|---|
| 32 | for pattern in reject: |
|---|
| 33 | sources = filter( ( lambda a : a.rfind( pattern ) == -1 ), sources ) |
|---|
| 34 | return unique( sources ) |
|---|
| 35 | |
|---|
| 36 | def subdirsContaining( root, patterns ): |
|---|
| 37 | dirs = unique( map( os.path.dirname, scanFiles( root, patterns ) ) ) |
|---|
| 38 | dirs.sort() |
|---|
| 39 | return dirs |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | |
|---|
| [672] | 43 | def get_platform_flags( opts ): |
|---|
| [162] | 44 | includes = [] |
|---|
| [385] | 45 | cppflags = [] |
|---|
| 46 | ldflags = [] |
|---|
| [162] | 47 | |
|---|
| [672] | 48 | env = Environment( options = opts ) |
|---|
| 49 | |
|---|
| [162] | 50 | if sys.platform == "linux2" or sys.platform == "darwin": |
|---|
| [678] | 51 | if str(env['debug']) == "1": |
|---|
| 52 | cppflags += ['-Wall', '-g2', '-ggdb', '-O0'] |
|---|
| 53 | else: |
|---|
| 54 | cppflags += ['-O3', '-fomit-frame-pointer', '-funroll-loops'] |
|---|
| [202] | 55 | #cppflags += " %s" % get_optimized_flags( target_cpu ) |
|---|
| [162] | 56 | |
|---|
| [678] | 57 | if str(env['oss']) == "1": cppflags.append('-DOSS_SUPPORT') |
|---|
| [672] | 58 | if str(env['alsa']) == "1": cppflags.append('-DALSA_SUPPORT') |
|---|
| 59 | if str(env['jack']) == "1": cppflags.append('-DJACK_SUPPORT') |
|---|
| 60 | if str(env['lash']) == "1": cppflags.append('-DLASH_SUPPORT') |
|---|
| 61 | if str(env['lrdf']) == "1": cppflags.append('-DLRDF_SUPPORT') |
|---|
| 62 | if str(env['portaudio']) == "1": cppflags.append('-DPORTAUDIO_SUPPORT') |
|---|
| 63 | if str(env['portmidi']) == "1": cppflags.append('-DPORTMIDI_SUPPORT') |
|---|
| [204] | 64 | |
|---|
| [294] | 65 | |
|---|
| [385] | 66 | cppflags.append('-DFLAC_SUPPORT') |
|---|
| 67 | cppflags.append('-DLADSPA_SUPPORT') |
|---|
| [678] | 68 | |
|---|
| [294] | 69 | |
|---|
| [672] | 70 | if str(env['lash']) == "1": includes.append( '/usr/lib/lash-1.0' ) |
|---|
| [294] | 71 | |
|---|
| [672] | 72 | if str(env['libarchive']) == "1": cppflags.append('-DLIBARCHIVE_SUPPORT') |
|---|
| [183] | 73 | |
|---|
| [162] | 74 | includes.append( './' ) |
|---|
| [196] | 75 | includes.append( 'gui/src/' ) |
|---|
| [162] | 76 | includes.append( '3rdparty/install/include' ) |
|---|
| [294] | 77 | |
|---|
| [162] | 78 | if sys.platform == 'linux2': |
|---|
| [385] | 79 | ldflags.append('-lasound') |
|---|
| [183] | 80 | |
|---|
| [162] | 81 | elif sys.platform == 'darwin': |
|---|
| 82 | pass |
|---|
| [269] | 83 | elif sys.platform == "win32": |
|---|
| [684] | 84 | includes.append( '3rdparty\libsndfile-1_0_17' ) |
|---|
| [294] | 85 | includes.append( 'build\pthreads\include' ) |
|---|
| [269] | 86 | includes.append( '3rdparty\libarchive\include' ) |
|---|
| [294] | 87 | includes.append( 'windows\timeFix' ) |
|---|
| [162] | 88 | else: |
|---|
| 89 | raise Exception( "Platform '%s' not supported" % sys.platform ) |
|---|
| 90 | |
|---|
| 91 | return (includes, cppflags, ldflags) |
|---|
| 92 | |
|---|
| 93 | |
|---|
| 94 | |
|---|
| [160] | 95 | def download_3rdparty_libs(): |
|---|
| 96 | print " * Downloading required 3rdparty libraries" |
|---|
| 97 | |
|---|
| 98 | curdir = os.path.abspath( os.path.curdir ) |
|---|
| [294] | 99 | |
|---|
| [269] | 100 | if sys.platform != "win32": |
|---|
| 101 | prefix = os.path.abspath( os.path.curdir ) + "/3rdparty/install" |
|---|
| 102 | else: |
|---|
| 103 | prefix = os.path.abspath( os.path.curdir ) + "\3rdparty\install" |
|---|
| [160] | 104 | |
|---|
| [294] | 105 | |
|---|
| [160] | 106 | compile_flags = "--enable-static --disable-shared" |
|---|
| 107 | |
|---|
| 108 | |
|---|
| 109 | if not os.path.exists( "3rdparty" ): |
|---|
| 110 | os.mkdir( "3rdparty" ) |
|---|
| [684] | 111 | |
|---|
| [160] | 112 | |
|---|
| [684] | 113 | |
|---|
| [160] | 114 | if not os.path.exists( "3rdparty/install" ): |
|---|
| 115 | os.mkdir( "3rdparty/install" ) |
|---|
| [294] | 116 | |
|---|
| [269] | 117 | if not os.path.exists( "3rdparty/install/lib" ): |
|---|
| 118 | os.mkdir( "3rdparty/install/lib" ) |
|---|
| [160] | 119 | |
|---|
| 120 | |
|---|
| [294] | 121 | |
|---|
| 122 | |
|---|
| [269] | 123 | if not os.path.exists( "3rdparty/libsndfile.tar.gz" ) and not os.path.exists("3rdparty/libsndfile.zip"): |
|---|
| 124 | if sys.platform != "win32": |
|---|
| 125 | print " * Downloading libsndfile.tar.gz" |
|---|
| 126 | urllib.urlretrieve("http://www.mega-nerd.com/libsndfile/libsndfile-1.0.17.tar.gz", "3rdparty/libsndfile.tar.gz") |
|---|
| 127 | else: |
|---|
| 128 | print " * Downloading libsndfile.zip" |
|---|
| 129 | urllib.urlretrieve("http://www.mega-nerd.com/libsndfile/libsndfile-1_0_17.zip", "3rdparty/libsndfile.zip") |
|---|
| [294] | 130 | |
|---|
| 131 | |
|---|
| [269] | 132 | if sys.platform != "win32": |
|---|
| 133 | #unix commands |
|---|
| 134 | if not os.path.exists( "3rdparty/install/lib/libsndfile.a" ): |
|---|
| 135 | Execute( "cd 3rdparty; tar xzf libsndfile.tar.gz" ) |
|---|
| 136 | Execute( "cd 3rdparty/libsndfile-1.0.17; ./configure --disable-flac --prefix=%s %s" % (prefix, compile_flags) ) |
|---|
| [682] | 137 | res = Execute( "cd 3rdparty/libsndfile-1.0.17; make -j2; make install" ) |
|---|
| [269] | 138 | if res != 0: |
|---|
| 139 | raise Exception( "Error compiling 3rdparty libraries" ) |
|---|
| 140 | else: |
|---|
| 141 | #windows |
|---|
| 142 | if not os.path.exists( "3rdparty\install\lib\libsndfile-1.dll" ): |
|---|
| 143 | Execute( "unzip 3rdparty\libsndfile.zip -d 3rdparty" ) |
|---|
| 144 | Execute( "copy 3rdparty\libsndfile-1_0_17\libsndfile-1.dll 3rdparty\install\lib") |
|---|
| 145 | Execute( "copy 3rdparty\libsndfile-1_0_17\sndfile.h 3rdparty\install\lib") |
|---|
| [160] | 146 | |
|---|
| 147 | |
|---|
| 148 | |
|---|
| [294] | 149 | |
|---|
| [160] | 150 | def get_svn_revision(): |
|---|
| [684] | 151 | |
|---|
| 152 | if sys.platform != "win32": |
|---|
| 153 | p = subprocess.Popen("svnversion -n", shell=True, stdout=subprocess.PIPE) |
|---|
| 154 | return p.stdout.read() |
|---|
| 155 | else: |
|---|
| 156 | return "win32 build" |
|---|
| [160] | 157 | |
|---|
| 158 | |
|---|
| [672] | 159 | def get_hydrogen_lib( opts ): |
|---|
| 160 | includes, cppflags, ldflags = get_platform_flags( opts ) |
|---|
| [162] | 161 | |
|---|
| 162 | includes.append( "libs/hydrogen/include" ) |
|---|
| [202] | 163 | includes.append( "/usr/include/lash-1.0") |
|---|
| [162] | 164 | |
|---|
| [684] | 165 | |
|---|
| [269] | 166 | #location of qt4.py |
|---|
| 167 | qt4ToolLocation="." |
|---|
| 168 | |
|---|
| [672] | 169 | env = Environment(options = opts , tools=['default','qt4'], toolpath=[qt4ToolLocation], ENV=os.environ, CPPPATH = includes, CPPFLAGS = cppflags, CCFLAGS = "", LINKFLAGS=ldflags ) |
|---|
| [162] | 170 | env.EnableQt4Modules( ['QtCore', 'QtGui'], debug=False) |
|---|
| 171 | env.CacheDir( "scons_cache" ) |
|---|
| [450] | 172 | |
|---|
| [672] | 173 | if str(env['jack']) == "1": |
|---|
| [469] | 174 | env.ParseConfig('pkg-config --modversion jack', get_jack_api_flags) |
|---|
| [162] | 175 | |
|---|
| [450] | 176 | #env.Decider is not known in older scons version |
|---|
| 177 | try: |
|---|
| 178 | env.Decider( "MD5-timestamp" ) |
|---|
| 179 | except AttributeError: |
|---|
| 180 | env.SourceSignatures('MD5') |
|---|
| 181 | |
|---|
| 182 | |
|---|
| [162] | 183 | src = scanFiles( "libs/hydrogen", ['*.cpp', '*.cc', '*.c' ], [ 'moc_'] ) |
|---|
| [436] | 184 | src.append( "version.cpp" ) |
|---|
| [162] | 185 | |
|---|
| 186 | static_lib = env.StaticLibrary(target = 'hydrogen', source = src ) |
|---|
| 187 | return static_lib |
|---|
| 188 | |
|---|
| 189 | |
|---|
| [672] | 190 | def get_hydrogen_gui( lib_hydrogen , opts ): |
|---|
| 191 | includes, cppflags, ldflags = get_platform_flags( opts ) |
|---|
| [162] | 192 | |
|---|
| 193 | includes.append( "libs/hydrogen/include" ) |
|---|
| 194 | includes.append( "gui/src/UI" ) |
|---|
| [202] | 195 | includes.append( "/usr/include/lash-1.0") |
|---|
| [162] | 196 | |
|---|
| [269] | 197 | #location of qt4.py |
|---|
| 198 | qt4ToolLocation="." |
|---|
| 199 | |
|---|
| [672] | 200 | env = Environment(options = opts , tools=['default','qt4'], toolpath=[qt4ToolLocation], ENV=os.environ, CPPPATH = includes, CPPFLAGS = cppflags, CCFLAGS = "", LINKFLAGS=ldflags ) |
|---|
| [432] | 201 | |
|---|
| 202 | env.EnableQt4Modules( ['QtCore', 'QtGui','QtNetwork','QtXml'], debug=False) |
|---|
| 203 | # |
|---|
| [162] | 204 | env.CacheDir( "scons_cache" ) |
|---|
| [450] | 205 | |
|---|
| 206 | #env.Decider is not known in older scons version |
|---|
| 207 | try: |
|---|
| 208 | env.Decider( "MD5-timestamp" ) |
|---|
| 209 | except AttributeError: |
|---|
| 210 | env.SourceSignatures('MD5') |
|---|
| [162] | 211 | |
|---|
| 212 | # rcc needs a -name flag because examples use identified resource files |
|---|
| 213 | def takebasename(file): |
|---|
| 214 | return os.path.splitext(os.path.basename(file))[0] |
|---|
| 215 | |
|---|
| 216 | |
|---|
| 217 | directory = "gui" |
|---|
| 218 | |
|---|
| 219 | resources = [ env.Qrc( qrc, QT4_QRCFLAGS = '-name ' + takebasename( qrc ) ) for qrc in scanFiles(directory, ['*.qrc'] ) ] |
|---|
| 220 | interfaces = [ env.Uic4( uic ) for uic in scanFiles(directory, ['*.ui'] ) ] |
|---|
| 221 | |
|---|
| 222 | |
|---|
| 223 | src = scanFiles( directory, ['*.cpp', '*.cc', '*.c' ], [ 'moc_'] ) |
|---|
| 224 | |
|---|
| 225 | env.Append( LIBS = lib_hydrogen ) |
|---|
| 226 | env.Append( LIBS = ["sndfile"] ) |
|---|
| [678] | 227 | |
|---|
| [675] | 228 | if str(env['lrdf']) == "1": env.Append( LIBS = ["lrdf"] ) |
|---|
| 229 | if str(env['flac']) == "1": env.Append( LIBS = ["FLAC","FLAC++"] ) |
|---|
| 230 | if str(env['lash']) == "1": env.Append( LIBS = ["lash"]) |
|---|
| 231 | if str(env['jack']) == "1": env.Append( LIBS = ["jack"]) |
|---|
| 232 | if str(env['alsa']) == "1": env.Append( LIBS = ["asound"]) |
|---|
| [672] | 233 | if str(env['libarchive']) == "1": env.Append( LIBS = ["archive"]) |
|---|
| [234] | 234 | else: env.Append( LIBS = ["tar"]) |
|---|
| [672] | 235 | if str(env['portaudio']) == "1": env.Append( LIBS = [ "portaudio" ] ) |
|---|
| 236 | if str(env['portmidi']) == "1": |
|---|
| [299] | 237 | env.Append( LIBS = [ "portmidi" ] ) |
|---|
| 238 | env.Append( LIBS = [ "porttime" ] ) |
|---|
| [294] | 239 | env.Append( LIBPATH = '3rdparty\libsndfile-1_0_17' ) |
|---|
| 240 | env.Append( LIBPATH = 'build\pthreads\lib' ) |
|---|
| [204] | 241 | |
|---|
| [374] | 242 | app = env.Program(target = 'hydrogen', source = src ) |
|---|
| [162] | 243 | |
|---|
| 244 | env.Alias('programs', app) |
|---|
| 245 | env.Default('programs') |
|---|
| [294] | 246 | |
|---|
| [672] | 247 | env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data', source="./data/i18n")) |
|---|
| 248 | env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data', source="./data/img")) |
|---|
| 249 | env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data', source="./data/drumkits")) |
|---|
| 250 | env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data', source="./data/demo_songs")) |
|---|
| 251 | env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data', source="./data/hydrogen.default.conf")) |
|---|
| 252 | env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data', source="./data/emptySample.wav")) |
|---|
| 253 | env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data', source="./data/click.wav")) |
|---|
| 254 | env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data', source="./data/doc")) |
|---|
| 255 | env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data', source="./data/DefaultSong.h2song")) |
|---|
| 256 | env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/bin/', source="./hydrogen")) |
|---|
| 257 | env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/applications', source="./hydrogen.desktop")) |
|---|
| 258 | env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/pixmaps', source="./data/img/gray/h2-icon.svg")) |
|---|
| [227] | 259 | |
|---|
| [650] | 260 | |
|---|
| [162] | 261 | return app |
|---|
| 262 | |
|---|
| [469] | 263 | def get_jack_api_flags(xenv, pkg_ver): |
|---|
| 264 | (major, minor, patch) = pkg_ver.rstrip().split('.') |
|---|
| 265 | major = int(major) |
|---|
| 266 | minor = int(minor) |
|---|
| 267 | patch = int(patch) |
|---|
| 268 | rv = "" |
|---|
| 269 | if (major == 0) and (minor < 102): |
|---|
| 270 | rv = "-DJACK_NO_BBT_OFFSET" |
|---|
| 271 | if (major == 0) and (minor == 102) and (patch < 4): |
|---|
| 272 | rv = "-DJACK_NO_BBT_OFFSET" |
|---|
| 273 | xenv.MergeFlags(rv) |
|---|
| [162] | 274 | |
|---|
| [672] | 275 | opts = Options('scache.conf') |
|---|
| [294] | 276 | |
|---|
| 277 | #platform independent settings |
|---|
| [202] | 278 | opts.Add('debug', 'Set to 1 to build with debug informations', 0) |
|---|
| [294] | 279 | opts.Add('libarchive', 'Set to 1 to enable libarchive instead of libtar', 0) |
|---|
| 280 | opts.Add('prefix','Default: /usr/local',"/usr/local") |
|---|
| [639] | 281 | opts.Add('DESTDIR','Default: none',"") |
|---|
| [269] | 282 | |
|---|
| [294] | 283 | #platform dependent settings |
|---|
| [269] | 284 | if sys.platform != "win32": |
|---|
| [678] | 285 | opts.Add('oss', 'Set to 1 to enable oss',1) |
|---|
| 286 | |
|---|
| [296] | 287 | opts.Add('portmidi', 'Set to 1 to enable portmidi',0) |
|---|
| 288 | |
|---|
| 289 | opts.Add('portaudio', 'Set to 1 to enable portaudio',0) |
|---|
| 290 | |
|---|
| [269] | 291 | opts.Add('lash', 'Set to 1 to enable lash',0) |
|---|
| [294] | 292 | |
|---|
| 293 | |
|---|
| [269] | 294 | opts.Add('alsa', 'Set to 1 to enable alsa',1) |
|---|
| [294] | 295 | |
|---|
| [269] | 296 | |
|---|
| [294] | 297 | opts.Add('jack', 'Set to 1 to enable jack',1) |
|---|
| 298 | |
|---|
| 299 | |
|---|
| 300 | opts.Add('lrdf', 'Set to 1 to enable lrdf',1) |
|---|
| 301 | |
|---|
| 302 | |
|---|
| 303 | opts.Add('flac', 'Set to 1 to enable flac',1) |
|---|
| [269] | 304 | else: |
|---|
| [678] | 305 | #alsa, lash,oss and jack are not available on windows |
|---|
| [296] | 306 | opts.Add('portmidi', 'Set to 1 to enable portmidi',1) |
|---|
| 307 | |
|---|
| 308 | opts.Add('portaudio', 'Set to 1 to enable portaudio',1) |
|---|
| 309 | |
|---|
| [678] | 310 | opts.Add('oss', 'Set to 1 to enable oss',0) |
|---|
| 311 | |
|---|
| [269] | 312 | opts.Add('lash', 'Set to 1 to enable lash',0) |
|---|
| [294] | 313 | |
|---|
| [269] | 314 | opts.Add('alsa', 'Set to 1 to enable alsa',0) |
|---|
| [294] | 315 | |
|---|
| [269] | 316 | opts.Add('jack', 'Set to 1 to enable jack',0) |
|---|
| 317 | |
|---|
| [294] | 318 | opts.Add('lrdf', 'Set to 1 to enable lrdf',0) |
|---|
| 319 | |
|---|
| 320 | opts.Add('flac', 'Set to 1 to enable flac',0) |
|---|
| [204] | 321 | |
|---|
| [229] | 322 | |
|---|
| 323 | |
|---|
| [672] | 324 | #get includes ( important if you compile on non-standard envorionments) |
|---|
| [296] | 325 | |
|---|
| [672] | 326 | includes, a , b = get_platform_flags( opts ) |
|---|
| [204] | 327 | |
|---|
| [269] | 328 | env = Environment(options = opts, CPPPATH = includes) |
|---|
| 329 | |
|---|
| [672] | 330 | |
|---|
| [202] | 331 | Help(opts.GenerateHelpText(env)) |
|---|
| [160] | 332 | |
|---|
| 333 | |
|---|
| [269] | 334 | platform = sys.platform |
|---|
| [202] | 335 | |
|---|
| [269] | 336 | #just download 3rd party libs if we're *not* running linux. |
|---|
| 337 | #We trust in our package managment system! |
|---|
| 338 | if platform == "darwin" or platform == "win32": |
|---|
| 339 | download_3rdparty_libs() |
|---|
| [202] | 340 | |
|---|
| [269] | 341 | |
|---|
| 342 | |
|---|
| [204] | 343 | #Check if all required libraries are installed |
|---|
| 344 | conf = Configure(env) |
|---|
| 345 | if not conf.CheckCHeader('sndfile.h'): |
|---|
| 346 | print 'libsndfile must be installed!' |
|---|
| 347 | Exit(1) |
|---|
| [202] | 348 | |
|---|
| [204] | 349 | |
|---|
| 350 | |
|---|
| 351 | # it seems that conf.CheckCHeader dislikes like the "++" in filenames |
|---|
| 352 | #if not conf.CheckCHeader('FLAC++/all.h'): |
|---|
| 353 | # print 'FLAC++ must be installed!' |
|---|
| 354 | # Exit(1) |
|---|
| 355 | |
|---|
| 356 | |
|---|
| 357 | # these libraries are optional (can be enabled/disabled, see 'scons -h') |
|---|
| 358 | |
|---|
| [672] | 359 | if str(env['portaudio']) == "1" and not conf.CheckCHeader('portaudio.h'): |
|---|
| [505] | 360 | print "portaudio must be installed!" |
|---|
| 361 | Exit(1) |
|---|
| 362 | |
|---|
| [672] | 363 | if str(env['portmidi']) == "1" and not conf.CheckCHeader('portmidi.h'): |
|---|
| [505] | 364 | print "portmidi must be installed!" |
|---|
| 365 | Exit(1) |
|---|
| 366 | |
|---|
| 367 | |
|---|
| [204] | 368 | #alsa: (default: enabled) |
|---|
| [672] | 369 | if str(env['alsa']) == "1" and not conf.CheckCHeader('alsa/asoundlib.h'): |
|---|
| [204] | 370 | print 'alsa must be installed!' |
|---|
| 371 | Exit(1) |
|---|
| 372 | |
|---|
| 373 | #jack: (default: enabled) |
|---|
| [672] | 374 | if str(env['jack']) == "1" and not conf.CheckCHeader('jack/jack.h'): |
|---|
| [204] | 375 | print 'jack must be installed!' |
|---|
| 376 | Exit(1) |
|---|
| 377 | |
|---|
| 378 | #lash: (default: disabled) |
|---|
| [672] | 379 | if str(env['lash']) == "1" and not os.path.isdir("/usr/include/lash-1.0"): |
|---|
| [204] | 380 | print 'liblash must be installed!' |
|---|
| 381 | Exit(1) |
|---|
| 382 | |
|---|
| [234] | 383 | #libarchive: (default: disabled) |
|---|
| [672] | 384 | if str(env['libarchive']) == "1" and not conf.CheckCHeader("archive.h"): |
|---|
| [234] | 385 | print 'libarchive must be installed!' |
|---|
| 386 | Exit(1) |
|---|
| 387 | #libtar: needed if not libarchive |
|---|
| [672] | 388 | elif not str(env['libarchive']) == "1" and not conf.CheckCHeader("zlib.h"): |
|---|
| [684] | 389 | print 'zlib devel package must be installed!' |
|---|
| 390 | Exit(1) |
|---|
| [672] | 391 | elif not str(env['libarchive']) == "1" and not conf.CheckCHeader("libtar.h"): |
|---|
| [684] | 392 | print 'libtar must be installed!' |
|---|
| 393 | Exit(1) |
|---|
| [204] | 394 | |
|---|
| [294] | 395 | #lrdf: categorizing of ladspa effects |
|---|
| [672] | 396 | if str(env['lrdf']) == "1" and not conf.CheckCHeader('lrdf.h'): |
|---|
| [294] | 397 | print 'lrdf must be installed!' |
|---|
| 398 | Exit(1) |
|---|
| [204] | 399 | |
|---|
| [294] | 400 | #flac: support for flac samples |
|---|
| [672] | 401 | if str(env['flac']) == "1" and not conf.CheckCHeader('FLAC/all.h'): |
|---|
| [294] | 402 | print 'FLAC must be installed!' |
|---|
| 403 | Exit(1) |
|---|
| [204] | 404 | |
|---|
| 405 | |
|---|
| [160] | 406 | print "" |
|---|
| 407 | print "=================================================================" |
|---|
| 408 | print " Hydrogen build script" |
|---|
| 409 | print "" |
|---|
| 410 | print " Revision: %s" % get_svn_revision() |
|---|
| [204] | 411 | print " Platform: %s" % platform |
|---|
| [202] | 412 | |
|---|
| [672] | 413 | if str(env['debug']) == "1" : |
|---|
| [160] | 414 | print " Debug build" |
|---|
| 415 | else: |
|---|
| 416 | print " Release build" |
|---|
| [202] | 417 | |
|---|
| [672] | 418 | print " Prefix: " + env['prefix'] |
|---|
| 419 | print " Destdir: " + env['DESTDIR'] |
|---|
| [160] | 420 | print "=================================================================" |
|---|
| [204] | 421 | print "Feature Overview:\n" |
|---|
| [202] | 422 | |
|---|
| [678] | 423 | |
|---|
| [672] | 424 | print " lash: " + printStatus( env["lash"] ) |
|---|
| [678] | 425 | print " oss: " + printStatus( env["oss"] ) |
|---|
| [672] | 426 | print " alsa: " + printStatus( env["alsa"] ) |
|---|
| 427 | print " jack: " + printStatus( env["jack"] ) |
|---|
| 428 | print "libarchive: " + printStatus( env["libarchive"] ) + (' (using libtar instead)', '')[env['libarchive']] |
|---|
| 429 | print " portaudio: " + printStatus( env["portaudio"] ) |
|---|
| 430 | print " portmidi: " + printStatus( env["portmidi"] ) |
|---|
| [202] | 431 | |
|---|
| 432 | print "\n=================================================================" |
|---|
| [160] | 433 | print "" |
|---|
| 434 | |
|---|
| [164] | 435 | # write the config.h file |
|---|
| 436 | conf = open("config.h", "w") |
|---|
| 437 | |
|---|
| 438 | conf.write( "#ifndef HYD_CONFIG_H\n" ) |
|---|
| 439 | conf.write( "#define HYD_CONFIG_H\n" ) |
|---|
| 440 | conf.write( "#include <string>\n" ) |
|---|
| [202] | 441 | |
|---|
| [238] | 442 | |
|---|
| [672] | 443 | if str(env['debug']) == "1": conf.write( "#define CONFIG_DEBUG\n" ) |
|---|
| 444 | if str(env['lash']) == "1": conf.write( "#define LASH\n" ) |
|---|
| [202] | 445 | |
|---|
| [164] | 446 | conf.write( "#ifndef QT_BEGIN_NAMESPACE\n" ) |
|---|
| 447 | conf.write( "# define QT_BEGIN_NAMESPACE\n" ) |
|---|
| 448 | conf.write( "#endif\n" ) |
|---|
| 449 | conf.write( "#ifndef QT_END_NAMESPACE\n" ) |
|---|
| 450 | conf.write( "# define QT_END_NAMESPACE\n" ) |
|---|
| 451 | conf.write( "#endif\n" ) |
|---|
| 452 | |
|---|
| [672] | 453 | conf.write( "#define CONFIG_PREFIX \"%s\"\n" % env['prefix'] ) |
|---|
| 454 | conf.write( "#define DATA_PATH \"%s/share/hydrogen/data\"\n" % env['prefix'] ) |
|---|
| [164] | 455 | |
|---|
| 456 | conf.write( "#endif\n" ) |
|---|
| 457 | |
|---|
| 458 | conf.close() |
|---|
| 459 | |
|---|
| [436] | 460 | version = open("version.cpp", "w") |
|---|
| 461 | version.write( "// autogenerated by Sconstruct script\n" ) |
|---|
| 462 | version.write( '#include "version.h"\n' ) |
|---|
| [377] | 463 | version.write( '#include "config.h"\n' ) |
|---|
| [436] | 464 | version.write( "static const std::string extra_version = \"svn%s\";\n" % get_svn_revision() ) |
|---|
| 465 | version.write( "static const std::string VERSION = \"0.9.4-\" + extra_version;\n" ) |
|---|
| 466 | version.write( "std::string get_version() { return VERSION; }\n" ) |
|---|
| [238] | 467 | version.close() |
|---|
| [160] | 468 | |
|---|
| [204] | 469 | |
|---|
| [672] | 470 | libhyd = get_hydrogen_lib( opts ) |
|---|
| 471 | app = get_hydrogen_gui( libhyd , opts ) |
|---|
| [162] | 472 | |
|---|
| [672] | 473 | opts.Save("scache.conf",env) |
|---|