Show
Ignore:
Timestamp:
02/21/09 00:06:01 (4 years ago)
Author:
gabriel@…
Message:

Merge rev 594:682 from trunk

Conflicts:

Sconstruct

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/jackMidi/Sconstruct

    r538 r826  
    1313 
    1414def printStatus( value ): 
    15     if value: 
     15    if str(value) == "1": 
    1616        return "enabled" 
    1717    else: 
     
    4141 
    4242 
    43 def get_platform_flags(): 
     43def get_platform_flags( opts ): 
    4444        includes = [] 
    4545        cppflags = [] 
    4646        ldflags = [] 
    4747 
     48        env = Environment( options = opts ) 
     49 
    4850        if sys.platform == "linux2" or sys.platform == "darwin": 
    49                 if debug: 
     51                if str(env['debug']) == "1": 
    5052                        cppflags += ['-Wall',  '-g2', '-ggdb', '-O0'] 
    5153                else: 
     
    5355                        #cppflags += " %s" % get_optimized_flags( target_cpu ) 
    5456 
    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') 
    6164 
    6265 
    6366                cppflags.append('-DFLAC_SUPPORT') 
    6467                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') 
    7173 
    7274        includes.append( './' ) 
     
    131133                        Execute( "cd 3rdparty; tar xzf libsndfile.tar.gz" ) 
    132134                        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" ) 
    134136                        if res != 0: 
    135137                                raise Exception( "Error compiling 3rdparty libraries" ) 
     
    150152 
    151153 
    152 def get_hydrogen_lib(): 
    153         includes, cppflags, ldflags = get_platform_flags() 
     154def get_hydrogen_lib( opts ): 
     155        includes, cppflags, ldflags = get_platform_flags( opts ) 
    154156 
    155157        includes.append( "libs/hydrogen/include" ) 
     
    159161        qt4ToolLocation="." 
    160162 
    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 ) 
    162164        env.EnableQt4Modules( ['QtCore', 'QtGui'], debug=False) 
    163165        env.CacheDir( "scons_cache" ) 
    164166         
    165         if jack: 
     167        if str(env['jack']) == "1": 
    166168            env.ParseConfig('pkg-config --modversion jack', get_jack_api_flags) 
    167169 
     
    173175 
    174176 
    175         if jack: 
     177        if str(env['jack']) == "1": 
    176178            env.ParseConfig('pkg-config --modversion jack', get_jack_midi_api_version)     
    177179 
     
    183185 
    184186 
    185 def get_hydrogen_gui( lib_hydrogen ): 
    186         includes, cppflags, ldflags = get_platform_flags() 
     187def get_hydrogen_gui( lib_hydrogen , opts ): 
     188        includes, cppflags, ldflags = get_platform_flags( opts ) 
    187189 
    188190        includes.append( "libs/hydrogen/include" ) 
     
    193195        qt4ToolLocation="." 
    194196 
    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         
    204199        env.EnableQt4Modules( ['QtCore', 'QtGui','QtNetwork','QtXml'], debug=False) 
    205200        # 
     
    228223        env.Append( LIBS = ["sndfile"] ) 
    229224         
    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": 
    234229            env.Append( LIBS = ["jack"]) 
    235230            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"]) 
    238233        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": 
    241236                env.Append( LIBS = [ "portmidi" ] ) 
    242237                env.Append( LIBS = [ "porttime" ] ) 
     
    249244        env.Default('programs') 
    250245 
    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 
    261259 
    262260        return app 
     
    274272    xenv.MergeFlags(rv) 
    275273 
    276 opts = Options() 
     274opts = Options('scache.conf') 
    277275 
    278276#platform independent settings 
     
    280278opts.Add('libarchive', 'Set to 1 to enable libarchive instead of libtar', 0) 
    281279opts.Add('prefix','Default: /usr/local',"/usr/local") 
    282 opts.Add('destdir','Default: none',"") 
     280opts.Add('DESTDIR','Default: none',"") 
    283281 
    284282#platform dependent settings 
    285283if sys.platform != "win32": 
     284        opts.Add('oss', 'Set to 1 to enable oss',1) 
     285 
    286286        opts.Add('portmidi', 'Set to 1 to enable portmidi',0) 
    287         portmidi = int(ARGUMENTS.get('portmidi',0)) 
    288287         
    289288        opts.Add('portaudio', 'Set to 1 to enable portaudio',0) 
    290         portaudio = int(ARGUMENTS.get('portaudio',0)) 
    291289         
    292290        opts.Add('lash', 'Set to 1 to enable lash',0) 
    293         lash = int(ARGUMENTS.get('lash',0)) 
    294291         
    295292         
    296293        opts.Add('alsa', 'Set to 1 to enable alsa',1) 
    297         alsa = int(ARGUMENTS.get('alsa',1)) 
    298294         
    299295 
    300296        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)  
    302300         
    303301 
    304302        opts.Add('lrdf', 'Set to 1 to enable lrdf',1) 
    305         lrdf = int(ARGUMENTS.get('lrdf',1)) 
    306303         
    307304 
    308305        opts.Add('flac', 'Set to 1 to enable flac',1) 
    309         flac = int(ARGUMENTS.get('flac',1)) 
    310  
    311306else: 
    312         #alsa, lash and jack are not available on windows 
     307        #alsa, lash,oss and jack are not available on windows 
    313308        opts.Add('portmidi', 'Set to 1 to enable portmidi',1) 
    314309         
    315310        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 
    318314        opts.Add('lash', 'Set to 1 to enable lash',0) 
    319         lash = int(ARGUMENTS.get('lash',0)) 
    320          
    321  
     315         
    322316        opts.Add('alsa', 'Set to 1 to enable alsa',0) 
    323         alsa = int(ARGUMENTS.get('alsa',0)) 
    324          
    325  
     317         
    326318        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)  
    328321         
    329322        opts.Add('lrdf', 'Set to 1 to enable lrdf',0) 
    330         lrdf = int(ARGUMENTS.get('lrdf',0)) 
    331323         
    332324        opts.Add('flac', 'Set to 1 to enable flac',0) 
    333         flac = int(ARGUMENTS.get('flac',0)) 
    334325 
    335326# JACK MIDI version detection. 
    336327def get_jack_midi_api_version(xenv, pkg_ver): 
    337     global jack_midi 
    338328    rv = "" 
    339329    (major, minor, patch) = pkg_ver.rstrip().split('.') 
     
    346336        return rv 
    347337    rv = "-DJACK_MIDI_SUPPORT" 
    348     jack_midi = 1 
     338    xenv['jack_midi'] = 1 
    349339    if (minor == 102) and (patch <= 26): 
    350340        rv += " -DJACK_MIDI_0_102_0" 
     
    357347    xenv.MergeFlags(rv) 
    358348 
    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  
    365349 
    366350#get includes ( important if you compile on non-standard envorionments) 
    367 includes, a , b = get_platform_flags() 
     351 
     352includes, a , b = get_platform_flags( opts ) 
     353 
    368354env = Environment(options = opts, CPPPATH = includes) 
     355 
    369356 
    370357Help(opts.GenerateHelpText(env)) 
     
    396383# these libraries are optional (can be enabled/disabled, see 'scons -h') 
    397384 
    398 if portaudio and not conf.CheckCHeader('portaudio.h'): 
     385if str(env['portaudio']) == "1" and not conf.CheckCHeader('portaudio.h'): 
    399386    print "portaudio must be installed!" 
    400387    Exit(1) 
    401388 
    402 if portmidi and not conf.CheckCHeader('portmidi.h'): 
     389if str(env['portmidi']) == "1" and not conf.CheckCHeader('portmidi.h'): 
    403390    print "portmidi must be installed!" 
    404391    Exit(1) 
     
    406393 
    407394#alsa: (default: enabled) 
    408 if alsa and not conf.CheckCHeader('alsa/asoundlib.h'): 
     395if str(env['alsa']) == "1" and not conf.CheckCHeader('alsa/asoundlib.h'): 
    409396    print 'alsa must be installed!' 
    410397    Exit(1) 
    411398 
    412399#jack: (default: enabled) 
    413 if jack and not conf.CheckCHeader('jack/jack.h'): 
     400if str(env['jack']) == "1" and not conf.CheckCHeader('jack/jack.h'): 
    414401    print 'jack must be installed!' 
    415402    Exit(1) 
    416403 
    417404#jack_midi: (default: enabled if jack is) 
    418 if jack and conf.CheckCHeader('jack/midiport.h'): 
    419     jack_midi = 1 
     405if str(env['jack']) == "1" and conf.CheckCHeader('jack/midiport.h'): 
     406    env['jack_midi'] = 1 
     407if 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) 
    420410 
    421411#lash: (default: disabled) 
    422 if lash and not os.path.isdir("/usr/include/lash-1.0"): 
     412if str(env['lash']) == "1" and not os.path.isdir("/usr/include/lash-1.0"): 
    423413    print 'liblash must be installed!' 
    424414    Exit(1) 
    425415 
    426416#libarchive: (default: disabled) 
    427 if libarchive and not conf.CheckCHeader("archive.h"): 
     417if str(env['libarchive']) == "1" and not conf.CheckCHeader("archive.h"): 
    428418    print 'libarchive must be installed!' 
    429419    Exit(1) 
    430420#libtar: needed if not libarchive 
    431 elif not libarchive and not conf.CheckCHeader("zlib.h"): 
     421elif not str(env['libarchive']) == "1" and not conf.CheckCHeader("zlib.h"): 
    432422    print 'zlib devel package must be installed!' 
    433423    Exit(1) 
    434 elif not libarchive and not conf.CheckCHeader("libtar.h"): 
     424elif not str(env['libarchive']) == "1" and not conf.CheckCHeader("libtar.h"): 
    435425    print 'libtar must be installed!' 
    436426    Exit(1) 
    437427 
    438428#lrdf: categorizing of ladspa effects 
    439 if lrdf and not conf.CheckCHeader('lrdf.h'): 
     429if str(env['lrdf']) == "1" and not conf.CheckCHeader('lrdf.h'): 
    440430    print 'lrdf must be installed!' 
    441431    Exit(1) 
    442432 
    443433#flac: support for flac samples 
    444 if flac and not conf.CheckCHeader('FLAC/all.h'): 
     434if str(env['flac']) == "1" and not conf.CheckCHeader('FLAC/all.h'): 
    445435    print 'FLAC must be installed!' 
    446436    Exit(1) 
    447  
    448437 
    449438 
     
    455444print " Platform: %s" % platform 
    456445 
    457 if debug: 
     446if str(env['debug']) == "1" : 
    458447        print " Debug build" 
    459448else: 
    460449        print " Release build" 
    461450 
    462 print " Prefix: " + install_prefix 
    463 print " Destdir: " + destdir 
     451print " Prefix: " + env['prefix'] 
     452print " Destdir: " + env['DESTDIR'] 
    464453print "=================================================================" 
    465454print "Feature Overview:\n" 
    466455 
    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 )  
     456print "      lash: " + printStatus( env["lash"] ) 
     457print "      oss: " + printStatus( env["oss"] ) 
     458print "      alsa: " + printStatus( env["alsa"] ) 
     459print "      jack: " + printStatus( env["jack"] ) 
     460print " jack_midi: " + printStatus( env["jack_midi"] ) 
     461print "libarchive: " + printStatus( env["libarchive"] ) + (' (using libtar instead)', '')[env['libarchive']] 
     462print " portaudio: " + printStatus( env["portaudio"] ) 
     463print "  portmidi: " + printStatus( env["portmidi"] )  
    474464 
    475465print "\n=================================================================" 
    476466print "" 
    477  
    478467 
    479468# write the config.h file 
     
    485474 
    486475 
    487 if debug: conf.write( "#define CONFIG_DEBUG\n" ) 
    488 if lash: conf.write( "#define LASH\n" ) 
     476if str(env['debug']) == "1": conf.write( "#define CONFIG_DEBUG\n" ) 
     477if str(env['lash']) == "1": conf.write( "#define LASH\n" ) 
    489478 
    490479conf.write( "#ifndef QT_BEGIN_NAMESPACE\n" ) 
     
    495484conf.write( "#endif\n" ) 
    496485 
    497 conf.write( "#define CONFIG_PREFIX \"%s\"\n" % install_prefix ) 
    498 conf.write( "#define DATA_PATH \"%s/share/hydrogen/data\"\n" % install_prefix ) 
     486conf.write( "#define CONFIG_PREFIX \"%s\"\n" % env['prefix'] ) 
     487conf.write( "#define DATA_PATH \"%s/share/hydrogen/data\"\n" % env['prefix'] ) 
    499488 
    500489conf.write( "#endif\n" ) 
     
    511500version.close() 
    512501 
    513 libhyd = get_hydrogen_lib() 
    514 app = get_hydrogen_gui( libhyd ) 
     502libhyd = get_hydrogen_lib( opts ) 
     503app = get_hydrogen_gui( libhyd , opts ) 
     504 
     505opts.Save("scache.conf",env)