From da390836bf074f8abe125cc1e62d0e7e1d484492 Mon Sep 17 00:00:00 2001 From: Nedko Arnaudov Date: Thu, 14 Nov 2013 04:25:56 +0200 Subject: [PATCH] wscript: fix build in 32/64 bits mixed mode. github close #39 --- common/wscript | 133 ++++++++++++++++++++++++++++++--------------------------- wscript | 53 +++++++++++++++++------ 2 files changed, 110 insertions(+), 76 deletions(-) diff --git a/common/wscript b/common/wscript index 28782ce0..cc2ab567 100644 --- a/common/wscript +++ b/common/wscript @@ -74,7 +74,11 @@ def build(bld): 'JackEngineProfiling.cpp', ] - includes = ['.', './jack', '..'] + includes = ['.', './jack'] + if not bld.variant: + includes.append('..') + else: + includes.append('../..') uselib = ["PTHREAD", "CELT", "OPUS"] if bld.env['IS_LINUX']: @@ -133,6 +137,70 @@ def build(bld): uselib.append('PSAPI') uselib.append('WINMM') + clientlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib']) + clientlib.defines = 'HAVE_CONFIG_H' + clientlib.use = uselib + if bld.env['IS_WINDOWS']: + clientlib.install_path = '${BINDIR}' + else: + clientlib.install_path = '${LIBDIR}' + if bld.env['AUTOSTART_METHOD'] == "dbus": + clientlib.use.append('DBUS-1') + clientlib.includes = includes + clientlib.name = 'clientlib' + clientlib.target = 'jack' + clientlib.source = [] + common_libsources + clientlib.source += [ + 'JackLibClient.cpp', + 'JackLibAPI.cpp', + ] + + if bld.env['IS_LINUX']: + clientlib.source += [ + '../posix/JackSocketClientChannel.cpp', + '../posix/JackPosixServerLaunch.cpp', + ] + + if bld.env['IS_SUN']: + clientlib.source += [ + '../posix/JackSocketClientChannel.cpp', + '../posix/JackPosixServerLaunch.cpp', + ] + + if bld.env['IS_MACOSX']: + clientlib.source += [ + '../posix/JackSocketClientChannel.cpp', + '../posix/JackPosixServerLaunch.cpp', + ] + + if bld.env['IS_WINDOWS']: + clientlib.source += [ + '../windows/JackWinNamedPipe.cpp', + '../windows/JackWinNamedPipeClientChannel.cpp', + '../windows/JackWinServerLaunch.cpp', + '../windows/JackMMCSS.cpp', + ] + + clientlib.vnum = bld.env['JACK_API_VERSION'] + + if bld.env['IS_LINUX']: + clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden") + + if bld.env['IS_MACOSX']: + clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden") + clientlib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64") + #clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module -arch i386 -arch ppc -arch x86_64" + clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module") + clientlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1") + + if bld.env['IS_SUN']: + clientlib.env.append_value("LINKFLAGS", "-lnsl -lsocket") + + if bld.variant: + # if there is variant defined, we expect it to be the 32bit client lib one + # we don't want to build other stuff in this variant + return + serverlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib']) serverlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE'] serverlib.includes = includes @@ -269,69 +337,6 @@ def build(bld): netlib.vnum = bld.env['JACK_API_VERSION'] - clientlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib']) - clientlib.defines = 'HAVE_CONFIG_H' - clientlib.use = uselib - if bld.env['IS_WINDOWS']: - clientlib.install_path = '${BINDIR}' - else: - clientlib.install_path = '${LIBDIR}' - if bld.env['AUTOSTART_METHOD'] == "dbus": - clientlib.use.append('DBUS-1') - clientlib.includes = includes - clientlib.name = 'clientlib' - clientlib.target = 'jack' - clientlib.source = [] + common_libsources - clientlib.source += [ - 'JackLibClient.cpp', - 'JackLibAPI.cpp', - ] - - if bld.env['IS_LINUX']: - clientlib.source += [ - '../posix/JackSocketClientChannel.cpp', - '../posix/JackPosixServerLaunch.cpp', - ] - - if bld.env['IS_SUN']: - clientlib.source += [ - '../posix/JackSocketClientChannel.cpp', - '../posix/JackPosixServerLaunch.cpp', - ] - - if bld.env['IS_MACOSX']: - clientlib.source += [ - '../posix/JackSocketClientChannel.cpp', - '../posix/JackPosixServerLaunch.cpp', - ] - - if bld.env['IS_WINDOWS']: - clientlib.source += [ - '../windows/JackWinNamedPipe.cpp', - '../windows/JackWinNamedPipeClientChannel.cpp', - '../windows/JackWinServerLaunch.cpp', - '../windows/JackMMCSS.cpp', - ] - - clientlib.vnum = bld.env['JACK_API_VERSION'] - - if bld.env['IS_LINUX']: - clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden") - - if bld.env['IS_MACOSX']: - clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden") - clientlib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64") - #clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module -arch i386 -arch ppc -arch x86_64" - clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module") - clientlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1") - - if bld.env['IS_SUN']: - clientlib.env.append_value("LINKFLAGS", "-lnsl -lsocket") - - if bld.env['BUILD_WITH_32_64']: - print("create 32bit lib...") - clientlib32bit = clientlib.clone('lib32') - create_jack_process_obj(bld, 'netmanager', 'JackNetManager.cpp', serverlib) create_jack_process_obj(bld, 'profiler', 'JackProfiler.cpp', serverlib) diff --git a/wscript b/wscript index b27baae0..0c3b350c 100644 --- a/wscript +++ b/wscript @@ -13,6 +13,9 @@ import re import Logs import sys +import waflib.Options +from waflib.Build import BuildContext, CleanContext, InstallContext, UninstallContext + VERSION='1.9.10' APPNAME='jack' JACK_API_VERSION = '0.1.0' @@ -21,6 +24,9 @@ JACK_API_VERSION = '0.1.0' top = '.' out = 'build' +# lib32 variant name used when building in mixed mode +lib32 = 'lib32' + def display_msg(msg, status = None, color = None): sr = msg global g_maxlen @@ -292,10 +298,7 @@ def configure(conf): svnrev = m.group(1) if Options.options.mixed == True: - env_variant2 = conf.env.copy() - conf.set_env_name('lib32', env_variant2) - env_variant2.set_variant('lib32') - conf.setenv('lib32') + conf.setenv(lib32, env=conf.env.derive()) conf.env.append_unique('CXXFLAGS', '-m32') conf.env.append_unique('CFLAGS', '-m32') conf.env.append_unique('LINKFLAGS', '-m32') @@ -318,12 +321,18 @@ def configure(conf): print("Build with a maximum of %d ports per application" % Options.options.application_ports) display_msg("Install prefix", conf.env['PREFIX'], 'CYAN') - display_msg("Library directory", conf.env['LIBDIR'], 'CYAN') + display_msg("Library directory", conf.all_envs[""]['LIBDIR'], 'CYAN') + if conf.env['BUILD_WITH_32_64'] == True: + display_msg("32-bit library directory", conf.all_envs[lib32]['LIBDIR'], 'CYAN') display_msg("Drivers directory", conf.env['ADDON_DIR'], 'CYAN') display_feature('Build debuggable binaries', conf.env['BUILD_DEBUG']) - display_msg('C compiler flags', repr(conf.env['CFLAGS'])) - display_msg('C++ compiler flags', repr(conf.env['CXXFLAGS'])) - display_msg('Linker flags', repr(conf.env['LINKFLAGS'])) + display_msg('C compiler flags', repr(conf.all_envs[""]['CFLAGS'])) + display_msg('C++ compiler flags', repr(conf.all_envs[""]['CXXFLAGS'])) + display_msg('Linker flags', repr(conf.all_envs[""]['LINKFLAGS'])) + if conf.env['BUILD_WITH_32_64'] == True: + display_msg('32-bit C compiler flags', repr(conf.all_envs[lib32]['CFLAGS'])) + display_msg('32-bit C++ compiler flags', repr(conf.all_envs[lib32]['CXXFLAGS'])) + display_msg('32-bit linker flags', repr(conf.all_envs[lib32]['LINKFLAGS'])) display_feature('Build doxygen documentation', conf.env['BUILD_DOXYGEN_DOCS']) display_feature('Build Opus netjack2', conf.env['WITH_OPUS']) display_feature('Build with engine profiling', conf.env['BUILD_WITH_PROFILE']) @@ -364,13 +373,33 @@ def configure(conf): print(Logs.colors.NORMAL, end=' ') print() +def init(ctx): + for y in (BuildContext, CleanContext, InstallContext, UninstallContext): + name = y.__name__.replace('Context','').lower() + class tmp(y): + cmd = name + '_' + lib32 + variant = lib32 + def build(bld): - print("make[1]: Entering directory `" + os.getcwd() + "/" + out + "'") - if not os.access('svnversion.h', os.R_OK): - create_svnversion_task(bld) + if not bld.variant: + out2 = out + else: + out2 = out + "/" + bld.variant + print("make[1]: Entering directory `" + os.getcwd() + "/" + out2 + "'") - # process subfolders from here + if not bld.variant: + if not os.access('svnversion.h', os.R_OK): + create_svnversion_task(bld) + if bld.env['BUILD_WITH_32_64'] == True: + waflib.Options.commands.append(bld.cmd + '_' + lib32) + + # process subfolders from here bld.add_subdirs('common') + + if bld.variant: + # only the wscript in common/ knows how to handle variants + return + if bld.env['IS_LINUX']: bld.add_subdirs('linux') bld.add_subdirs('example-clients') -- 2.11.4.GIT