diff options
Diffstat (limited to 'acprep')
-rwxr-xr-x | acprep | 123 |
1 files changed, 63 insertions, 60 deletions
@@ -1,10 +1,7 @@ #!/usr/bin/env python -# acprep, version 3.0 +# acprep, version 3.1 # -# This script configures my ledger source tree on my Mac OS/X machine. This -# is not necessary, however, since I keep all the files necessary for building -# checked in to the source tree. Users can just type './configure && make'. # This script simply sets up the compiler and linker flags for all the various # build permutations I use for testing and profiling. @@ -36,8 +33,6 @@ LEVELS = {'DEBUG': logging.DEBUG, 'ERROR': logging.ERROR, 'CRITICAL': logging.CRITICAL} -search_prefixes = [ '/usr/local', '/opt/local', '/sw', '/usr' ] - def which(program): def is_exe(fpath): return os.path.exists(fpath) and os.access(fpath, os.X_OK) @@ -61,37 +56,44 @@ def which(program): return None class BoostInfo(object): - def dependencies(system): - if system == 'darwin': + def dependencies(self, system): + if system == 'darwin-homebrew': + return [ 'boost' ] + + if system == 'darwin-macports': return [ 'boost-jam', 'boost', '+python27+universal' ] if system == 'centos': return [ 'boost-devel' ] - elif system == 'ubuntu-lucid': - return [ 'bjam', 'autopoint', - 'libboost-dev', - 'libboost-regex-dev', + elif system == 'ubuntu-trusty': + return [ 'libboost-dev', 'libboost-date-time-dev', 'libboost-filesystem-dev', 'libboost-iostreams-dev', - 'libboost-python-dev' ] + 'libboost-python-dev', + 'libboost-regex-dev', + 'libboost-system-dev', + 'libboost-test-dev' ] - elif system == 'ubuntu-karmic' or system == 'ubuntu-hardy': - return [ 'bjam', 'libboost-dev', + elif system == 'ubuntu-saucy' or system == 'ubuntu-precise': + return [ 'autopoint', + 'libboost-dev', + 'libboost-test-dev', 'libboost-regex-dev', 'libboost-date-time-dev', 'libboost-filesystem-dev', 'libboost-iostreams-dev', 'libboost-python-dev' ] - elif system == 'ubuntu-oneiric': - return [ 'libboost-dev', - 'libboost-python-dev', + elif system == 'ubuntu-lucid': + return [ 'bjam', 'autopoint', + 'libboost-dev', 'libboost-regex-dev', 'libboost-date-time-dev', 'libboost-filesystem-dev', - 'libboost-iostreams-dev' ] + 'libboost-iostreams-dev', + 'libboost-python-dev' ] class CommandLineApp(object): @@ -526,7 +528,16 @@ class PrepareBuild(CommandLineApp): 'libedit' ,'+universal', 'texlive-xetex', 'doxygen', 'graphviz', 'texinfo', 'lcov', 'sloccount' - ] + BoostInfo.dependencies('darwin') + ] + BoostInfo().dependencies('darwin-macports') + self.log.info('Executing: ' + ' '.join(packages)) + self.execute(*packages) + elif exists('/usr/local/bin/brew') or exists('/opt/local/bin/brew'): + self.log.info('Looks like you are using Homebrew on OS X') + packages = [ + 'brew', 'install', + 'cmake', 'ninja', + 'mpfr', 'gmp', + ] + BoostInfo().dependencies('darwin-homebrew') self.log.info('Executing: ' + ' '.join(packages)) self.execute(*packages) elif exists('/sw/bin/fink'): @@ -541,77 +552,62 @@ class PrepareBuild(CommandLineApp): release = open('/etc/lsb-release') info = release.read() release.close() - if re.search('karmic', info): - self.log.info('Looks like you are using APT on Ubuntu Karmic') + if re.search('trusty', info): + self.log.info('Looks like you are using APT on Ubuntu Trusty') packages = [ 'sudo', 'apt-get', 'install', 'build-essential', - 'libtool', - 'autoconf', - 'automake', + 'doxygen', + 'cmake', + 'ninja-build', 'zlib1g-dev', 'libbz2-dev', 'python-dev', 'libgmp3-dev', 'libmpfr-dev', 'gettext', - 'cvs', 'libedit-dev', - #'texlive-full', - #'doxygen', - #'graphviz', 'texinfo', 'lcov', 'sloccount' - ] + BoostInfo.dependencies('ubuntu-karmic') - elif re.search('hardy', info): - self.log.info('Looks like you are using APT on Ubuntu Hardy') + ] + BoostInfo().dependencies('ubuntu-trusty') + elif re.search('saucy', info): + self.log.info('Looks like you are using APT on Ubuntu Saucy') packages = [ 'sudo', 'apt-get', 'install', 'build-essential', 'libtool', - 'autoconf', - 'automake', - 'autopoint', + 'cmake', + 'ninja-build', 'zlib1g-dev', 'libbz2-dev', 'python-dev', - 'cvs', - 'gettext', - 'libgmp3-dev', + 'libgmp-dev', 'libmpfr-dev', + 'gettext', 'libedit-dev', - #'texlive-full', - #'doxygen', - #'graphviz', 'texinfo', 'lcov', 'sloccount' - ] + self.boost_info.dependencies('ubuntu-hardy') - elif re.search('oneiric', info): - self.log.info('Looks like you are using APT on Ubuntu Oneiric') + ] + BoostInfo().dependencies('ubuntu-saucy') + elif re.search('precise', info): + self.log.info('Looks like you are using APT on Ubuntu Precise') packages = [ 'sudo', 'apt-get', 'install', 'build-essential', 'libtool', - 'autoconf', - 'automake', - 'autopoint', + 'cmake', 'zlib1g-dev', 'libbz2-dev', 'python-dev', - 'cvs', - 'gettext', - 'libgmp3-dev', + 'libgmp-dev', 'libmpfr-dev', + 'gettext', 'libedit-dev', - #'texlive-full', - #'doxygen', - #'graphviz', 'texinfo', 'lcov', 'sloccount' - ] + self.boost_info.dependencies('ubuntu-oneiric') + ] + BoostInfo().dependencies('ubuntu-precise') else: self.log.info('I do not recognize your version of Ubuntu!') packages = None @@ -648,6 +644,9 @@ class PrepareBuild(CommandLineApp): ] self.log.info('Executing: ' + ' '.join(packages)) self.execute(*packages) + elif system.startswith('CYGWIN'): + self.log.info('Looks like you are using Cygwin') + self.log.info('Please install the dependencies manually.') ######################################################################### # Determine the system's basic configuration # @@ -686,7 +685,10 @@ class PrepareBuild(CommandLineApp): if self.options.python: self.configure_args.append('-DUSE_PYTHON=1') - if self.options.use_ninja: + if system.startswith('CYGWIN'): + self.configure_args.append('-G') + self.configure_args.append('Unix Makefiles') + elif self.options.use_ninja: self.configure_args.append('-GNinja') if exists('/Users/johnw/Projects/ledger/plan/TODO'): @@ -764,7 +766,7 @@ class PrepareBuild(CommandLineApp): self.LDFLAGS.append('-ftest-coverage') if not self.options.compiler or self.options.compiler == "clang-3.1": - self.LDFLAGS.append('-lprofile_rt') + self.LDFLAGS.append('-lgcov') def setup_flavor_gprof(self): self.configure_args.append('-DBUILD_DEBUG=1') @@ -803,12 +805,13 @@ class PrepareBuild(CommandLineApp): conf_args.append('-DCMAKE_CXX_FLAGS=%s' % self.envvars[var]) elif var == 'LDFLAGS': - conf_args.append('-DCMAKE_EXE_LINKER_FLAGS=%s' % + conf_args.append('-DCMAKE_EXE_LINKER_FLAGS=%s' % self.envvars[var]) if self.options.boost_root: conf_args.append('-DBOOST_ROOT=%s' % self.options.boost_root) + conf_args.append('-DBoost_NO_SYSTEM_PATHS=TRUE') if self.options.boost_suffix: conf_args.append('-DBoost_COMPILER=%s' % self.options.boost_suffix) @@ -882,7 +885,7 @@ class PrepareBuild(CommandLineApp): make_args.append('-j%d' % self.options.jobs) if self.options.verbose: - make_args.append('VERBOSE=1') + make_args.append('-v' if self.options.use_ninja else 'VERBOSE=1') self.log.debug('Configure arguments => ' + str(config_args)) self.log.debug('Makefile arguments => ' + str(make_args)) @@ -895,13 +898,13 @@ class PrepareBuild(CommandLineApp): self.log.debug('Changing directory to ' + build_dir) os.chdir(build_dir) - self.execute(*(['ninja' if self.options.use_ninja else 'make'] + + self.execute(*(['ninja' if self.options.use_ninja else 'make'] + make_args)) finally: os.chdir(self.source_dir) def phase_check(self, *args): - self.log.info('Executing phase: update') + self.log.info('Executing phase: check') build_dir = self.ensure(self.build_directory()) try: self.log.debug('Changing directory to ' + build_dir) |