diff options
author | John Wiegley <johnw@newartisans.com> | 2010-10-07 01:56:18 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-10-07 01:56:18 -0400 |
commit | 6901c3bd55d0ffa60ea9175c87223a3b11501a5b (patch) | |
tree | 95c6e1d0d08744f07ecbd9f3d36c055091ee5586 | |
parent | 5fd91d26ceeae3fa944410c00708ad8ec33a8381 (diff) | |
download | fork-ledger-6901c3bd55d0ffa60ea9175c87223a3b11501a5b.tar.gz fork-ledger-6901c3bd55d0ffa60ea9175c87223a3b11501a5b.tar.bz2 fork-ledger-6901c3bd55d0ffa60ea9175c87223a3b11501a5b.zip |
Added acprep support for building with Clang
-rwxr-xr-x | acprep | 100 | ||||
-rw-r--r-- | lib/Makefile | 32 |
2 files changed, 81 insertions, 51 deletions
@@ -461,6 +461,9 @@ class PrepareBuild(CommandLineApp): op.add_option('', '--force', action="callback", callback=self.option_force, help="Perform every action, without checking") + op.add_option('', '--clang', action='store_true', + dest='use_clang', default=False, + help='Use the Clang C++ compiler') op.add_option('', '--glibcxx-debug', action='store_true', dest='use_glibcxx_debug', default=False, help='Define _GLIBCXX_DEBUG=1 during compilation') @@ -678,7 +681,8 @@ class PrepareBuild(CommandLineApp): self.log.info("Need to run configure => " + str(self.need_to_run_configure())) self.log.info("Use _GLIBCXX_DEBUG => " + - str(self.options.use_glibcxx_debug)) + str(self.options.use_glibcxx_debug + and not self.options.use_clang)) self.log.info("Use pre-compiled headers => " + str('--enable-pch' in conf_args)) @@ -949,31 +953,44 @@ 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) + if self.options.use_clang: + self.boost_inc_ident = "clang" + self.boost_lib_ident = "29" + + self.log.debug('Using Clang ident: %s/%s' % + (self.boost_inc_ident, self.boost_lib_ident)) else: - gcc_version = "42" + match = re.search('gcc-mp-([0-9]+)\.([0-9]+)', self.envvars['CC']) + if match: + self.boost_inc_ident = "gcc" + match.group(1) + match.group(2) + self.boost_lib_ident = "x" + self.boost_inc_ident + else: + self.boost_inc_ident = "gcc42" + self.boost_lib_ident = "xgcc42" + + self.log.debug('Using Boost ident: %s/%s' % + (self.boost_inc_ident, self.boost_lib_ident)) - if gcc_version != "42": + if self.boost_lib_ident != "xgcc42": self.CPPFLAGS.append('-D_GLIBCXX_FULLY_DYNAMIC_STRING=1') if self.current_flavor == 'debug': - if exists('/usr/local/stow/cppunit-gcc%s/include' % gcc_version): + if exists('/usr/local/stow/cppunit-%s/include' % self.boost_inc_ident): self.sys_include_dirs.insert( - 0, '/usr/local/stow/cppunit-gcc%s/include' % gcc_version) + 0, '/usr/local/stow/cppunit-%s/include' % self.boost_inc_ident) self.sys_library_dirs.insert( - 0, '/usr/local/stow/cppunit-gcc%s/lib' % gcc_version) + 0, '/usr/local/stow/cppunit-%s/lib' % self.boost_inc_ident) - if exists('/usr/local/stow/icu-gcc%s/include' % gcc_version): + if exists('/usr/local/stow/icu-%s/include' % self.boost_inc_ident): self.sys_include_dirs.insert( - 0, '/usr/local/stow/icu-gcc%s/include' % gcc_version) + 0, '/usr/local/stow/icu-%s/include' % self.boost_inc_ident) self.sys_library_dirs.insert( - 0, '/usr/local/stow/icu-gcc%s/lib' % gcc_version) + 0, '/usr/local/stow/icu-%s/lib' % self.boost_inc_ident) self.configure_args.append('--disable-shared') - self.options.use_glibcxx_debug = True + if not self.options.use_clang: + self.options.use_glibcxx_debug = True elif self.current_flavor == 'gcov': self.configure_args.append('--disable-shared') else: @@ -1004,7 +1021,11 @@ class PrepareBuild(CommandLineApp): self.CXXFLAGS.append('-pthread') elif system == 'Darwin': - if (self.current_flavor == 'opt' or \ + if self.options.use_clang: + self.envvars['CC'] = 'clang' + self.envvars['CXX'] = 'clang++' + self.envvars['LD'] = 'llvm-ld' + elif (self.current_flavor == 'opt' or \ self.current_flavor == 'default') and \ not self.options.gcc45 and \ exists('/usr/bin/g++-4.2'): @@ -1014,7 +1035,10 @@ class PrepareBuild(CommandLineApp): self.darwin_gcc = True elif exists('/opt/local/bin/g++-mp-4.5'): self.envvars['CC'] = '/opt/local/bin/gcc-mp-4.5' - self.envvars['CXX'] = '/opt/local/bin/g++-mp-4.5' + if exists('/Users/johnw/bin/gfilt'): + self.envvars['CXX'] = '/Users/johnw/bin/gfilt' + else: + self.envvars['CXX'] = '/opt/local/bin/g++-mp-4.5' self.envvars['LD'] = '/opt/local/bin/g++-mp-4.5' elif exists('/opt/local/bin/g++-mp-4.4'): self.envvars['CC'] = '/opt/local/bin/gcc-mp-4.4' @@ -1106,7 +1130,7 @@ class PrepareBuild(CommandLineApp): self.configure_args.append('--enable-pch') - self.CXXFLAGS.append('-fpch-deps') + self.LDFLAGS.append('-fpch-deps') self.CXXFLAGS.append('-Wconversion') #self.CXXFLAGS.append('-Wold-style-cast') @@ -1152,7 +1176,7 @@ class PrepareBuild(CommandLineApp): self.CXXFLAGS.append('-Woverloaded-virtual') self.CXXFLAGS.append('-Wsign-compare') self.CXXFLAGS.append('-Wsign-promo') - self.CXXFLAGS.append('-Wstrict-null-sentinel') + #self.CXXFLAGS.append('-Wstrict-null-sentinel') self.CXXFLAGS.append('-Wwrite-strings') self.CXXFLAGS.append('-Wno-old-style-cast') self.CXXFLAGS.append('-Wno-deprecated') @@ -1197,32 +1221,24 @@ 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': - if self.options.use_glibcxx_debug: + if self.options.use_glibcxx_debug and not self.options.use_clang: self.log.debug('We are using GLIBCXX_DEBUG, so setting up flags') self.CPPFLAGS.append('-D_GLIBCXX_DEBUG=1') if self.boost_info.configure( - home_path = '/usr/local/stow/boost_%s_0-gcc%s' % \ - (self.boost_version, gcc_version), - suffix = '-xgcc%s-sd-%s' % \ - (gcc_version, self.boost_version), + home_path = '/usr/local/stow/boost_%s_0-%s' % \ + (self.boost_version, self.boost_inc_ident), + suffix = '-%s-sd-%s' % \ + (self.boost_lib_ident, 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, gcc_version), - suffix = '-xgcc%s-d-%s' % \ - (gcc_version, self.boost_version), + home_path = '/usr/local/stow/boost_%s_0-%s' % \ + (self.boost_version, self.boost_inc_ident), + suffix = '-%s-d-%s' % \ + (self.boost_lib_ident, self.boost_version), file_suffix = '.dylib', include_path = 'include/boost-%s' % self.boost_version): pass @@ -1233,18 +1249,18 @@ class PrepareBuild(CommandLineApp): if self.boost_info.configure(): pass elif self.boost_info.configure( - home_path = '/usr/local/stow/boost_%s_0-gcc%s' % \ - (self.boost_version, gcc_version), - suffix = '-xgcc%s-s-%s' % \ - (gcc_version, self.boost_version), + home_path = '/usr/local/stow/boost_%s_0-%s' % \ + (self.boost_version, self.boost_inc_ident), + suffix = '-%s-s-%s' % \ + (self.boost_lib_ident, 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, gcc_version), - suffix = '-xgcc%s-%s' % \ - (gcc_version, self.boost_version), + home_path = '/usr/local/stow/boost_%s_0-%s' % \ + (self.boost_version, self.boost_inc_ident), + suffix = '-%s-%s' % \ + (self.boost_lib_ident, self.boost_version), file_suffix = '.dylib', include_path = 'include/boost-%s' % self.boost_version): pass diff --git a/lib/Makefile b/lib/Makefile index a267e642..f2a8cd14 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -6,26 +6,40 @@ STOW_ROOT = /usr/local/stow PRODUCTS = $(HOME)/Products CC = gcc-mp-4.5 +ifeq ($(CC),clang) +CXX = clang++ +LD = llvm-ld +DIR_SUFFIX = clang +else CXX = g++-mp-4.5 LD = gcc-mp-4.5 -CXX_VERSION = 45 -CPPFLAGS = -D_GLIBCXX_DEBUG=1 -D_GLIBCXX_FULLY_DYNAMIC_STRING=1 +DIR_SUFFIX = gcc45 +endif +CPPFLAGS = -D_GLIBCXX_FULLY_DYNAMIC_STRING=1 +ifneq ($(CC),clang) +CPPFLAGS += -D_GLIBCXX_DEBUG=1 +endif CFLAGS = $(CPPFLAGS) -g LDFLAGS = -g BOOST_VERSION = 1_44_0 BOOST_SOURCE = boost_$(BOOST_VERSION) +BOOST_DEFINES = define=_GLIBCXX_FULLY_DYNAMIC_STRING=1 +ifeq ($(CC),clang) +BOOST_TOOLSET = clang +else BOOST_TOOLSET = darwin -BOOST_DEFINES = define=_GLIBCXX_DEBUG=1 define=_GLIBCXX_FULLY_DYNAMIC_STRING=1 +BOOST_DEFINES = define=_GLIBCXX_DEBUG=1 +endif #BOOST_FLAGS = --architecture=x86 --address_model=32_64 BOOST_FLAGS = --toolset=$(BOOST_TOOLSET) \ --build-type=complete --layout=versioned \ $(BOOST_DEFINES) -BOOST_DIR = boost_$(BOOST_VERSION)-gcc$(CXX_VERSION) +BOOST_DIR = boost_$(BOOST_VERSION)-$(DIR_SUFFIX) BOOST_STOW = $(STOW_ROOT)/$(BOOST_DIR) BOOST_BUILD = $(PRODUCTS)/$(BOOST_DIR) ICU_FLAGS = -sHAVE_ICU=1 -sICU_PATH=$(STOW_ROOT)/icu -BOOST_ICU_DIR = boost_$(BOOST_VERSION)-icu-gcc$(CXX_VERSION) +BOOST_ICU_DIR = boost_$(BOOST_VERSION)-icu-$(DIR_SUFFIX) BOOST_ICU_STOW = $(STOW_ROOT)/$(BOOST_ICU_DIR) BOOST_ICU_BUILD = $(PRODUCTS)/$(BOOST_ICU_DIR) @@ -43,7 +57,7 @@ cppunit-build: CFLAGS="$(CFLAGS)" \ LDFLAGS="$(LDFLAGS)" \ CC="$(CC)" CXX="$(CXX)" LD="$(LD)" \ - --prefix=$(STOW_ROOT)/cppunit-gcc$(CXX_VERSION) \ + --prefix=$(STOW_ROOT)/cppunit-$(DIR_SUFFIX) \ --disable-doxygen --disable-dot && \ make install) @@ -55,7 +69,7 @@ cppunit-build: # LDFLAGS="$(LDFLAGS)" \ # CC="$(CC)" CXX="$(CXX)" LD="$(LD)" \ # --enable-static --enable-debug \ -# --prefix=$(STOW_ROOT)/icu-gcc$(CXX_VERSION) && \ +# --prefix=$(STOW_ROOT)/icu-$(DIR_SUFFIX) && \ # make install) # #boost-icu-build: @@ -66,8 +80,8 @@ cppunit-build: clean: -rm -fr $(BOOST_STOW) $(BOOST_BUILD) -rm -fr $(BOOST_ICU_STOW) $(BOOST_ICU_BUILD) - -rm -fr $(STOW_ROOT)/cppunit-gcc$(CXX_VERSION) - -rm -fr $(STOW_ROOT)/icu-gcc$(CXX_VERSION) + -rm -fr $(STOW_ROOT)/cppunit-$(DIR_SUFFIX) + -rm -fr $(STOW_ROOT)/icu-$(DIR_SUFFIX) -(cd cppunit; make distclean) -(cd icu/source; make distclean) |