Changeset 826 for branches/jackMidi/Sconstruct
- Timestamp:
- 02/21/09 00:06:01 (4 years ago)
- Files:
-
- 1 modified
-
branches/jackMidi/Sconstruct (modified) (21 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/jackMidi/Sconstruct
r538 r826 13 13 14 14 def printStatus( value ): 15 if value:15 if str(value) == "1": 16 16 return "enabled" 17 17 else: … … 41 41 42 42 43 def get_platform_flags( ):43 def get_platform_flags( opts ): 44 44 includes = [] 45 45 cppflags = [] 46 46 ldflags = [] 47 47 48 env = Environment( options = opts ) 49 48 50 if sys.platform == "linux2" or sys.platform == "darwin": 49 if debug:51 if str(env['debug']) == "1": 50 52 cppflags += ['-Wall', '-g2', '-ggdb', '-O0'] 51 53 else: … … 53 55 #cppflags += " %s" % get_optimized_flags( target_cpu ) 54 56 55 if alsa: cppflags.append('-DALSA_SUPPORT') 56 if jack: cppflags.append('-DJACK_SUPPORT') 57 if lash: cppflags.append('-DLASH_SUPPORT') 58 if lrdf: cppflags.append('-DLRDF_SUPPORT') 59 if portaudio: cppflags.append('-DPORTAUDIO_SUPPORT') 60 if portmidi: cppflags.append('-DPORTMIDI_SUPPORT') 57 if str(env['oss']) == "1": cppflags.append('-DOSS_SUPPORT') 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') 61 64 62 65 63 66 cppflags.append('-DFLAC_SUPPORT') 64 67 cppflags.append('-DLADSPA_SUPPORT') 65 cppflags.append('-DOSS_SUPPORT') 66 67 68 includes.append( '/usr/lib/lash-1.0' ) 69 70 if libarchive: cppflags.append('-DLIBARCHIVE_SUPPORT') 68 69 70 if str(env['lash']) == "1": includes.append( '/usr/lib/lash-1.0' ) 71 72 if str(env['libarchive']) == "1": cppflags.append('-DLIBARCHIVE_SUPPORT') 71 73 72 74 includes.append( './' ) … … 131 133 Execute( "cd 3rdparty; tar xzf libsndfile.tar.gz" ) 132 134 Execute( "cd 3rdparty/libsndfile-1.0.17; ./configure --disable-flac --prefix=%s %s" % (prefix, compile_flags) ) 133 res = Execute( "cd 3rdparty \libsndfile-1.0.17; make -j2; make install" )135 res = Execute( "cd 3rdparty/libsndfile-1.0.17; make -j2; make install" ) 134 136 if res != 0: 135 137 raise Exception( "Error compiling 3rdparty libraries" ) … … 150 152 151 153 152 def get_hydrogen_lib( ):153 includes, cppflags, ldflags = get_platform_flags( )154 def get_hydrogen_lib( opts ): 155 includes, cppflags, ldflags = get_platform_flags( opts ) 154 156 155 157 includes.append( "libs/hydrogen/include" ) … … 159 161 qt4ToolLocation="." 160 162 161 env = Environment( tools=['default','qt4'], toolpath=[qt4ToolLocation], ENV=os.environ, CPPPATH = includes, CPPFLAGS = cppflags, CCFLAGS = "", LINKFLAGS=ldflags )163 env = Environment(options = opts , tools=['default','qt4'], toolpath=[qt4ToolLocation], ENV=os.environ, CPPPATH = includes, CPPFLAGS = cppflags, CCFLAGS = "", LINKFLAGS=ldflags ) 162 164 env.EnableQt4Modules( ['QtCore', 'QtGui'], debug=False) 163 165 env.CacheDir( "scons_cache" ) 164 166 165 if jack:167 if str(env['jack']) == "1": 166 168 env.ParseConfig('pkg-config --modversion jack', get_jack_api_flags) 167 169 … … 173 175 174 176 175 if jack:177 if str(env['jack']) == "1": 176 178 env.ParseConfig('pkg-config --modversion jack', get_jack_midi_api_version) 177 179 … … 183 185 184 186 185 def get_hydrogen_gui( lib_hydrogen ):186 includes, cppflags, ldflags = get_platform_flags( )187 def get_hydrogen_gui( lib_hydrogen , opts ): 188 includes, cppflags, ldflags = get_platform_flags( opts ) 187 189 188 190 includes.append( "libs/hydrogen/include" ) … … 193 195 qt4ToolLocation="." 194 196 195 env = Environment(tools=['default','qt4'], toolpath=[qt4ToolLocation], ENV=os.environ, CPPPATH = includes, CPPFLAGS = cppflags, CCFLAGS = "", LINKFLAGS=ldflags ) 196 197 #hi, can't compile h2 with Qt3Support on my linux machines anymore (debian unstable & ubuntu ) 198 #, although i have correct installed "libqt4-qt3support" 199 #after correct one error into SoundLibraryPanal.cpp i get linking or what ever errors (sorry never seen before) after compiling. 200 #so, think it is better to disable qt3 support for now 201 # 202 #env.EnableQt4Modules( ['QtCore', 'QtGui','QtNetwork','QtXml','Qt3Support'], debug=False) 203 # 197 env = Environment(options = opts , tools=['default','qt4'], toolpath=[qt4ToolLocation], ENV=os.environ, CPPPATH = includes, CPPFLAGS = cppflags, CCFLAGS = "", LINKFLAGS=ldflags ) 198 204 199 env.EnableQt4Modules( ['QtCore', 'QtGui','QtNetwork','QtXml'], debug=False) 205 200 # … … 228 223 env.Append( LIBS = ["sndfile"] ) 229 224 230 if lrdf: env.Append( LIBS = ["lrdf"] )231 if flac: env.Append( LIBS = ["FLAC","FLAC++"] )232 if lash: env.Append( LIBS = ["lash"])233 if jack:225 if str(env['lrdf']) == "1": env.Append( LIBS = ["lrdf"] ) 226 if str(env['flac']) == "1": env.Append( LIBS = ["FLAC","FLAC++"] ) 227 if str(env['lash']) == "1": env.Append( LIBS = ["lash"]) 228 if str(env['jack']) == "1": 234 229 env.Append( LIBS = ["jack"]) 235 230 env.ParseConfig('pkg-config --modversion jack', get_jack_midi_api_version) 236 if alsa: env.Append( LIBS = ["asound"])237 if libarchive: env.Append( LIBS = ["archive"])231 if str(env['alsa']) == "1": env.Append( LIBS = ["asound"]) 232 if str(env['libarchive']) == "1": env.Append( LIBS = ["archive"]) 238 233 else: env.Append( LIBS = ["tar"]) 239 if portaudio: env.Append( LIBS = [ "portaudio" ] )240 if portmidi:234 if str(env['portaudio']) == "1": env.Append( LIBS = [ "portaudio" ] ) 235 if str(env['portmidi']) == "1": 241 236 env.Append( LIBS = [ "portmidi" ] ) 242 237 env.Append( LIBS = [ "porttime" ] ) … … 249 244 env.Default('programs') 250 245 251 env.Alias(target="install", source=env.Install(dir= destdir + install_prefix + '/share/hydrogen/data', source="./data/i18n")) 252 env.Alias(target="install", source=env.Install(dir= destdir + install_prefix + '/share/hydrogen/data', source="./data/img")) 253 env.Alias(target="install", source=env.Install(dir= destdir + install_prefix + '/share/hydrogen/data', source="./data/drumkits")) 254 env.Alias(target="install", source=env.Install(dir= destdir + install_prefix + '/share/hydrogen/data', source="./data/demo_songs")) 255 env.Alias(target="install", source=env.Install(dir= destdir + install_prefix + '/share/hydrogen/data', source="./data/hydrogen.default.conf")) 256 env.Alias(target="install", source=env.Install(dir= destdir + install_prefix + '/share/hydrogen/data', source="./data/emptySample.wav")) 257 env.Alias(target="install", source=env.Install(dir= destdir + install_prefix + '/share/hydrogen/data', source="./data/click.wav")) 258 env.Alias(target="install", source=env.Install(dir= destdir + install_prefix + '/share/hydrogen/data', source="./data/doc")) 259 env.Alias(target="install", source=env.Install(dir= destdir + install_prefix + '/share/hydrogen/data', source="./data/DefaultSong.h2song")) 260 env.Alias(target="install", source=env.Install(dir= destdir + install_prefix + '/bin/', source="./hydrogen")) 246 env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data', source="./data/i18n")) 247 env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data', source="./data/img")) 248 env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data', source="./data/drumkits")) 249 env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data', source="./data/demo_songs")) 250 env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data', source="./data/hydrogen.default.conf")) 251 env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data', source="./data/emptySample.wav")) 252 env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data', source="./data/click.wav")) 253 env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data', source="./data/doc")) 254 env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data', source="./data/DefaultSong.h2song")) 255 env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/bin/', source="./hydrogen")) 256 env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/applications', source="./hydrogen.desktop")) 257 env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/pixmaps', source="./data/img/gray/h2-icon.svg")) 258 261 259 262 260 return app … … 274 272 xenv.MergeFlags(rv) 275 273 276 opts = Options( )274 opts = Options('scache.conf') 277 275 278 276 #platform independent settings … … 280 278 opts.Add('libarchive', 'Set to 1 to enable libarchive instead of libtar', 0) 281 279 opts.Add('prefix','Default: /usr/local',"/usr/local") 282 opts.Add(' destdir','Default: none',"")280 opts.Add('DESTDIR','Default: none',"") 283 281 284 282 #platform dependent settings 285 283 if sys.platform != "win32": 284 opts.Add('oss', 'Set to 1 to enable oss',1) 285 286 286 opts.Add('portmidi', 'Set to 1 to enable portmidi',0) 287 portmidi = int(ARGUMENTS.get('portmidi',0))288 287 289 288 opts.Add('portaudio', 'Set to 1 to enable portaudio',0) 290 portaudio = int(ARGUMENTS.get('portaudio',0))291 289 292 290 opts.Add('lash', 'Set to 1 to enable lash',0) 293 lash = int(ARGUMENTS.get('lash',0))294 291 295 292 296 293 opts.Add('alsa', 'Set to 1 to enable alsa',1) 297 alsa = int(ARGUMENTS.get('alsa',1))298 294 299 295 300 296 opts.Add('jack', 'Set to 1 to enable jack',1) 301 jack = int(ARGUMENTS.get('jack',1)) 297 298 299 opts.Add('jack_midi', 'Set to 1 to enable jack MIDI',1) 302 300 303 301 304 302 opts.Add('lrdf', 'Set to 1 to enable lrdf',1) 305 lrdf = int(ARGUMENTS.get('lrdf',1))306 303 307 304 308 305 opts.Add('flac', 'Set to 1 to enable flac',1) 309 flac = int(ARGUMENTS.get('flac',1))310 311 306 else: 312 #alsa, lash and jack are not available on windows307 #alsa, lash,oss and jack are not available on windows 313 308 opts.Add('portmidi', 'Set to 1 to enable portmidi',1) 314 309 315 310 opts.Add('portaudio', 'Set to 1 to enable portaudio',1) 316 portaudio = int(ARGUMENTS.get('portaudio',1)) 317 311 312 opts.Add('oss', 'Set to 1 to enable oss',0) 313 318 314 opts.Add('lash', 'Set to 1 to enable lash',0) 319 lash = int(ARGUMENTS.get('lash',0)) 320 321 315 322 316 opts.Add('alsa', 'Set to 1 to enable alsa',0) 323 alsa = int(ARGUMENTS.get('alsa',0)) 324 325 317 326 318 opts.Add('jack', 'Set to 1 to enable jack',0) 327 jack = int(ARGUMENTS.get('jack',0)) 319 320 opts.Add('jack_midi', 'Set to 1 to enable jack MIDI',0) 328 321 329 322 opts.Add('lrdf', 'Set to 1 to enable lrdf',0) 330 lrdf = int(ARGUMENTS.get('lrdf',0))331 323 332 324 opts.Add('flac', 'Set to 1 to enable flac',0) 333 flac = int(ARGUMENTS.get('flac',0))334 325 335 326 # JACK MIDI version detection. 336 327 def get_jack_midi_api_version(xenv, pkg_ver): 337 global jack_midi338 328 rv = "" 339 329 (major, minor, patch) = pkg_ver.rstrip().split('.') … … 346 336 return rv 347 337 rv = "-DJACK_MIDI_SUPPORT" 348 jack_midi= 1338 xenv['jack_midi'] = 1 349 339 if (minor == 102) and (patch <= 26): 350 340 rv += " -DJACK_MIDI_0_102_0" … … 357 347 xenv.MergeFlags(rv) 358 348 359 debug =int(ARGUMENTS.get('debug', 0))360 libarchive = int(ARGUMENTS.get('libarchive', 0))361 362 install_prefix = ARGUMENTS.get('prefix',"/usr/local")363 destdir = ARGUMENTS.get('destdir',"")364 365 349 366 350 #get includes ( important if you compile on non-standard envorionments) 367 includes, a , b = get_platform_flags() 351 352 includes, a , b = get_platform_flags( opts ) 353 368 354 env = Environment(options = opts, CPPPATH = includes) 355 369 356 370 357 Help(opts.GenerateHelpText(env)) … … 396 383 # these libraries are optional (can be enabled/disabled, see 'scons -h') 397 384 398 if portaudioand not conf.CheckCHeader('portaudio.h'):385 if str(env['portaudio']) == "1" and not conf.CheckCHeader('portaudio.h'): 399 386 print "portaudio must be installed!" 400 387 Exit(1) 401 388 402 if portmidiand not conf.CheckCHeader('portmidi.h'):389 if str(env['portmidi']) == "1" and not conf.CheckCHeader('portmidi.h'): 403 390 print "portmidi must be installed!" 404 391 Exit(1) … … 406 393 407 394 #alsa: (default: enabled) 408 if alsaand not conf.CheckCHeader('alsa/asoundlib.h'):395 if str(env['alsa']) == "1" and not conf.CheckCHeader('alsa/asoundlib.h'): 409 396 print 'alsa must be installed!' 410 397 Exit(1) 411 398 412 399 #jack: (default: enabled) 413 if jackand not conf.CheckCHeader('jack/jack.h'):400 if str(env['jack']) == "1" and not conf.CheckCHeader('jack/jack.h'): 414 401 print 'jack must be installed!' 415 402 Exit(1) 416 403 417 404 #jack_midi: (default: enabled if jack is) 418 if jack and conf.CheckCHeader('jack/midiport.h'): 419 jack_midi = 1 405 if str(env['jack']) == "1" and conf.CheckCHeader('jack/midiport.h'): 406 env['jack_midi'] = 1 407 if str(env['jack_midi']) == "1" and not conf.CheckCHeader('jack/midiport.h'): 408 print 'Your version of JACK does not have MIDI support.' 409 Exit(1) 420 410 421 411 #lash: (default: disabled) 422 if lashand not os.path.isdir("/usr/include/lash-1.0"):412 if str(env['lash']) == "1" and not os.path.isdir("/usr/include/lash-1.0"): 423 413 print 'liblash must be installed!' 424 414 Exit(1) 425 415 426 416 #libarchive: (default: disabled) 427 if libarchiveand not conf.CheckCHeader("archive.h"):417 if str(env['libarchive']) == "1" and not conf.CheckCHeader("archive.h"): 428 418 print 'libarchive must be installed!' 429 419 Exit(1) 430 420 #libtar: needed if not libarchive 431 elif not libarchiveand not conf.CheckCHeader("zlib.h"):421 elif not str(env['libarchive']) == "1" and not conf.CheckCHeader("zlib.h"): 432 422 print 'zlib devel package must be installed!' 433 423 Exit(1) 434 elif not libarchiveand not conf.CheckCHeader("libtar.h"):424 elif not str(env['libarchive']) == "1" and not conf.CheckCHeader("libtar.h"): 435 425 print 'libtar must be installed!' 436 426 Exit(1) 437 427 438 428 #lrdf: categorizing of ladspa effects 439 if lrdfand not conf.CheckCHeader('lrdf.h'):429 if str(env['lrdf']) == "1" and not conf.CheckCHeader('lrdf.h'): 440 430 print 'lrdf must be installed!' 441 431 Exit(1) 442 432 443 433 #flac: support for flac samples 444 if flacand not conf.CheckCHeader('FLAC/all.h'):434 if str(env['flac']) == "1" and not conf.CheckCHeader('FLAC/all.h'): 445 435 print 'FLAC must be installed!' 446 436 Exit(1) 447 448 437 449 438 … … 455 444 print " Platform: %s" % platform 456 445 457 if debug:446 if str(env['debug']) == "1" : 458 447 print " Debug build" 459 448 else: 460 449 print " Release build" 461 450 462 print " Prefix: " + install_prefix463 print " Destdir: " + destdir451 print " Prefix: " + env['prefix'] 452 print " Destdir: " + env['DESTDIR'] 464 453 print "=================================================================" 465 454 print "Feature Overview:\n" 466 455 467 print " lash: " + printStatus( lash ) 468 print " alsa: " + printStatus( alsa ) 469 print " jack: " + printStatus( jack ) 470 print " jack_midi: " + printStatus( jack_midi ) 471 print "libarchive: " + printStatus( libarchive ) + (' (using libtar instead)', '')[libarchive] 472 print " portaudio: " + printStatus( portaudio ) 473 print " portmidi: " + printStatus( portmidi ) 456 print " lash: " + printStatus( env["lash"] ) 457 print " oss: " + printStatus( env["oss"] ) 458 print " alsa: " + printStatus( env["alsa"] ) 459 print " jack: " + printStatus( env["jack"] ) 460 print " jack_midi: " + printStatus( env["jack_midi"] ) 461 print "libarchive: " + printStatus( env["libarchive"] ) + (' (using libtar instead)', '')[env['libarchive']] 462 print " portaudio: " + printStatus( env["portaudio"] ) 463 print " portmidi: " + printStatus( env["portmidi"] ) 474 464 475 465 print "\n=================================================================" 476 466 print "" 477 478 467 479 468 # write the config.h file … … 485 474 486 475 487 if debug: conf.write( "#define CONFIG_DEBUG\n" )488 if lash: conf.write( "#define LASH\n" )476 if str(env['debug']) == "1": conf.write( "#define CONFIG_DEBUG\n" ) 477 if str(env['lash']) == "1": conf.write( "#define LASH\n" ) 489 478 490 479 conf.write( "#ifndef QT_BEGIN_NAMESPACE\n" ) … … 495 484 conf.write( "#endif\n" ) 496 485 497 conf.write( "#define CONFIG_PREFIX \"%s\"\n" % install_prefix)498 conf.write( "#define DATA_PATH \"%s/share/hydrogen/data\"\n" % install_prefix)486 conf.write( "#define CONFIG_PREFIX \"%s\"\n" % env['prefix'] ) 487 conf.write( "#define DATA_PATH \"%s/share/hydrogen/data\"\n" % env['prefix'] ) 499 488 500 489 conf.write( "#endif\n" ) … … 511 500 version.close() 512 501 513 libhyd = get_hydrogen_lib() 514 app = get_hydrogen_gui( libhyd ) 502 libhyd = get_hydrogen_lib( opts ) 503 app = get_hydrogen_gui( libhyd , opts ) 504 505 opts.Save("scache.conf",env)