13
0

add --generic flag to wscript to trigger -mtune=generic builds; stop using old GNU config.guess script and use python's builtin os.uname() values

git-svn-id: svn://localhost/ardour2/branches/3.0@12290 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-05-15 12:55:23 +00:00
parent 966efcc476
commit 4476ecec6b

87
wscript
View File

@ -122,52 +122,51 @@ def set_compiler_flags (conf,opt):
optimization_flags = [] optimization_flags = []
debug_flags = [] debug_flags = []
# guess at the platform, used to define compiler flags u = os.uname ()
cpu = u[4]
config_guess = os.popen("tools/config.guess").read()[:-1] platform = u[0].lower()
version = u[2]
config_cpu = 0
config_arch = 1
config_kernel = 2
config_os = 3
config = config_guess.split ("-")
if opt.gprofile: if opt.gprofile:
debug_flags = [ '-pg' ] debug_flags = [ '-pg' ]
else: else:
if config[config_arch] != 'apple': if platform != 'darwin':
debug_flags = [ '-rdynamic' ] # waf adds -O0 -g itself. thanks waf! debug_flags = [ '-rdynamic' ] # waf adds -O0 -g itself. thanks waf!
# Autodetect # Autodetect
if opt.dist_target == 'auto': if opt.dist_target == 'auto':
if config[config_arch] == 'apple': if platform == 'darwin':
# The [.] matches to the dot after the major version, "." would match any character # The [.] matches to the dot after the major version, "." would match any character
if re.search ("darwin[0-7][.]", config[config_kernel]) != None: if re.search ("^[0-7][.]", version) != None:
conf.env['build_target'] = 'panther' conf.env['build_target'] = 'panther'
elif re.search ("darwin8[.]", config[config_kernel]) != None: elif re.search ("^8[.]", version) != None:
conf.env['build_target'] = 'tiger' conf.env['build_target'] = 'tiger'
else: elif re.search ("^9[.]", version) != None:
conf.env['build_target'] = 'leopard' conf.env['build_target'] = 'leopard'
elif re.search ("^10[.]", version) != None:
conf.env['build_target'] = 'snowleopard'
else:
conf.env['build_target'] = 'lion'
else: else:
if re.search ("x86_64", config[config_cpu]) != None: if re.search ("x86_64", cpu) != None:
conf.env['build_target'] = 'x86_64' conf.env['build_target'] = 'x86_64'
elif re.search("i[0-5]86", config[config_cpu]) != None: elif re.search("i[0-5]86", cpu) != None:
conf.env['build_target'] = 'i386' conf.env['build_target'] = 'i386'
elif re.search("powerpc", config[config_cpu]) != None: elif re.search("powerpc", config_cpu) != None:
conf.env['build_target'] = 'powerpc' conf.env['build_target'] = 'powerpc'
else: else:
conf.env['build_target'] = 'i686' conf.env['build_target'] = 'i686'
else: else:
conf.env['build_target'] = opt.dist_target conf.env['build_target'] = opt.dist_target
if config[config_cpu] == 'powerpc' and conf.env['build_target'] != 'none': if cpu == 'powerpc' and conf.env['build_target'] != 'none':
# #
# Apple/PowerPC optimization options # Apple/PowerPC optimization options
# #
# -mcpu=7450 does not reliably work with gcc 3.* # -mcpu=7450 does not reliably work with gcc 3.*
# #
if opt.dist_target == 'panther' or opt.dist_target == 'tiger': if opt.dist_target == 'panther' or opt.dist_target == 'tiger':
if config[config_arch] == 'apple': if platform == 'darwin':
# optimization_flags.extend ([ "-mcpu=7450", "-faltivec"]) # optimization_flags.extend ([ "-mcpu=7450", "-faltivec"])
# to support g3s but still have some optimization for above # to support g3s but still have some optimization for above
optimization_flags.extend ([ "-mcpu=G3", "-mtune=7450"]) optimization_flags.extend ([ "-mcpu=G3", "-mtune=7450"])
@ -178,7 +177,7 @@ def set_compiler_flags (conf,opt):
optimization_flags.extend (["-mhard-float", "-mpowerpc-gfxopt"]) optimization_flags.extend (["-mhard-float", "-mpowerpc-gfxopt"])
optimization_flags.extend (["-Os"]) optimization_flags.extend (["-Os"])
elif ((re.search ("i[0-9]86", config[config_cpu]) != None) or (re.search ("x86_64", config[config_cpu]) != None)) and conf.env['build_target'] != 'none': elif ((re.search ("i[0-9]86", cpu) != None) or (re.search ("x86_64", cpu) != None)) and conf.env['build_target'] != 'none':
# #
@ -187,11 +186,11 @@ def set_compiler_flags (conf,opt):
# distingush 32 and 64 bit assembler # distingush 32 and 64 bit assembler
# #
if (re.search ("(i[0-9]86|x86_64)", config[config_cpu]) != None): if (re.search ("(i[0-9]86|x86_64)", cpu) != None):
debug_flags.append ("-DARCH_X86") debug_flags.append ("-DARCH_X86")
optimization_flags.append ("-DARCH_X86") optimization_flags.append ("-DARCH_X86")
if config[config_kernel] == 'linux' : if platform == 'linux' :
# #
# determine processor flags via /proc/cpuinfo # determine processor flags via /proc/cpuinfo
@ -209,9 +208,9 @@ def set_compiler_flags (conf,opt):
if "3dnow" in x86_flags: if "3dnow" in x86_flags:
optimization_flags.append ("-m3dnow") optimization_flags.append ("-m3dnow")
if config[config_cpu] == "i586": if cpu == "i586":
optimization_flags.append ("-march=i586") optimization_flags.append ("-march=i586")
elif config[config_cpu] == "i686": elif cpu == "i686":
optimization_flags.append ("-march=i686") optimization_flags.append ("-march=i686")
if ((conf.env['build_target'] == 'i686') or (conf.env['build_target'] == 'x86_64')) and build_host_supports_sse: if ((conf.env['build_target'] == 'i686') or (conf.env['build_target'] == 'x86_64')) and build_host_supports_sse:
@ -222,7 +221,7 @@ def set_compiler_flags (conf,opt):
# optimization section # optimization section
if conf.env['FPU_OPTIMIZATION']: if conf.env['FPU_OPTIMIZATION']:
if conf.env['build_target'] == 'tiger' or conf.env['build_target'] == 'leopard': if sys.platform == 'darwin':
optimization_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS"); optimization_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS");
debug_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS"); debug_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS");
conf.env.append_value('LINKFLAGS', "-framework Accelerate") conf.env.append_value('LINKFLAGS', "-framework Accelerate")
@ -270,9 +269,9 @@ def set_compiler_flags (conf,opt):
conf.define ('IS_OSX', 0) conf.define ('IS_OSX', 0)
# #
# save off guessed arch element in an env # save off CPU element in an env
# #
conf.define ('CONFIG_ARCH', config[config_arch]) conf.define ('CONFIG_ARCH', cpu)
# #
# ARCH="..." overrides all # ARCH="..." overrides all
@ -315,14 +314,23 @@ def set_compiler_flags (conf,opt):
conf.env.append_value('CXXFLAGS', '-DDEBUG_DENORMAL_EXCEPTION') conf.env.append_value('CXXFLAGS', '-DDEBUG_DENORMAL_EXCEPTION')
if opt.universal: if opt.universal:
if not Options.options.nocarbon: if opt.generic:
conf.env.append_value('CFLAGS', ["-arch", "i386", "-arch", "ppc"]) print ('Specifying Universal and Generic builds at the same time is not supported')
conf.env.append_value('CXXFLAGS', ["-arch", "i386", "-arch", "ppc"]) sys.exit (1)
conf.env.append_value('LINKFLAGS', ["-arch", "i386", "-arch", "ppc"])
else: else:
conf.env.append_value('CFLAGS', ["-arch", "x86_64", "-arch", "i386", "-arch", "ppc"]) if not Options.options.nocarbon:
conf.env.append_value('CXXFLAGS', ["-arch", "x86_64", "-arch", "i386", "-arch", "ppc"]) conf.env.append_value('CFLAGS', ["-arch", "i386", "-arch", "ppc"])
conf.env.append_value('LINKFLAGS', ["-arch", "x86_64", "-arch", "i386", "-arch", "ppc"]) conf.env.append_value('CXXFLAGS', ["-arch", "i386", "-arch", "ppc"])
conf.env.append_value('LINKFLAGS', ["-arch", "i386", "-arch", "ppc"])
else:
conf.env.append_value('CFLAGS', ["-arch", "x86_64", "-arch", "i386", "-arch", "ppc"])
conf.env.append_value('CXXFLAGS', ["-arch", "x86_64", "-arch", "i386", "-arch", "ppc"])
conf.env.append_value('LINKFLAGS', ["-arch", "x86_64", "-arch", "i386", "-arch", "ppc"])
else:
if opt.generic:
conf.env.append_value('CFLAGS', ['-mtune=generic'])
conf.env.append_value('CXXFLAGS', ['-mtune=generic'])
conf.env.append_value('LINKFLAGS', ['-mtune=generic'])
# #
# warnings flags # warnings flags
@ -401,6 +409,8 @@ def options(opt):
help='Compile with support for Frontier Designs Tranzport (if libusb is available)') help='Compile with support for Frontier Designs Tranzport (if libusb is available)')
opt.add_option('--universal', action='store_true', default=False, dest='universal', opt.add_option('--universal', action='store_true', default=False, dest='universal',
help='Compile as universal binary (OS X ONLY, requires that external libraries are universal)') help='Compile as universal binary (OS X ONLY, requires that external libraries are universal)')
opt.add_option('--generic', action='store_true', default=False, dest='generic',
help='Compile with -march=generic')
opt.add_option('--versioned', action='store_true', default=False, dest='versioned', opt.add_option('--versioned', action='store_true', default=False, dest='versioned',
help='Add revision information to executable name inside the build directory') help='Add revision information to executable name inside the build directory')
opt.add_option('--windows-vst', action='store_true', default=False, dest='windows_vst', opt.add_option('--windows-vst', action='store_true', default=False, dest='windows_vst',
@ -466,8 +476,7 @@ def configure(conf):
conf.define ('HAVE_COREAUDIO', 1) conf.define ('HAVE_COREAUDIO', 1)
conf.define ('AUDIOUNIT_SUPPORT', 1) conf.define ('AUDIOUNIT_SUPPORT', 1)
if not Options.options.nocarbon:
conf.define ('WITH_CARBON', 1)
if not Options.options.freebie: if not Options.options.freebie:
conf.define ('AU_STATE_SUPPORT', 1) conf.define ('AU_STATE_SUPPORT', 1)
@ -522,9 +531,12 @@ def configure(conf):
if not Options.options.freebie: if not Options.options.freebie:
conf.env.append_value('CXXFLAGS_AUDIOUNITS', "-DAU_STATE_SUPPORT") conf.env.append_value('CXXFLAGS_AUDIOUNITS', "-DAU_STATE_SUPPORT")
if not Options.options.nocarbon:
if re.search ("^[1-9][0-9]\.", os.uname()[2]) == None and not Options.options.nocarbon:
conf.env.append_value('CXXFLAGS_AUDIOUNITS', "-DWITH_CARBON") conf.env.append_value('CXXFLAGS_AUDIOUNITS', "-DWITH_CARBON")
conf.env.append_value('LINKFLAGS_AUDIOUNITS', ['-framework', 'Carbon']) conf.env.append_value('LINKFLAGS_AUDIOUNITS', ['-framework', 'Carbon'])
else:
print ('No Carbon support available for this build\n')
if Options.options.boost_include != '': if Options.options.boost_include != '':
conf.env.append_value('CXXFLAGS', '-I' + Options.options.boost_include) conf.env.append_value('CXXFLAGS', '-I' + Options.options.boost_include)
@ -661,6 +673,7 @@ const char* const ardour_config_info = "\\n\\
write_config_text('Tranzport', opts.tranzport) write_config_text('Tranzport', opts.tranzport)
write_config_text('Unit tests', conf.env['BUILD_TESTS']) write_config_text('Unit tests', conf.env['BUILD_TESTS'])
write_config_text('Universal binary', opts.universal) write_config_text('Universal binary', opts.universal)
write_config_text('Generic x86 CPU', opts.generic)
write_config_text('Windows VST support', opts.windows_vst) write_config_text('Windows VST support', opts.windows_vst)
write_config_text('Wiimote support', opts.wiimote) write_config_text('Wiimote support', opts.wiimote)
write_config_text('Windows key', opts.windows_key) write_config_text('Windows key', opts.windows_key)