diff options
Diffstat (limited to 'acprep')
-rwxr-xr-x | acprep | 180 |
1 files changed, 120 insertions, 60 deletions
@@ -44,6 +44,7 @@ search_prefixes = [ '/opt/local', class BoostInfo(object): log = None suffix = "" + file_suffix = ".so" home_path = "/usr" include_path = "include" library_path = "lib" @@ -52,13 +53,14 @@ class BoostInfo(object): def __init__(self, log): self.log = log - def configure(self, suffix = None, home_path = None, + def configure(self, suffix = None, file_suffix = None, home_path = None, include_path = None, library_path = None): path = library_path or self.library_path if not isabs(path): path = join(home_path or self.home_path, path) if not exists(path) or not isdir(path) or \ - not self.check_for_boost_regex_lib(path, suffix or self.suffix): + not self.check_for_boost_regex_lib(path, suffix or self.suffix, + file_suffix or self.file_suffix): return False path = include_path or self.include_path @@ -72,6 +74,9 @@ class BoostInfo(object): if suffix: self.log.debug('Setting Boost suffix to => ' + suffix) self.suffix = suffix + if file_suffix: + self.log.debug('Setting Boost file suffix to => ' + file_suffix) + self.file_suffix = file_suffix if home_path: self.log.debug('Setting Boost home to => ' + home_path) self.home_path = home_path @@ -90,6 +95,10 @@ class BoostInfo(object): self.log.debug('Saw option --boost or --boost-suffix') self.suffix = value + def option_boost_file_suffix(self, option=None, opt_str=None, value=None, parser=None): + self.log.debug('Saw option --boost-file-suffix') + self.file_suffix = value + def option_boost_home(self, option=None, opt_str=None, value=None, parser=None): self.log.debug('Saw option --boost-home') self.home_path = value @@ -104,21 +113,25 @@ class BoostInfo(object): def inform_boost_details(self): self.log.info('Boost was found here:') + self.log.info('Boost home path => ' + self.home_path) self.log.info('Boost include path => ' + self.include_directory()) self.log.info('Boost library path => ' + self.library_directory()) - self.log.info('Boost suffix => ' + self.suffix) + self.log.info('Boost suffix => ' + self.suffix) + self.log.info('Boost file suffix => ' + self.file_suffix) def find_boost_in_directory(self, path): if exists(path) and isdir(path): for entry in reversed(sorted(os.listdir(path))): if re.search('boost_regex', entry): - self.log.info('Found a Boost library: ' + entry) + self.log.info('Found a Boost library: ' + join(path, entry)) - match = re.match('libboost_regex([^.]*)\.(a|so|dylib)', entry) + match = re.match('libboost_regex([^.]*)(\.(a|so|dylib))', entry) if match: suffix = match.group(1) + file_suffix = match.group(2) self.log.info('Found a Boost suffix => ' + suffix) - return suffix + self.log.info('Found a Boost file suffix => ' + file_suffix) + return [suffix, file_suffix] else: self.log.debug('The directory "%s" is not valid, skipping' % path) return None @@ -126,22 +139,24 @@ class BoostInfo(object): def locate_boost(self): lib64_dirs = map(lambda x: join(x, 'lib64'), search_prefixes) lib_dirs = map(lambda x: join(x, 'lib'), search_prefixes) + result = None for path in lib64_dirs + lib_dirs: self.log.info('Looking for Boost in %s...' % path) - self.suffix = self.find_boost_in_directory(path) - if self.suffix is not None: + result = self.find_boost_in_directory(path) + if result is not None: + self.suffix, self.file_suffix = result + self.library_path = path self.home_path = dirname(path) self.configured = True self.inform_boost_details() break - if self.suffix is None: - self.log.error("Boost not found, try --boost-home (and --boost-suffix)") + if result is None: + self.log.error("Boost not found, try --boost-home (and --boost-suffix, --boost-file-suffix)") sys.exit(1) - def check_for_boost_regex_lib(self, path, suffix): + def check_for_boost_regex_lib(self, path, suffix, file_suffix): regex_lib = join(path, 'libboost_regex' + suffix) - return (exists(regex_lib + '.a') or exists(regex_lib + '.lib') or - exists(regex_lib + '.so') or exists(regex_lib + '.dylib')) + return exists(regex_lib + file_suffix) def check_for_boost_regex_hpp(self, path): regex_hpp = join(path, 'boost/regex.hpp') @@ -152,6 +167,11 @@ class BoostInfo(object): self.locate_boost() return self.suffix + def get_file_suffix(self): + if not self.configured: + self.locate_boost() + return self.file_suffix + def include_directory(self): if not self.configured: self.locate_boost() @@ -184,7 +204,7 @@ class BoostInfo(object): self.log.error("Boost library directory '%s' not found, use --boost-include" % path) sys.exit(1) - if not self.check_for_boost_regex_lib(path, self.suffix): + if not self.check_for_boost_regex_lib(path, self.suffix, self.file_suffix): self.log.error("Could not find Boost library 'boost_regex' in '%s'; use --boost-* flags" % path) sys.exit(1) @@ -218,7 +238,6 @@ class CommandLineApp(object): log_handler = None darwin_gcc = False boost_version = "1_43" - gcc_version = "45" options = { 'debug': False, @@ -414,10 +433,14 @@ class PrepareBuild(CommandLineApp): action="callback", type="string", callback=self.boost_info.option_boost_suffix, help='Set Boost library suffix (ex: "--boost=-mt")') - op.add_option('', '--boost-sufix', metavar='BOOST_SUFFIX', + op.add_option('', '--boost-suffix', metavar='BOOST_SUFFIX', action="callback", type="string", callback=self.boost_info.option_boost_suffix, help='Set Boost library suffix (ex: "--boost-suffix=-mt")') + op.add_option('', '--boost-file-suffix', metavar='BOOST_FILE_SUFFIX', + action="callback", type="string", + callback=self.boost_info.option_boost_file_suffix, + help='Set Boost library file suffix (ex: "--boost-file-suffix=.so")') op.add_option('', '--boost-home', metavar='BOOST_HOME', action="callback", type="string", callback=self.boost_info.option_boost_home, @@ -458,6 +481,12 @@ class PrepareBuild(CommandLineApp): op.add_option('', '--no-python', action='store_true', dest='no_python', default=False, help='Do not enable Python support by default') + op.add_option('', '--enable-cache', action='store_true', + dest='enable_cache', default=False, + help='Enable use of Boost.Serialization (--cache)') + op.add_option('', '--enable-doxygen', action='store_true', + dest='enable_doxygen', default=False, + help='Enable use of Doxygen to build ref manual ("make docs")') op.add_option('', '--universal', action='store_true', dest='universal', default=False, help='Attempt to build universal binaries') @@ -617,7 +646,7 @@ class PrepareBuild(CommandLineApp): self.should_clean = True return 'because acprep is newer than Makefile.in' elif self.isnewer('configure.ac', 'configure'): - return 'because confgure.ac is newer than configure' + return 'because configure.ac is newer than configure' elif self.isnewer('Makefile.am', 'Makefile.in'): return 'because Makefile.am is newer than Makefile.in' return False @@ -661,7 +690,7 @@ class PrepareBuild(CommandLineApp): def phase_sloc(self, *args): self.log.info('Executing phase: sloc') - self.execute('sloccount', 'src', 'python', 'lisp', 'test') + self.execute('sloccount', 'src', 'python', 'lisp', 'test') ######################################################################### # Configure source tree using autogen # @@ -885,9 +914,16 @@ class PrepareBuild(CommandLineApp): ######################################################################### def setup_system_directories(self): + boost_include = self.boost_info.include_directory() + boost_library = self.boost_info.library_directory() + + if re.match('/opt/local', self.boost_info.home_path): + self.log.debug("Setting Python home to /opt/local based on Boost's location") + self.envvars['PYTHON_HOME'] = '/opt/local' + # Each of these becomes '-isystem <name>' for path in ['/usr/local/include', - self.boost_info.include_directory(), + boost_include, '%s/include/python%s' % (self.envvars['PYTHON_HOME'], self.envvars['PYTHON_VERSION'].strip()), @@ -905,7 +941,7 @@ class PrepareBuild(CommandLineApp): % (self.envvars['PYTHON_HOME'], self.envvars['PYTHON_VERSION'].strip()), '/opt/local/lib', - self.boost_info.library_directory(), + boost_library, '/sw/lib']: if exists(path) and isdir(path) and \ path not in self.sys_library_dirs: @@ -913,18 +949,24 @@ class PrepareBuild(CommandLineApp): self.sys_library_dirs.append(path) def setup_for_johnw(self): + match = re.search('gcc-mp-([0-9]+)\.([0-9]+)', self.envvars['CC']) + if match: + gcc_version = match.group(1) + match.group(2) + else: + gcc_version = "42" + if self.current_flavor == 'debug' or self.current_flavor == 'gcov': - if exists('/usr/local/stow/cppunit-gcc%s/include' % self.gcc_version): + if exists('/usr/local/stow/cppunit-gcc%s/include' % gcc_version): self.sys_include_dirs.insert( - 0, '/usr/local/stow/cppunit-gcc%s/include' % self.gcc_version) + 0, '/usr/local/stow/cppunit-gcc%s/include' % gcc_version) self.sys_library_dirs.insert( - 0, '/usr/local/stow/cppunit-gcc%s/lib' % self.gcc_version) + 0, '/usr/local/stow/cppunit-gcc%s/lib' % gcc_version) - if exists('/usr/local/stow/icu-gcc%s/include' % self.gcc_version): + if exists('/usr/local/stow/icu-gcc%s/include' % gcc_version): self.sys_include_dirs.insert( - 0, '/usr/local/stow/icu-gcc%s/include' % self.gcc_version) + 0, '/usr/local/stow/icu-gcc%s/include' % gcc_version) self.sys_library_dirs.insert( - 0, '/usr/local/stow/icu-gcc%s/lib' % self.gcc_version) + 0, '/usr/local/stow/icu-gcc%s/lib' % gcc_version) self.CPPFLAGS.append('-D_GLIBCXX_FULLY_DYNAMIC_STRING=1') self.configure_args.append('--disable-shared') @@ -937,10 +979,6 @@ class PrepareBuild(CommandLineApp): self.locate_darwin_libraries() def setup_for_system(self): - if exists('/Users/johnw/Projects/ledger/plan/TODO'): - self.setup_for_johnw() - self.setup_system_directories() - system = self.get_stdout('uname', '-s') self.log.info('System type is => ' + system) @@ -991,6 +1029,15 @@ class PrepareBuild(CommandLineApp): # g++ 4.0.1 cannot use PCH headers on OS X 10.5 self.option_no_pch() + if self.options.enable_doxygen: + self.configure_args.append('--enable-doxygen') + if self.options.enable_cache: + self.configure_args.append('--enable-cache') + + if exists('/Users/johnw/Projects/ledger/plan/TODO'): + self.setup_for_johnw() + self.setup_system_directories() + if '--enable-pch' not in self.configure_args and \ (exists('/opt/local/bin/ccache') or \ exists('/usr/local/bin/ccache')): @@ -1087,30 +1134,30 @@ class PrepareBuild(CommandLineApp): def option_warn(self, option=None, opt_str=None, value=None, parser=None): self.log.debug('Saw option --warn') - self.CXXFLAGS.append('-ansi') - self.CXXFLAGS.append('-pedantic') - self.CXXFLAGS.append('-pedantic-errors') - self.CXXFLAGS.append('-Wall') - self.CXXFLAGS.append('-Winvalid-pch') - self.CXXFLAGS.append('-Wextra') - self.CXXFLAGS.append('-Wcast-align') - self.CXXFLAGS.append('-Wcast-qual') - self.CXXFLAGS.append('-Wfloat-equal') - self.CXXFLAGS.append('-Wmissing-field-initializers') - self.CXXFLAGS.append('-Wno-endif-labels') - self.CXXFLAGS.append('-Woverloaded-virtual') - self.CXXFLAGS.append('-Wsign-compare') - self.CXXFLAGS.append('-Wsign-promo') - self.CXXFLAGS.append('-Wstrict-null-sentinel') - self.CXXFLAGS.append('-Wwrite-strings') - self.CXXFLAGS.append('-Wno-old-style-cast') - self.CXXFLAGS.append('-Wno-deprecated') - self.CXXFLAGS.append('-Wno-strict-aliasing') - self.CXXFLAGS.append('-Werror') + self.CXXFLAGS.append('-ansi') + self.CXXFLAGS.append('-pedantic') + self.CXXFLAGS.append('-pedantic-errors') + self.CXXFLAGS.append('-Wall') + self.CXXFLAGS.append('-Winvalid-pch') + self.CXXFLAGS.append('-Wextra') + self.CXXFLAGS.append('-Wcast-align') + self.CXXFLAGS.append('-Wcast-qual') + self.CXXFLAGS.append('-Wfloat-equal') + self.CXXFLAGS.append('-Wmissing-field-initializers') + self.CXXFLAGS.append('-Wno-endif-labels') + self.CXXFLAGS.append('-Woverloaded-virtual') + self.CXXFLAGS.append('-Wsign-compare') + self.CXXFLAGS.append('-Wsign-promo') + self.CXXFLAGS.append('-Wstrict-null-sentinel') + self.CXXFLAGS.append('-Wwrite-strings') + self.CXXFLAGS.append('-Wno-old-style-cast') + self.CXXFLAGS.append('-Wno-deprecated') + self.CXXFLAGS.append('-Wno-strict-aliasing') + self.CXXFLAGS.append('-Werror') def option_pic(self, option=None, opt_str=None, value=None, parser=None): self.log.debug('Saw option --pic') - self.CXXFLAGS.append('-fPIC') + self.CXXFLAGS.append('-fPIC') def option_output(self, option=None, opt_str=None, value=None, parser=None): self.log.debug('Saw option --output') @@ -1142,6 +1189,14 @@ class PrepareBuild(CommandLineApp): ######################################################################### def locate_darwin_libraries(self): + match = re.search('gcc-mp-([0-9]+)\.([0-9]+)', self.envvars['CC']) + if match: + gcc_version = match.group(1) + match.group(2) + else: + gcc_version = "42" + + self.log.debug('Using gcc version: %s' % gcc_version) + if self.current_flavor == 'debug' or self.current_flavor == 'gcov': if self.options.use_glibcxx_debug: self.log.debug('We are using GLIBCXX_DEBUG, so setting up flags') @@ -1149,19 +1204,21 @@ class PrepareBuild(CommandLineApp): if self.boost_info.configure( home_path = '/usr/local/stow/boost_%s_0-gcc%s' % \ - (self.boost_version, self.gcc_version), + (self.boost_version, gcc_version), suffix = '-xgcc%s-sd-%s' % \ - (self.gcc_version, self.boost_version), + (gcc_version, self.boost_version), + file_suffix = '.dylib', include_path = 'include/boost-%s' % self.boost_version): pass elif self.boost_info.configure( home_path = '/usr/local/stow/boost_%s_0-gcc%s' % \ - (self.boost_version, self.gcc_version), + (self.boost_version, gcc_version), suffix = '-xgcc%s-d-%s' % \ - (self.gcc_version, self.boost_version), + (gcc_version, self.boost_version), + file_suffix = '.dylib', include_path = 'include/boost-%s' % self.boost_version): pass - elif self.boost_info.configure(suffix = '-d'): + elif self.boost_info.configure(suffix = '-d', file_suffix = '.dylib'): pass else: @@ -1169,16 +1226,18 @@ class PrepareBuild(CommandLineApp): pass elif self.boost_info.configure( home_path = '/usr/local/stow/boost_%s_0-gcc%s' % \ - (self.boost_version, self.gcc_version), + (self.boost_version, gcc_version), suffix = '-xgcc%s-s-%s' % \ - (self.gcc_version, self.boost_version), + (gcc_version, self.boost_version), + file_suffix = '.dylib', include_path = 'include/boost-%s' % self.boost_version): pass elif self.boost_info.configure( home_path = '/usr/local/stow/boost_%s_0-gcc%s' % \ - (self.boost_version, self.gcc_version), + (self.boost_version, gcc_version), suffix = '-xgcc%s-%s' % \ - (self.gcc_version, self.boost_version), + (gcc_version, self.boost_version), + file_suffix = '.dylib', include_path = 'include/boost-%s' % self.boost_version): pass @@ -1522,6 +1581,7 @@ class PrepareBuild(CommandLineApp): self.configure_flavor('default', reset=False) self.log.info('=== Testing default ===') self.phase_make('fullcheck') + self.phase_make('docs') self.log.info('=== Building final distcheck ===') self.phase_distcheck() |