From d1faa1e505f947defdd4afe517ff8249fdf79e4d Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 14 Nov 2009 06:13:06 -0500 Subject: Use the static Python libs when building statically --- acprep | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'acprep') diff --git a/acprep b/acprep index d9029741..1b99566a 100755 --- a/acprep +++ b/acprep @@ -1034,6 +1034,14 @@ class PrepareBuild(CommandLineApp): self.sys_include_dirs.append('/opt/local/include/boost') + elif exists('/usr/local/lib/libboost_regex-xgcc44-s-1_40.a'): + self.envvars['BOOST_HOME'] = '/usr/local' + self.envvars['BOOST_SUFFIX'] = '-xgcc44-s-1_40' + self.log.info('Setting BOOST_SUFFIX => %s' % + self.envvars['BOOST_SUFFIX']) + + self.sys_include_dirs.append('/usr/local/include/boost-1_40') + elif exists('/usr/local/lib/libboost_regex-xgcc44-1_40.a'): self.envvars['BOOST_HOME'] = '/usr/local' self.envvars['BOOST_SUFFIX'] = '-xgcc44-1_40' -- cgit v1.2.3 From ce96e61bf8bb08be6cdab5640542a17c69f66adb Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 14 Nov 2009 16:17:34 -0500 Subject: Removed ARCHFLAGS from the acprep file --- acprep | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'acprep') diff --git a/acprep b/acprep index 1b99566a..f9bd18e5 100755 --- a/acprep +++ b/acprep @@ -188,10 +188,8 @@ class PrepareBuild(CommandLineApp): self.CPPFLAGS = [] self.CCFLAGS = [] - self.ARCHFLAGS = [] self.CXXFLAGS = [] self.LDFLAGS = [] - self.LDARCHFLAGS = [] self.envvars = { 'PYTHON_HOME': '/usr', @@ -204,10 +202,8 @@ class PrepareBuild(CommandLineApp): 'CCFLAGS': '', 'CXX': 'g++', 'CXXFLAGS': '', - 'ARCHFLAGS': '', 'LD': 'g++', - 'LDFLAGS': '', - 'LDARCHFLAGS': '', + 'LDFLAGS': '' } for varname in self.envvars.keys(): @@ -797,12 +793,6 @@ class PrepareBuild(CommandLineApp): self.CXXFLAGS.append('-pthread') elif system == 'Darwin': - #self.ARCHFLAGS += ['-arch', 'i386', '-arch', 'ppc', - # '-isysroot', '/Developer/SDKs/MacOSX10.5.sdk'] - #self.LDARCHFLAGS += self.ARCHFLAGS - #ldflag = '-Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk' - #self.LDARCHFLAGS.append(ldflag) - self.setup_for_johnw() # g++ 4.0.1 cannot use PCH headers on OS X 10.5, so we must use a @@ -859,8 +849,7 @@ class PrepareBuild(CommandLineApp): def finalize_config(self): self.setup_flavor() - for var in ('CPPFLAGS', 'CCFLAGS', 'ARCHFLAGS', - 'CXXFLAGS', 'LDFLAGS', 'LDARCHFLAGS'): + for var in ('CPPFLAGS', 'CCFLAGS', 'CXXFLAGS', 'LDFLAGS'): value = self.__dict__[var] if value: first = not self.envvars[var] @@ -1130,8 +1119,8 @@ class PrepareBuild(CommandLineApp): conf_args = ['sh', join(self.source_dir, 'configure'), '--srcdir', self.source_dir] - for var in ('CC', 'CPPFLAGS', 'CCFLAGS', 'ARCHFLAGS', - 'CXX', 'CXXFLAGS', 'LD', 'LDFLAGS', 'LDARCHFLAGS'): + for var in ('CC', 'CPPFLAGS', 'CCFLAGS', 'CXX', 'CXXFLAGS', + 'LD', 'LDFLAGS'): if self.envvars.has_key(var) and self.envvars[var] and \ (var.endswith('FLAGS') or exists(self.envvars[var])): conf_args.append('%s=%s' % (var, self.envvars[var])) -- cgit v1.2.3 From 0f975df36b25644694351151262ae14041650fff Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 14 Nov 2009 16:17:48 -0500 Subject: Improved some of the dependencies targets --- acprep | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'acprep') diff --git a/acprep b/acprep index f9bd18e5..0b7545a2 100755 --- a/acprep +++ b/acprep @@ -550,14 +550,12 @@ class PrepareBuild(CommandLineApp): self.log.info('Looks like you are using MacPorts on OS X') packages = [ 'sudo', 'port', 'install', '-f', - 'automake', 'autoconf', 'libtool', - 'python26', 'boost-jam', + 'automake', 'autoconf', 'libtool', 'python26', 'libiconv', '+universal', 'zlib', '+universal', 'gmp' ,'+universal', 'mpfr', '+universal', 'ncurses', '+universal', 'ncursesw', '+universal', 'gettext' ,'+universal', 'libedit' ,'+universal', - 'boost', '+universal+st+debug+python26+doc', - 'cppunit' ,'+universal', + 'boost-jam', 'boost', '+st+python26+icu', 'cppunit', 'texlive', 'doxygen', 'graphviz', 'texinfo', 'lcov', 'sloccount' ] @@ -602,8 +600,7 @@ class PrepareBuild(CommandLineApp): 'python-devel', 'bboost-devel', 'gmp-devel', 'gettext-devel', #'mpfr-devel' - 'libedit-devel', - 'cppunit-devel', + 'libedit-devel', 'cppunit-devel', #'texlive-full', #'doxygen', 'graphviz', 'texinfo', #'lcov', 'sloccount' -- cgit v1.2.3 From ff484fb27b2f16eee071ed731eb524fb6c80f0c1 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 14 Nov 2009 16:18:31 -0500 Subject: Fixes to the ways OS X libraries are located --- acprep | 139 +++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 70 insertions(+), 69 deletions(-) (limited to 'acprep') diff --git a/acprep b/acprep index 0b7545a2..3c6c9ad3 100755 --- a/acprep +++ b/acprep @@ -42,6 +42,7 @@ class CommandLineApp(object): force_exit = True # If true, always ends run() with sys.exit() log_handler = None + darwin_gcc = False options = { 'debug': False, @@ -689,6 +690,11 @@ class PrepareBuild(CommandLineApp): path) return None + def inform_boost_location(self, text, suffix): + self.log.info('Boost %s here:' % text) + self.log.info('BOOST_HOME => ' + self.envvars['BOOST_HOME']) + self.log.info('BOOST_SUFFIX => ' + suffix) + def locate_boost(self): if self.envvars['BOOST_SUFFIX']: self.log.info(("Not looking for Boost, since " + @@ -701,10 +707,7 @@ class PrepareBuild(CommandLineApp): self.log.info('Looking for Boost in %s...' % path) suffix = self.locate_boost_in_dir(path) if suffix is not None: - self.log.info('Boost is located here:') - self.log.info('BOOST_HOME => ' + - self.envvars['BOOST_HOME']) - self.log.info('BOOST_SUFFIX => ' + suffix) + self.inform_boost_location('was found', suffix) break if suffix is None: self.log.error("Boost could not be found.") @@ -742,29 +745,25 @@ class PrepareBuild(CommandLineApp): self.sys_library_dirs.append(path) def setup_for_johnw(self): - # jww (2009-03-09): Some peculiarities specific to my system - if exists('/Users/johnw/Dropbox/Accounts/ledger.dat'): - if self.current_flavor == 'debug': - if exists('/usr/local/stow/cppunit/include'): - self.sys_include_dirs.insert(0, '/usr/local/stow/cppunit/include') - self.sys_library_dirs.insert(0, '/usr/local/stow/cppunit/lib') - - if exists('/usr/local/stow/icu/include'): - self.sys_include_dirs.insert(0, '/usr/local/stow/icu/include') - self.sys_library_dirs.insert(0, '/usr/local/stow/icu/lib') + if self.current_flavor == 'debug': + if exists('/usr/local/stow/cppunit/include'): + self.sys_include_dirs.insert(0, '/usr/local/stow/cppunit/include') + self.sys_library_dirs.insert(0, '/usr/local/stow/cppunit/lib') - self.CPPFLAGS.append('-D_GLIBCXX_FULLY_DYNAMIC_STRING=1') + if exists('/usr/local/stow/icu/include'): + self.sys_include_dirs.insert(0, '/usr/local/stow/icu/include') + self.sys_library_dirs.insert(0, '/usr/local/stow/icu/lib') - self.options.use_glibcxx_debug = True + self.CPPFLAGS.append('-D_GLIBCXX_FULLY_DYNAMIC_STRING=1') - self.CXXFLAGS.append('-march=nocona') - self.CXXFLAGS.append('-msse3') + self.options.use_glibcxx_debug = True - self.configure_args.append('--disable-shared') - self.configure_args.append('--enable-doxygen') - self.configure_args.append('--enable-python') + self.CXXFLAGS.append('-march=nocona') + self.CXXFLAGS.append('-msse3') - self.locate_my_libraries() + self.configure_args.append('--disable-shared') + self.configure_args.append('--enable-doxygen') + self.configure_args.append('--enable-python') def setup_for_system(self): self.setup_system_directories() @@ -790,11 +789,18 @@ class PrepareBuild(CommandLineApp): self.CXXFLAGS.append('-pthread') elif system == 'Darwin': - self.setup_for_johnw() + if exists('/Users/johnw/Dropbox/Accounts/ledger.dat'): + self.setup_for_johnw() + + self.locate_darwin_libraries() - # g++ 4.0.1 cannot use PCH headers on OS X 10.5, so we must use a - # newer version. - if exists('/opt/local/bin/g++-mp-4.4'): + if self.current_flavor == 'opt' and \ + exists('/usr/bin/g++-4.2'): + self.envvars['CC'] = '/usr/bin/gcc-4.2' + self.envvars['CXX'] = '/usr/bin/g++-4.2' + self.envvars['LD'] = '/usr/bin/g++-4.2' + self.darwin_gcc = True + elif exists('/opt/local/bin/g++-mp-4.4'): self.envvars['CC'] = '/opt/local/bin/gcc-mp-4.4' self.envvars['CXX'] = '/opt/local/bin/g++-mp-4.4' self.envvars['LD'] = '/opt/local/bin/g++-mp-4.4' @@ -802,12 +808,13 @@ class PrepareBuild(CommandLineApp): self.envvars['CC'] = '/opt/local/bin/gcc-mp-4.3' self.envvars['CXX'] = '/opt/local/bin/g++-mp-4.3' self.envvars['LD'] = '/opt/local/bin/g++-mp-4.3' - elif not self.options.use_glibcxx_debug and \ - exists('/usr/bin/g++-4.2'): + elif exists('/usr/bin/g++-4.2'): self.envvars['CC'] = '/usr/bin/gcc-4.2' self.envvars['CXX'] = '/usr/bin/g++-4.2' self.envvars['LD'] = '/usr/bin/g++-4.2' + self.darwin_gcc = True else: + # g++ 4.0.1 cannot use PCH headers on OS X 10.5 self.option_no_pch() if '--enable-pch' not in self.configure_args and \ @@ -964,77 +971,71 @@ class PrepareBuild(CommandLineApp): # The various build flavors # ######################################################################### - def locate_my_libraries(self): - if self.options.use_glibcxx_debug: + def locate_darwin_libraries(self): + if self.current_flavor == 'debug': self.log.debug('We are using GLIBCXX_DEBUG, so setting up flags') - self.CPPFLAGS.append('-D_GLIBCXX_DEBUG=1') + if self.options.use_glibcxx_debug: + self.CPPFLAGS.append('-D_GLIBCXX_DEBUG=1') - if exists('/usr/local/stow/cppunit-debug/include'): - if '/usr/local/stow/cppunit/include' in self.sys_include_dirs: - self.sys_include_dirs.remove('/usr/local/stow/cppunit/include') - self.sys_library_dirs.remove('/usr/local/stow/cppunit/lib') + if exists('/usr/local/stow/cppunit-debug/include'): + if '/usr/local/stow/cppunit/include' in self.sys_include_dirs: + self.sys_include_dirs.remove('/usr/local/stow/cppunit/include') + self.sys_library_dirs.remove('/usr/local/stow/cppunit/lib') - self.sys_include_dirs.insert(0, '/usr/local/stow/cppunit-debug/include') - self.sys_library_dirs.insert(0, '/usr/local/stow/cppunit-debug/lib') + self.sys_include_dirs.insert(0, '/usr/local/stow/cppunit-debug/include') + self.sys_library_dirs.insert(0, '/usr/local/stow/cppunit-debug/lib') - if exists('/usr/local/stow/icu-debug/include'): - if '/usr/local/stow/icu/include' in self.sys_include_dirs: - self.sys_include_dirs.remove('/usr/local/stow/icu/include') - self.sys_library_dirs.remove('/usr/local/stow/icu/lib') + if exists('/usr/local/stow/icu-debug/include'): + if '/usr/local/stow/icu/include' in self.sys_include_dirs: + self.sys_include_dirs.remove('/usr/local/stow/icu/include') + self.sys_library_dirs.remove('/usr/local/stow/icu/lib') - self.sys_include_dirs.insert(0, '/usr/local/stow/icu-debug/include') - self.sys_library_dirs.insert(0, '/usr/local/stow/icu-debug/lib') - - if exists('/opt/local/lib/libboost_regex-d.a'): - self.envvars['BOOST_HOME'] = '/opt/local' - self.envvars['BOOST_SUFFIX'] = '-d' - - self.log.info('Setting BOOST_SUFFIX => %s' % - self.envvars['BOOST_SUFFIX']) - - self.sys_include_dirs.append('/opt/local/include/boost') + self.sys_include_dirs.insert(0, '/usr/local/stow/icu-debug/include') + self.sys_library_dirs.insert(0, '/usr/local/stow/icu-debug/lib') - elif exists('/usr/local/lib/libboost_regex-xgcc44-sd-1_40.a'): + if exists('/usr/local/lib/libboost_regex-xgcc44-sd-1_40.a'): self.envvars['BOOST_HOME'] = '/usr/local' self.envvars['BOOST_SUFFIX'] = '-xgcc44-sd-1_40' - self.log.info('Setting BOOST_SUFFIX => %s' % - self.envvars['BOOST_SUFFIX']) - self.sys_include_dirs.append('/usr/local/include/boost-1_40') + self.inform_boost_location('is really located', + self.envvars['BOOST_SUFFIX']) elif exists('/usr/local/lib/libboost_regex-xgcc44-d-1_40.a'): self.envvars['BOOST_HOME'] = '/usr/local' self.envvars['BOOST_SUFFIX'] = '-xgcc44-d-1_40' - self.log.info('Setting BOOST_SUFFIX => %s' % - self.envvars['BOOST_SUFFIX']) - self.sys_include_dirs.append('/usr/local/include/boost-1_40') + self.inform_boost_location('is really located', + self.envvars['BOOST_SUFFIX']) + + elif exists('/opt/local/lib/libboost_regex-d.a'): + self.envvars['BOOST_HOME'] = '/opt/local' + self.envvars['BOOST_SUFFIX'] = '-d' + self.sys_include_dirs.append('/opt/local/include/boost') + self.inform_boost_location('is really located', + self.envvars['BOOST_SUFFIX']) + else: if exists('/opt/local/lib/libboost_regex.a'): self.envvars['BOOST_HOME'] = '/opt/local' self.envvars['BOOST_SUFFIX'] = '' - - self.log.info('Setting BOOST_SUFFIX => %s' % - self.envvars['BOOST_SUFFIX']) - self.sys_include_dirs.append('/opt/local/include/boost') + self.inform_boost_location('is really located', + self.envvars['BOOST_SUFFIX']) elif exists('/usr/local/lib/libboost_regex-xgcc44-s-1_40.a'): self.envvars['BOOST_HOME'] = '/usr/local' self.envvars['BOOST_SUFFIX'] = '-xgcc44-s-1_40' - self.log.info('Setting BOOST_SUFFIX => %s' % - self.envvars['BOOST_SUFFIX']) - self.sys_include_dirs.append('/usr/local/include/boost-1_40') + self.inform_boost_location('is really located', + self.envvars['BOOST_SUFFIX']) elif exists('/usr/local/lib/libboost_regex-xgcc44-1_40.a'): self.envvars['BOOST_HOME'] = '/usr/local' self.envvars['BOOST_SUFFIX'] = '-xgcc44-1_40' - self.log.info('Setting BOOST_SUFFIX => %s' % - self.envvars['BOOST_SUFFIX']) - self.sys_include_dirs.append('/usr/local/include/boost-1_40') + self.inform_boost_location('is really located', + self.envvars['BOOST_SUFFIX']) def setup_flavor_default(self): pass -- cgit v1.2.3 From 9b614cdd0d49ceec4c932a51877b896ba78adae3 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 14 Nov 2009 16:18:45 -0500 Subject: Use -fast for building optimized Ledger on OS X --- acprep | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'acprep') diff --git a/acprep b/acprep index 3c6c9ad3..897c3772 100755 --- a/acprep +++ b/acprep @@ -1047,10 +1047,14 @@ class PrepareBuild(CommandLineApp): self.LDFLAGS.append('-g') def setup_flavor_opt(self): - self.CXXFLAGS.append('-O3') - self.LDFLAGS.append('-O3') - self.CXXFLAGS.append('-fomit-frame-pointer') - self.LDFLAGS.append('-fomit-frame-pointer') + if self.darwin_gcc: + self.CXXFLAGS.append('-fast') + self.LDFLAGS.append('-fast') + else: + self.CXXFLAGS.append('-O3') + self.LDFLAGS.append('-O3') + self.CXXFLAGS.append('-fomit-frame-pointer') + self.LDFLAGS.append('-fomit-frame-pointer') def setup_flavor_gcov(self): self.CXXFLAGS.append('-g') -- cgit v1.2.3 From 8d698e5ccb471d546eee8a5bea6d6c56ec4b08c3 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 14 Nov 2009 17:43:19 -0500 Subject: Don't use GLIBCXX_DEBUG only for opt builds --- README-1ST | 3 ++- acprep | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'acprep') diff --git a/README-1ST b/README-1ST index 9eb1349c..2dc12192 100644 --- a/README-1ST +++ b/README-1ST @@ -21,7 +21,8 @@ are a MacPorts user, you can install these dependencies very simply using: $ ./acprep dependencies Once this is done, I recommend building both debug and optimized versions of -Ledger, in a subdirectory of your source tree named 'build': +Ledger, in a subdirectory of your source tree named 'build' (which acprep will +manage for you, you simply need to make it): $ mkdir build $ ./acprep opt make diff --git a/acprep b/acprep index 897c3772..bf582cf5 100755 --- a/acprep +++ b/acprep @@ -745,7 +745,7 @@ class PrepareBuild(CommandLineApp): self.sys_library_dirs.append(path) def setup_for_johnw(self): - if self.current_flavor == 'debug': + if self.current_flavor != 'opt': if exists('/usr/local/stow/cppunit/include'): self.sys_include_dirs.insert(0, '/usr/local/stow/cppunit/include') self.sys_library_dirs.insert(0, '/usr/local/stow/cppunit/lib') @@ -972,7 +972,7 @@ class PrepareBuild(CommandLineApp): ######################################################################### def locate_darwin_libraries(self): - if self.current_flavor == 'debug': + if self.current_flavor != 'opt': self.log.debug('We are using GLIBCXX_DEBUG, so setting up flags') if self.options.use_glibcxx_debug: -- cgit v1.2.3