X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=wscript;h=2f7b62d2240ce337c68d1c2081db84393f9372f5;hb=871428576c6e50d1c9022b09849aaf86bdd77dbc;hp=a4ee4ab59062f8c47eef108ef3588db0493341f7;hpb=ac05f050238d4b51c7b6a042e25cee59dc34da80;p=ardour.git diff --git a/wscript b/wscript index a4ee4ab590..2f7b62d224 100644 --- a/wscript +++ b/wscript @@ -144,7 +144,7 @@ compiler_flags_dictionaries['clang'] = clang_dict; clang_darwin_dict = compiler_flags_dictionaries['clang'].copy(); clang_darwin_dict['cxx-strict'] = [ '-ansi', '-Wnon-virtual-dtor', '-Woverloaded-virtual', ] -clang_darwin_dict['full-optimization'] = [ '-O3', '-ffast-math', '-fstrength-reduce' ] +clang_darwin_dict['full-optimization'] = [ '-O3', '-ffast-math'] compiler_flags_dictionaries['clang-darwin'] = clang_darwin_dict; def fetch_git_revision (): @@ -157,7 +157,7 @@ def fetch_tarball_revision (): if not os.path.exists ('libs/ardour/revision.cc'): print ('This tarball was not created correctly - it is missing libs/ardour/revision.cc') sys.exit (1) - with open('libs/ardour/revision.cc') as f: + with open('libs/ardour/revision.cc', 'rb') as f: content = f.readlines() remove_punctuation_map = dict((ord(char), None) for char in '";') return content[1].decode('utf-8').strip().split(' ')[7].translate (remove_punctuation_map) @@ -182,12 +182,29 @@ else: MICRO = '0' V = MAJOR + '.' + MINOR + '.' + MICRO -# Ensure that these are not unicode, which -# can cause odd problems elsewhere. Note that -# in python3, encode and decode do not return -# strings, so we have to force the type. -VERSION = V.encode ('ascii', 'ignore').decode ("utf-8") -PROGRAM_VERSION = MAJOR.encode ('ascii', 'ignore').decode ("utf-8") + +def sanitize(s): + # round-trip to remove anything in the string that is not encodable in + # ASCII, yet still keep a real (utf8-encoded internally) string. + s = s.encode ('ascii', 'ignore').decode ("utf-8") + # In Python3, bytes is the class of binary content and encode() returns + # bytes to transform a string according to a text encoding; str is the + # class of normal strings (utf8-encoded internally) and decode() returns + # that type. + # Python 2 did not initially cater for encoding problems and can use str + # for both binary content and for (decoded) strings. The Unicode type was + # added to correspond to Python 3 str, and the Python 2 str type should + # only correspond to bytes. Alas, almost everything in the Python 2 + # ecosystem has been written with str in mind and doesn't handle Unicode + # objects correctly. If Python 2 is in use, s will be a Unicode object and + # to avoid strange problems later we convert back to str, but in utf-8 + # nonetheless. + if not isinstance(s, str): + s = s.encode("utf-8") + return s +VERSION = sanitize(V) +PROGRAM_VERSION = sanitize(MAJOR) +del sanitize if len (sys.argv) > 1 and sys.argv[1] == 'dist': if not 'APPNAME' in os.environ: @@ -201,12 +218,14 @@ out = 'build' children = [ # optionally external libraries - 'libs/qm-dsp', - 'libs/vamp-plugins', - 'libs/libltc', 'libs/fluidsynth', + 'libs/hidapi', + 'libs/libltc', 'libs/lua', 'libs/ptformat', + 'libs/qm-dsp', + 'libs/vamp-plugins', + 'libs/zita-resampler', # core ardour libraries 'libs/pbd', 'libs/midi++2', @@ -219,15 +238,19 @@ children = [ 'libs/gtkmm2ext', 'libs/audiographer', 'libs/canvas', + 'libs/widgets', + 'libs/waveview', 'libs/plugins/reasonablesynth.lv2', 'libs/plugins/a-comp.lv2', 'libs/plugins/a-delay.lv2', 'libs/plugins/a-eq.lv2', 'libs/plugins/a-reverb.lv2', + 'libs/plugins/a-fluidsynth.lv2', 'gtk2_ardour', 'export', 'midi_maps', 'mcp', + 'osc', 'patchfiles', 'scripts', 'headless', @@ -236,7 +259,6 @@ children = [ 'libs/fst', 'libs/vfork', 'libs/ardouralsautil', - 'cfgtool', 'tools/luadevel', ] @@ -282,6 +304,13 @@ def create_stored_revision(): print('Could not open libs/ardour/revision.cc for writing\n') sys.exit(-1) +def get_depstack_rev(depstack_root): + try: + with open(depstack_root + '/../.vers', 'r') as f: + return f.readline() + except IOError: + return '-unknown-'; + def set_compiler_flags (conf,opt): # # Compiler flags and other system-dependent stuff @@ -354,6 +383,8 @@ int main() { return 0; }''', conf.env['build_host'] = 'yosemite' elif re.search ("^15[.]", version) != None: conf.env['build_host'] = 'el_capitan' + elif re.search ("^16[.]", version) != None: + conf.env['build_host'] = 'sierra' else: conf.env['build_host'] = 'irrelevant' @@ -377,8 +408,10 @@ int main() { return 0; }''', conf.env['build_target'] = 'mavericks' elif re.search ("^14[.]", version) != None: conf.env['build_target'] = 'yosemite' - else: + elif re.search ("^15[.]", version) != None: conf.env['build_target'] = 'el_capitan' + else: + conf.env['build_target'] = 'sierra' else: match = re.search( "(?Pi[0-6]86|x86_64|powerpc|ppc|ppc64|arm|s390x?)", @@ -399,11 +432,11 @@ int main() { return 0; }''', # compiler_flags.append ('-U__STRICT_ANSI__') - if opt.use_libcpp or conf.env['build_host'] in [ 'el_capitan' ]: + if opt.use_libcpp or conf.env['build_host'] in [ 'el_capitan', 'sierra' ]: cxx_flags.append('--stdlib=libc++') linker_flags.append('--stdlib=libc++') - if conf.options.cxx11 or conf.env['build_host'] in [ 'mavericks', 'yosemite', 'el_capitan' ]: + if conf.options.cxx11 or conf.env['build_host'] in [ 'mavericks', 'yosemite', 'el_capitan', 'sierra' ]: conf.check_cxx(cxxflags=["-std=c++11"]) cxx_flags.append('-std=c++11') if platform == "darwin": @@ -411,7 +444,7 @@ int main() { return 0; }''', # from requiring a full path to requiring just the header name. cxx_flags.append('-DCARBON_FLAT_HEADERS') - if not opt.use_libcpp and not conf.env['build_host'] in [ 'el_capitan' ]: + if not opt.use_libcpp and not conf.env['build_host'] in [ 'el_capitan', 'sierra' ]: cxx_flags.append('--stdlib=libstdc++') linker_flags.append('--stdlib=libstdc++') # Prevents visibility issues in standard headers @@ -420,7 +453,7 @@ int main() { return 0; }''', cxx_flags.append('-DBOOST_NO_AUTO_PTR') - if (is_clang and platform == "darwin") or conf.env['build_host'] in ['mavericks', 'yosemite', 'el_capitan']: + if (is_clang and platform == "darwin") or conf.env['build_host'] in [ 'mavericks', 'yosemite', 'el_capitan', 'sierra' ]: # Silence warnings about the non-existing osx clang compiler flags # -compatibility_version and -current_version. These are Waf # generated and not needed with clang @@ -531,11 +564,16 @@ int main() { return 0; }''', ("-DMAC_OS_X_VERSION_MIN_REQUIRED=1070", '-mmacosx-version-min=10.7')) - elif conf.env['build_target'] in [ 'mavericks', 'yosemite', 'el_capitan' ]: + elif conf.env['build_target'] in [ 'mavericks', 'yosemite' ]: compiler_flags.extend( ("-DMAC_OS_X_VERSION_MAX_ALLOWED=1090", "-mmacosx-version-min=10.8")) + elif conf.env['build_target'] in ['el_capitan', 'sierra' ]: + compiler_flags.extend( + ("-DMAC_OS_X_VERSION_MAX_ALLOWED=1090", + "-mmacosx-version-min=10.9")) + # # save off CPU element in an env # @@ -573,7 +611,7 @@ int main() { return 0; }''', if opt.stl_debug: cxx_flags.append("-D_GLIBCXX_DEBUG") - if re.search ("freebsd", sys.platform) != None: + if re.search ("freebsd", sys.platform) != None or re.search ("openbsd", sys.platform) != None: linker_flags.append('-lexecinfo') if conf.env['DEBUG_RT_ALLOC']: @@ -704,8 +742,14 @@ def options(opt): help='Build internal libs as static libraries') opt.add_option('--use-external-libs', action='store_true', default=False, dest='use_external_libs', help='Use external/system versions of some bundled libraries') + opt.add_option('--keepflags', action='store_true', default=False, dest='keepflags', + help='Do not ignore CFLAGS/CXXFLAGS environment vars') opt.add_option('--luadoc', action='store_true', default=False, dest='luadoc', help='Compile Tool to dump LuaBindings (needs C++11)') + opt.add_option('--canvasui', action='store_true', default=False, dest='canvasui', + help='Compile libcanvas test GUI') + opt.add_option('--beatbox', action='store_true', default=False, dest='beatbox', + help='Compile beatbox test app') opt.add_option('--lv2', action='store_true', default=True, dest='lv2', help='Compile with support for LV2 (if Lilv+Suil is available)') opt.add_option('--no-lv2', action='store_false', dest='lv2', @@ -771,6 +815,10 @@ def options(opt): help='Turn on PT session import option') opt.add_option('--no-threaded-waveviews', action='store_true', default=False, dest='no_threaded_waveviews', help='Disable threaded waveview rendering') + opt.add_option( + '--qm-dsp-include', type='string', action='store', + dest='qm_dsp_include', default='/usr/include/qm-dsp', + help='directory where the header files of qm-dsp can be found') for i in children: opt.recurse(i) @@ -790,7 +838,7 @@ def configure(conf): conf.env['MSVC_TARGETS'] = ['x64'] conf.load('msvc') - if Options.options.debug: + if Options.options.debug and not Options.options.keepflags: # Nuke user CFLAGS/CXXFLAGS if debug is set (they likely contain -O3, NDEBUG, etc) conf.env['CFLAGS'] = [] conf.env['CXXFLAGS'] = [] @@ -832,8 +880,10 @@ def configure(conf): conf.env.append_value('CXXFLAGS', [prefinclude ]) conf.env.append_value('LINKFLAGS', [ preflib ]) autowaf.display_msg(conf, 'Will build against private GTK dependency stack in ' + user_gtk_root, 'yes') + conf.env['DEPSTACK_REV'] = get_depstack_rev (Options.options.depstack_root) else: autowaf.display_msg(conf, 'Will build against private GTK dependency stack', 'no') + conf.env['DEPSTACK_REV'] = '-system-' if sys.platform == 'darwin': conf.define ('NEED_INTL', 1) @@ -874,6 +924,9 @@ def configure(conf): conf.define ('HAVE_COREAUDIO', 1) conf.define ('AUDIOUNIT_SUPPORT', 1) + if not Options.options.ppc: + conf.define('MACVST_SUPPORT', 1) + conf.define ('TOP_MENUBAR',1) # It would be nice to be able to use this to force back-compatibility with 10.4 @@ -922,6 +975,14 @@ def configure(conf): print ('No Carbon support available for this build\n') + if Options.options.canvasui: + conf.env['CANVASTESTUI'] = True + conf.define ('CANVASTESTUI', 1) + + if Options.options.beatbox: + conf.env['BEATBOX'] = True + conf.define ('BEATBOX', 1) + if Options.options.luadoc: conf.env['LUABINDINGDOC'] = True conf.define ('LUABINDINGDOC', 1) @@ -931,6 +992,8 @@ def configure(conf): if Options.options.use_external_libs: conf.define('USE_EXTERNAL_LIBS', 1) + conf.env.append_value( + 'CXXFLAGS', '-I' + Options.options.qm_dsp_include) if Options.options.boost_include != '': conf.env.append_value('CXXFLAGS', '-I' + Options.options.boost_include) @@ -947,7 +1010,7 @@ def configure(conf): # executing a test program is n/a when cross-compiling if Options.options.dist_target != 'mingw': - if Options.options.dist_target != 'msvc': + if Options.options.dist_target != 'msvc' and re.search ("openbsd", sys.platform) == None: if re.search ("freebsd", sys.platform) != None: conf.check_cc(function_name='dlopen', header_name='dlfcn.h', uselib_store='DL') else: @@ -962,12 +1025,16 @@ def configure(conf): if re.search ("linux", sys.platform) != None and Options.options.dist_target != 'mingw': autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA') + if re.search ("openbsd", sys.platform) != None: + conf.env.append_value('LDFLAGS', '-L/usr/X11R6/lib') + autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.28', mandatory=True) autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', atleast_version='2.2', mandatory=True) autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.32.0', mandatory=True) autowaf.check_pkg(conf, 'sndfile', uselib_store='SNDFILE', atleast_version='1.0.18', mandatory=True) autowaf.check_pkg(conf, 'giomm-2.4', uselib_store='GIOMM', atleast_version='2.2', mandatory=True) autowaf.check_pkg(conf, 'libcurl', uselib_store='CURL', atleast_version='7.0.0', mandatory=True) + autowaf.check_pkg(conf, 'libarchive', uselib_store='ARCHIVE', atleast_version='3.0.0', mandatory=True) autowaf.check_pkg(conf, 'liblo', uselib_store='LO', atleast_version='0.26', mandatory=True) autowaf.check_pkg(conf, 'taglib', uselib_store='TAGLIB', atleast_version='1.6', mandatory=True) autowaf.check_pkg(conf, 'vamp-sdk', uselib_store='VAMPSDK', atleast_version='2.1', mandatory=True) @@ -996,6 +1063,11 @@ int main () { int x = SFC_RF64_AUTO_DOWNGRADE; return 0; } conf.env.append_value('CFLAGS', '-DCOMPILER_MINGW') conf.env.append_value('CXXFLAGS', '-DPLATFORM_WINDOWS') conf.env.append_value('CXXFLAGS', '-DCOMPILER_MINGW') + if conf.options.cxx11: + conf.env.append_value('CFLAGS', '-D_USE_MATH_DEFINES') + conf.env.append_value('CXXFLAGS', '-D_USE_MATH_DEFINES') + conf.env.append_value('CFLAGS', '-DWIN32') + conf.env.append_value('CXXFLAGS', '-DWIN32') conf.env.append_value('LIB', 'pthread') # needed for at least libsmf conf.check_cc(function_name='htonl', header_name='winsock2.h', lib='ws2_32') @@ -1117,8 +1189,10 @@ int main () { return 0; } if opts.no_threaded_waveviews: conf.define('NO_THREADED_WAVEVIEWS', 1) conf.env['NO_THREADED_WAVEVIEWS'] = True - + backends = opts.with_backends.split(',') + if opts.build_tests and 'dummy' not in backends: + backends += ['dummy'] if not backends: print("Must configure and build at least one backend") @@ -1147,6 +1221,8 @@ int main () { return 0; } if sys.platform == 'darwin': sub_config_and_use(conf, 'libs/appleutility') + elif re.search ("openbsd", sys.platform) != None: + pass elif Options.options.dist_target != 'mingw': sub_config_and_use(conf, 'tools/sanity_check') sub_config_and_use(conf, 'tools/gccabicheck') @@ -1179,18 +1255,19 @@ const char* const ardour_config_info = "\\n\\ write_config_text('Internal Shared Libraries', conf.is_defined('INTERNAL_SHARED_LIBS')) write_config_text('Use External Libraries', conf.is_defined('USE_EXTERNAL_LIBS')) write_config_text('Library exports hidden', conf.is_defined('EXPORT_VISIBILITY_HIDDEN')) - + write_config_text('Free/Demo copy', conf.is_defined('FREEBIE')) + config_text.write("\\n\\\n") write_config_text('ALSA DBus Reservation', conf.is_defined('HAVE_DBUS')) write_config_text('Architecture flags', opts.arch) write_config_text('Aubio', conf.is_defined('HAVE_AUBIO')) write_config_text('AudioUnits', conf.is_defined('AUDIOUNIT_SUPPORT')) - write_config_text('Free/Demo copy', conf.is_defined('FREEBIE')) write_config_text('Build target', conf.env['build_target']) + write_config_text('Canvas Test UI', conf.is_defined('CANVASTESTUI')) + write_config_text('Beatbox test app', conf.is_defined('BEATBOX')) write_config_text('CoreAudio', conf.is_defined('HAVE_COREAUDIO')) write_config_text('CoreAudio 10.5 compat', conf.is_defined('COREAUDIO105')) write_config_text('Debug RT allocations', conf.is_defined('DEBUG_RT_ALLOC')) write_config_text('Debug Symbols', conf.is_defined('debug_symbols') or conf.env['DEBUG']) - write_config_text('Process thread timing', conf.is_defined('PT_TIMING')) write_config_text('Denormal exceptions', conf.is_defined('DEBUG_DENORMAL_EXCEPTION')) write_config_text('FLAC', conf.is_defined('HAVE_FLAC')) write_config_text('FPU optimization', opts.fpu_optimization) @@ -1202,28 +1279,33 @@ const char* const ardour_config_info = "\\n\\ write_config_text('LV2 support', conf.is_defined('LV2_SUPPORT')) write_config_text('LV2 extensions', conf.is_defined('LV2_EXTENDED')) write_config_text('LXVST support', conf.is_defined('LXVST_SUPPORT')) + write_config_text('Mac VST support', conf.is_defined('MACVST_SUPPORT')) write_config_text('OGG', conf.is_defined('HAVE_OGG')) write_config_text('Phone home', conf.is_defined('PHONE_HOME')) + write_config_text('Process thread timing', conf.is_defined('PT_TIMING')) write_config_text('Program name', opts.program_name) write_config_text('Samplerate', conf.is_defined('HAVE_SAMPLERATE')) write_config_text('PT format', conf.is_defined('PTFORMAT')) write_config_text('PTW32 Semaphore', conf.is_defined('USE_PTW32_SEMAPHORE')) # write_config_text('Soundtouch', conf.is_defined('HAVE_SOUNDTOUCH')) + write_config_text('Threaded WaveViews', not opts.no_threaded_waveviews) write_config_text('Translation', opts.nls) # write_config_text('Tranzport', opts.tranzport) write_config_text('Unit tests', conf.env['BUILD_TESTS']) - write_config_text('Mac i386 Architecture', opts.generic) - write_config_text('Mac ppc Architecture', opts.ppc) write_config_text('Windows VST support', opts.windows_vst) write_config_text('Wiimote support', conf.is_defined('BUILD_WIIMOTE')) write_config_text('Windows key', opts.windows_key) - + config_text.write("\\n\\\n") write_config_text('PortAudio Backend', conf.env['BUILD_PABACKEND']) write_config_text('CoreAudio/Midi Backend',conf.env['BUILD_CORECRAPPITA']) write_config_text('ALSA Backend', conf.env['BUILD_ALSABACKEND']) write_config_text('Dummy backend', conf.env['BUILD_DUMMYBACKEND']) write_config_text('JACK Backend', conf.env['BUILD_JACKBACKEND']) - + config_text.write("\\n\\\n") + write_config_text('Builstack', conf.env['DEPSTACK_REV']) + write_config_text('Mac i386 Architecture', opts.generic) + write_config_text('Mac ppc Architecture', opts.ppc) + config_text.write("\\n\\\n") write_config_text('C compiler flags', conf.env['CFLAGS']) write_config_text('C++ compiler flags', conf.env['CXXFLAGS']) write_config_text('Linker flags', conf.env['LINKFLAGS']) @@ -1233,7 +1315,7 @@ const char* const ardour_config_info = "\\n\\ print('') if Options.options.dist_target == 'mingw' or Options.options.dist_target == 'msvc': - create_resource_file(Options.options.program_name.lower()) + create_resource_file(Options.options.program_name) def build(bld): create_stored_revision() @@ -1271,6 +1353,8 @@ def build(bld): if sys.platform == 'darwin': bld.recurse('libs/appleutility') + elif re.search ("openbsd", sys.platform) != None: + pass elif bld.env['build_target'] != 'mingw': bld.recurse('tools/sanity_check') bld.recurse('tools/gccabicheck') @@ -1280,8 +1364,13 @@ def build(bld): for i in children: bld.recurse(i) + if bld.is_defined ('BEATBOX'): + bld.recurse('tools/bb') + bld.install_files (bld.env['CONFDIR'], 'system_config') + bld.install_files (os.path.join (bld.env['DATADIR'], 'templates'), bld.path.ant_glob ('templates/**'), cwd=bld.path.find_dir ('templates'), relative_trick=True) + if bld.env['RUN_TESTS']: bld.add_post_fun(test) @@ -1303,3 +1392,7 @@ def tarball(bld): def test(bld): subprocess.call("gtk2_ardour/artest") + +def help2man(bld): + cmd = "help2man -s 1 -N -o ardour.1 -n Ardour --version-string='Ardour %s' gtk2_ardour/ardev" % PROGRAM_VERSION + subprocess.call(cmd, shell=True)