def setUp(self): repos_path = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'repos') self.repo_root = os.path.join(repos_path, 'one') self.cap_repo_root = os.path.join(repos_path, 'two') self.flags_parser = buildflagsparser.BuildFlagsParser( '-Wl,-Bdynamic', '-Wl,-Bstatic', '-l([^ =]+)', '-L([^ =]+)', '-I([^ =]+)', '-D') default_rules_path = os.path.join(repos_path, 'repo_test_def.opts') with open(default_rules_path) as f: parser = optionsparser.OptionsParser(f) parser.parse() self.default_rules = parser.option_rules
def configure(self): self.ctx.msg('Prefix', self.ctx.env['PREFIX']) if self.uplid == self.actual_uplid: self.ctx.msg('Uplid', self.uplid) else: self.ctx.msg('Uplid - effective (this is *used*):', str(self.uplid) + ' (from BDE_WAF_UPLID)', color='YELLOW') self.ctx.msg('Uplid - actual (this is *not* used):', self.actual_uplid, color='YELLOW') if os.getenv('BDE_WAF_UFID'): self.ctx.msg('Ufid', str(self.ufid) + ' (from BDE_WAF_UFID)') else: self.ctx.msg('Ufid', self.ufid) if self.ctx.options.verbose >= 1: self.ctx.msg('OS type', self.uplid.os_type) self.ctx.msg('OS name', self.uplid.os_name) self.ctx.msg('CPU type', self.uplid.cpu_type) self.ctx.msg('OS version', self.uplid.os_ver) self.ctx.msg('Compiler type', self.uplid.comp_type) self.ctx.msg('Compiler version', self.uplid.comp_ver) loader = repocontextloader.RepoContextLoader(self.ctx.path.abspath()) loader.load() self.repo_context = loader.repo_context if self.ctx.options.verify: self._verify() build_flags_parser = buildflagsparser.BuildFlagsParser( self.ctx.env['SHLIB_MARKER'], self.ctx.env['STLIB_MARKER'], self.ctx.env['LIB_ST'].replace('.', '\.').replace( '%s', r'([^ =]+)$'), self.ctx.env['LIBPATH_ST'].replace('.', '\.').replace( '%s', r'([^ =]+)'), self.ctx.env['CPPPATH_ST'].replace('.', '\.').replace( '%s', r'([^ =]+)'), '/D' if self.uplid.comp_type == 'cl' else '-D') default_rules = optionsutil.get_default_option_rules() # Enable -Werror for building .cpp files (but not .t.cpp) if --werror # is enabled. if self.ctx.options.werror == 'cpp': default_rules.append(optiontypes.OptionRule( optiontypes.OptionCommand.ADD, optiontypes.Uplid.from_str('*-*-*-*-gcc-*'), optiontypes.Ufid(), 'COMPONENT_BDEBUILD_CXXFLAGS', '-Werror')) default_rules.append(optiontypes.OptionRule( optiontypes.OptionCommand.ADD, optiontypes.Uplid.from_str('*-*-*-*-clang-*'), optiontypes.Ufid(), 'COMPONENT_BDEBUILD_CXXFLAGS', '-Werror')) debug_opt_keys = self.ctx.options.debug_opt_keys.split(',') if \ self.ctx.options.debug_opt_keys is not None else [] self.build_config = buildconfigfactory.make_build_config( self.repo_context, build_flags_parser, self.uplid, self.ufid, default_rules, debug_opt_keys) def print_list(label, l): if len(l): self.ctx.msg(label, ' '.join([str(i) for i in l])) print_list('Configured package groups', sorted(self.build_config.package_groups)) print_list('Configured stand-alone packages', sorted(self.build_config.stdalone_packages)) print_list('Configured third-party packages', sorted(self.build_config.third_party_dirs)) print_list('Loading external dependencies', sorted(self.build_config.external_dep)) self._configure_external_libs() if self.build_config.soname_overrides: for uor_name in self.build_config.soname_overrides: self.ctx.msg('Override SONAME for %s' % uor_name, self.build_config.soname_overrides[uor_name]) self.install_config = installconfig.InstallConfig( self.ufid, self.ctx.options.use_dpkg_install, self.ctx.options.use_flat_include_dir, self.ctx.options.libdir, self.ctx.options.bindir, self.ctx.options.lib_suffix) # The .pc files should be UFID neutral when installed to the DPKG # environment in Bloomberg. I.e., a single .pc file supports multiple # UFID-specific types of a library. By default, the installed .pc file # points to the release library. A client can select a different # library type (e.g., dbg_mt_exc_safe) by prepending an -L linker flag # pointing to that particular type. Here, we remove exported macro # definitions that are specific to any single UFID library type. if (self.ctx.options.use_dpkg_install and 'bsl' in self.build_config.package_groups): pg = self.build_config.package_groups['bsl'] remove_flags = [] for f in pg.flags.export_flags: if (f.find('BDE_BUILD_TARGET') != -1 or f.find('NDEBUG') != -1): remove_flags.append(f) for f in remove_flags: pg.flags.export_flags.remove(f) self.ctx.msg('Use flat include directory', 'yes' if self.install_config.is_flat_include else 'no') self.ctx.msg('Lib install directory', self.install_config.lib_dir) self.ctx.msg('Pkg-config install directory', self.install_config.pc_dir) if self.install_config.lib_suffix: self.ctx.msg('Lib name suffix', self.install_config.lib_suffix) num_uors = len(self.build_config.package_groups) + \ len(self.build_config.stdalone_packages) + \ len(self.build_config.third_party_dirs) num_inner_packages = len(self.build_config.inner_packages) num_components = 0 for c in map(buildconfigutil.count_components_in_package, list(self.build_config.inner_packages.values()) + list(self.build_config.stdalone_packages.values())): num_components += c print_list('# UORs, inner packages, and components', (num_uors, num_inner_packages, num_components)) if self.ctx.options.verbose >= 2: self.ctx.msg('Build configuration details', self.build_config) self._save()
def configure(self): self.ctx.msg('Prefix', self.ctx.env['PREFIX']) if self.uplid == self.actual_uplid: self.ctx.msg('Uplid', self.uplid) else: self.ctx.msg('Uplid - effective (this is *used*):', str(self.uplid) + ' (from BDE_WAF_UPLID)', color='YELLOW') self.ctx.msg('Uplid - actual (this is *not* used):', self.actual_uplid, color='YELLOW') if os.getenv('BDE_WAF_UFID'): self.ctx.msg('Ufid', str(self.ufid) + ' (from BDE_WAF_UFID)') else: self.ctx.msg('Ufid', self.ufid) if self.ctx.options.verbose >= 1: self.ctx.msg('OS type', self.uplid.os_type) self.ctx.msg('OS name', self.uplid.os_name) self.ctx.msg('CPU type', self.uplid.cpu_type) self.ctx.msg('OS version', self.uplid.os_ver) self.ctx.msg('Compiler type', self.uplid.comp_type) self.ctx.msg('Compiler version', self.uplid.comp_ver) loader = repocontextloader.RepoContextLoader(self.ctx.path.abspath()) loader.load() self.repo_context = loader.repo_context if self.ctx.options.verify: self._verify() build_flags_parser = buildflagsparser.BuildFlagsParser( self.ctx.env['SHLIB_MARKER'], self.ctx.env['STLIB_MARKER'], self.ctx.env['LIB_ST'].replace('.', '\.').replace('%s', r'([^ =]+)'), self.ctx.env['LIBPATH_ST'].replace('.', '\.').replace( '%s', r'([^ =]+)'), self.ctx.env['CPPPATH_ST'].replace( '.', '\.').replace('%s', r'([^ =]+)'), '/D' if self.uplid.comp_type == 'cl' else '-D') default_rules = optionsutil.get_default_option_rules() debug_opt_keys = self.ctx.options.debug_opt_keys.split(',') if \ self.ctx.options.debug_opt_keys is not None else [] self.build_config = buildconfigfactory.make_build_config( self.repo_context, build_flags_parser, self.uplid, self.ufid, default_rules, debug_opt_keys) def print_list(label, l): if len(l): self.ctx.msg(label, ' '.join([str(i) for i in l])) print_list('Configured package groups', sorted(self.build_config.package_groups)) print_list('Configured stand-alone packages', sorted(self.build_config.stdalone_packages)) print_list('Configured third-party packages', sorted(self.build_config.third_party_dirs)) print_list('Loading external dependencies', sorted(self.build_config.external_dep)) self._configure_external_libs() if self.build_config.soname_overrides: for uor_name in self.build_config.soname_overrides: self.ctx.msg('Override SONAME for %s' % uor_name, self.build_config.soname_overrides[uor_name]) self.install_config = installconfig.InstallConfig( self.ufid, self.ctx.options.use_dpkg_install, self.ctx.options.use_flat_include_dir, self.ctx.options.lib_dir, self.ctx.options.lib_suffix) self.ctx.msg('Use flat include directory', 'yes' if self.install_config.is_flat_include else 'no') self.ctx.msg('Lib install directory', self.install_config.lib_dir) self.ctx.msg('Pkg-config install directory', self.install_config.pc_dir) if self.install_config.lib_suffix: self.ctx.msg('Lib name suffix', self.install_config.lib_suffix) num_uors = len(self.build_config.package_groups) + \ len(self.build_config.stdalone_packages) + \ len(self.build_config.third_party_dirs) num_inner_packages = len(self.build_config.inner_packages) num_components = 0 for c in map( buildconfigutil.count_components_in_package, list(self.build_config.inner_packages.values()) + list(self.build_config.stdalone_packages.values())): num_components += c print_list('# UORs, inner packages, and components', (num_uors, num_inner_packages, num_components)) if self.ctx.options.verbose >= 2: self.ctx.msg('Build configuration details', self.build_config) self._save()
def setUp(self): self.parser = buildflagsparser.BuildFlagsParser( '-Wl,-Bdynamic', '-Wl,-Bstatic', '-l([^ =]+)$', '-L([^ =]+)', '-I([^ =]+)', '-D')