From b64dcf720205f1fe30cc630ec0e61baca7450bb4 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 7 Jun 2012 22:37:38 -0500 Subject: Change self.prefix_dir -> self.options.prefix_dir --- acprep | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'acprep') diff --git a/acprep b/acprep index 1118babe..a9189e32 100755 --- a/acprep +++ b/acprep @@ -390,8 +390,8 @@ class PrepareBuild(CommandLineApp): ######################################################################### def prefix_directory(self): - if self.prefix_dir: - return self.prefix_dir + if self.options.prefix_dir: + return self.options.prefix_dir else: return None @@ -399,7 +399,7 @@ class PrepareBuild(CommandLineApp): return join(os.environ['HOME'], "Products") def products_directory(self): - if not self.products_dir: + if not self.options.products_dir: products = self.default_products_directory() if not exists(products) or not isdir(products): @@ -407,15 +407,15 @@ class PrepareBuild(CommandLineApp): products = join(products, basename(self.source_dir)) - self.products_dir = products + self.options.products_dir = products - return self.products_dir + return self.options.products_dir def build_directory(self): - if not self.build_dir: - self.build_dir = join(self.products_directory(), - self.current_flavor) - return self.build_dir + if not self.options.build_dir: + self.options.build_dir = join(self.products_directory(), + self.current_flavor) + return self.optionsbuild_dir def ensure(self, dirname): if not exists(dirname): -- cgit v1.2.3 From 571d711523508168406d8e3b83dcfefd2d82dfde Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 8 Jun 2012 15:06:11 -0500 Subject: Was missing a period --- acprep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'acprep') diff --git a/acprep b/acprep index a9189e32..4e715ee7 100755 --- a/acprep +++ b/acprep @@ -415,7 +415,7 @@ class PrepareBuild(CommandLineApp): if not self.options.build_dir: self.options.build_dir = join(self.products_directory(), self.current_flavor) - return self.optionsbuild_dir + return self.options.build_dir def ensure(self, dirname): if not exists(dirname): -- cgit v1.2.3 From 2720f7952242e3e4b27092bc53e22c4c9d0ec9c2 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 11 Jun 2012 18:57:17 -0500 Subject: Fix reference to self.options.products_dir --- acprep | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'acprep') diff --git a/acprep b/acprep index 4e715ee7..d5cbcddc 100755 --- a/acprep +++ b/acprep @@ -399,7 +399,7 @@ class PrepareBuild(CommandLineApp): return join(os.environ['HOME'], "Products") def products_directory(self): - if not self.options.products_dir: + if not self.products_dir: products = self.default_products_directory() if not exists(products) or not isdir(products): @@ -407,9 +407,9 @@ class PrepareBuild(CommandLineApp): products = join(products, basename(self.source_dir)) - self.options.products_dir = products + self.products_dir = products - return self.options.products_dir + return self.products_dir def build_directory(self): if not self.options.build_dir: -- cgit v1.2.3 From 14ab4f7775fe203e6e5cd2b9cb4d364c465c4e4e Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 30 Jul 2012 23:22:42 -0500 Subject: Updated to Boost 1.50 --- CMakeLists.txt | 1 + acprep | 11 +++++++---- lib/Makefile | 4 ++-- lib/build.sh | 6 +++--- tools/build.sh | 17 ++++++++++------- 5 files changed, 23 insertions(+), 16 deletions(-) (limited to 'acprep') diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b6f2498..487fe429 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,7 @@ else() set(HAVE_BOOST_PYTHON 0) endif() +# Set BOOST_ROOT to help CMake to find the right Boost version find_package(Boost 1.46.0 REQUIRED date_time filesystem system iostreams regex unit_test_framework ${BOOST_PYTHON}) diff --git a/acprep b/acprep index d5cbcddc..1c05596f 100755 --- a/acprep +++ b/acprep @@ -99,7 +99,7 @@ class CommandLineApp(object): force_exit = True # If true, always ends run() with sys.exit() log_handler = None - boost_major = "1_49" + boost_major = "1_50" options = { 'debug': False, @@ -674,14 +674,17 @@ class PrepareBuild(CommandLineApp): self.CXXFLAGS.append('-Wno-disabled-macro-expansion') if self.current_flavor == 'opt': - self.configure_args.append('-DCMAKE_CXX_FLAGS:STRING=-O4') - self.configure_args.append('-DCMAKE_CXX_LINK_FLAGS:STRING=-O4') + self.configure_args.append('-DCMAKE_CXX_FLAGS_RELEASE:STRING=-O4') + self.configure_args.append('-DCMAKE_CXX_LINK_FLAGS_RELEASE:STRING=-O4') + #else: + # self.CXXFLAGS.append('-g -O1 -faddress-sanitizer') + # self.LDFLAGS.append('-g -O1 -faddress-sanitizer') self.configure_args.append('-DCMAKE_INCLUDE_PATH:STRING=/usr/local/include;/opt/local/include') self.configure_args.append('-DCMAKE_LIBRARY_PATH:STRING=/usr/local/lib;/opt/local/lib') self.configure_args.append('-DBOOST_ROOT=/usr/local') - self.configure_args.append('-DBOOST_INCLUDEDIR=/usr/local/include/boost-1_49') + self.configure_args.append('-DBOOST_INCLUDEDIR=/usr/local/include/boost-1_50') self.configure_args.append('-DBoost_COMPILER=-clang-darwin') self.configure_args.append(self.source_dir) diff --git a/lib/Makefile b/lib/Makefile index cb05e44d..92ec38ce 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -6,7 +6,7 @@ STOW_ROOT = /usr/local/stow PRODUCTS = $(HOME)/Products GCC_VERSION = 4.7 -BOOST_VERSION = 1_49_0 +BOOST_VERSION = 1_50_0 CC = gcc-mp-$(GCC_VERSION) ifeq ($(CC),clang) @@ -27,7 +27,7 @@ BOOST_SOURCE = boost-release ifeq ($(GCC_VERSION),4.7) BOOST_DEFINES = define=_GLIBCXX__PTHREADS=1 else -BOOST_DEFINES = +BOOST_DEFINES = endif ifeq ($(CC),clang) BOOST_TOOLSET = clang diff --git a/lib/build.sh b/lib/build.sh index 28408d73..4fadccfa 100755 --- a/lib/build.sh +++ b/lib/build.sh @@ -7,11 +7,11 @@ export PATH=$PATH:/opt/local/lib/openmpi/bin cat > ~/user-config.jam <-std=c++11 /usr/local/include ; +using clang-darwin : : "/usr/local/bin/clang++" : -std=c++11 ; EOF # jww (2012-04-24): This is still linking against /usr/lib/libc++.1.dylib # instead of /usr/local/lib/libc++.1.dylib -make CXX=clang++ LD=clang++ CC=clang OPTJ=-j20 \ +make CXX=clang++ LD=clang++ CC=clang OPTJ=-j20 \ BOOST_TOOLSET=clang-darwin DIR_SUFFIX=clang31 \ - BOOST_DEFINES="-sICU_PATH=/usr/local cxxflags=\"-g -std=c++11 -nostdlibinc -I/usr/local/include -I/usr/local/include/c++/v1 -I/opt/local/include -I/usr/include -stdlib=libc++\" linkflags=\"-g -Z -L/usr/local/lib -L/opt/local/lib -L/usr/lib /usr/local/lib/libc++.dylib -stdlib=libc++\"" + BOOST_DEFINES="-sHAVE_ICONV=1 -sICONV_PATH=/usr/local -sHAVE_ICU=1 -sICU_PATH=/usr/local cxxflags=\"-g -std=c++11 $* -nostdlibinc -isystem /usr/local/include -isystem /opt/local/include -isystem /usr/local/include/c++/v1 -isystem /usr/include -stdlib=libc++\" linkflags=\"-g $* -L/usr/local/lib -L/opt/local/lib -L/usr/lib /usr/local/lib/libc++.dylib -stdlib=libc++\"" diff --git a/tools/build.sh b/tools/build.sh index 185fe791..a37b06f4 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -3,10 +3,13 @@ flavor=$1 shift 1 -time ( \ - cd ~/src/ledger ; \ - PATH=/usr/local/bin:/opt/local/bin:$PATH \ - nice -n 20 ./acprep $flavor --debug --python --doxygen make "$@" && \ - PATH=/usr/local/bin:/opt/local/bin:$PATH \ - nice -n 20 ./acprep $flavor --debug --python --doxygen check "$@" \ -) \ No newline at end of file +JOBS=-j$(sysctl -n hw.activecpu) +OPTIONS="$flavor --debug --python --doxygen $JOBS" + +time ( \ + cd ~/src/ledger ; \ + PATH=/usr/local/bin:/opt/local/bin:$PATH \ + nice -n 20 ./acprep $OPTIONS make "$@" && \ + PATH=/usr/local/bin:/opt/local/bin:$PATH \ + nice -n 20 ./acprep $OPTIONS check "$@" \ +) -- cgit v1.2.3 From 5b916dae6c7cac78bb4a2100d814470fb7cd5649 Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Thu, 6 Sep 2012 19:25:09 -0400 Subject: Correct cmake variable for install prefix is "CMAKE_INSTALL_PREFIX", not "CMAKE_PREFIX_PATH". CMAKE_PREFIX_PATH is for searching for other programs, not for the place to install this one. Based on acprep's --help, I think the intention was to use CMAKE_INSTALL_PREFIX here. --- acprep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'acprep') diff --git a/acprep b/acprep index 1c05596f..83ff4ab2 100755 --- a/acprep +++ b/acprep @@ -847,7 +847,7 @@ class PrepareBuild(CommandLineApp): self.options.boost_include) if self.prefix_directory(): - conf_args.append('-DCMAKE_PREFIX_PATH=%s' % self.prefix_directory()) + conf_args.append('-DCMAKE_INSTALL_PREFIX=%s' % self.prefix_directory()) return (environ, conf_args + self.configure_args) -- cgit v1.2.3 From 7c288b956d02f7a5157970876697b76fe66aaeae Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 21 Sep 2012 15:12:38 -0500 Subject: Changes for CMake --- acprep | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'acprep') diff --git a/acprep b/acprep index 83ff4ab2..c35d09db 100755 --- a/acprep +++ b/acprep @@ -657,11 +657,12 @@ class PrepareBuild(CommandLineApp): ######################################################################### def setup_for_johnw(self): + self.configure_args.append('-GNinja') self.configure_args.append('-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON') self.configure_args.append('-DBoost_USE_MULTITHREADED:BOOL=OFF') if not self.options.compiler: - self.configure_args.append('-DCMAKE_CXX_COMPILER:PATH=/usr/local/stow/clang-3.1/bin/clang++') + self.configure_args.append('-DCMAKE_CXX_COMPILER:PATH=/usr/local/bin/clang++') self.CXXFLAGS.append('-Qunused-arguments') self.CXXFLAGS.append('-nostdlibinc') @@ -910,7 +911,6 @@ class PrepareBuild(CommandLineApp): if self.options.jobs > 1 and self.current_flavor != 'gcov': make_args.append('-j%d' % self.options.jobs) - make_args.append('ARGS=-j%d' % self.options.jobs) if self.options.verbose: make_args.append('VERBOSE=1') @@ -932,12 +932,11 @@ class PrepareBuild(CommandLineApp): def phase_check(self, *args): self.log.info('Executing phase: update') - self.phase_make(*(['check'] + list(args))) + self.execute(*(['ctest'] + make_args)) def phase_update(self, *args): self.log.info('Executing phase: update') self.phase_pull() - #self.phase_check(*args) self.phase_make(*args) ######################################################################### -- cgit v1.2.3 From 300cefd1a78ebeddb139a32fa7e1478a3f4225b4 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 26 Sep 2012 12:25:26 -0500 Subject: Changes to support using homebrew and ninja --- acprep | 50 ++++++++++++++++---------------------------------- lib/Makefile | 34 +++------------------------------- lib/build.sh | 4 ++-- tools/build.sh | 12 ++++++------ 4 files changed, 27 insertions(+), 73 deletions(-) (limited to 'acprep') diff --git a/acprep b/acprep index c35d09db..25f565f3 100755 --- a/acprep +++ b/acprep @@ -659,21 +659,10 @@ class PrepareBuild(CommandLineApp): def setup_for_johnw(self): self.configure_args.append('-GNinja') self.configure_args.append('-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON') - self.configure_args.append('-DBoost_USE_MULTITHREADED:BOOL=OFF') if not self.options.compiler: self.configure_args.append('-DCMAKE_CXX_COMPILER:PATH=/usr/local/bin/clang++') - self.CXXFLAGS.append('-Qunused-arguments') - self.CXXFLAGS.append('-nostdlibinc') - self.CXXFLAGS.append('-isystem') - self.CXXFLAGS.append('/usr/local/include/c++/v1') - self.CXXFLAGS.append('-isystem') - self.CXXFLAGS.append('/usr/include') - self.CXXFLAGS.append('-stdlib=libc++') - self.CXXFLAGS.append('-Wl,/usr/local/lib/libc++.dylib') - self.CXXFLAGS.append('-Wno-disabled-macro-expansion') - if self.current_flavor == 'opt': self.configure_args.append('-DCMAKE_CXX_FLAGS_RELEASE:STRING=-O4') self.configure_args.append('-DCMAKE_CXX_LINK_FLAGS_RELEASE:STRING=-O4') @@ -681,31 +670,13 @@ class PrepareBuild(CommandLineApp): # self.CXXFLAGS.append('-g -O1 -faddress-sanitizer') # self.LDFLAGS.append('-g -O1 -faddress-sanitizer') - self.configure_args.append('-DCMAKE_INCLUDE_PATH:STRING=/usr/local/include;/opt/local/include') - self.configure_args.append('-DCMAKE_LIBRARY_PATH:STRING=/usr/local/lib;/opt/local/lib') - - self.configure_args.append('-DBOOST_ROOT=/usr/local') - self.configure_args.append('-DBOOST_INCLUDEDIR=/usr/local/include/boost-1_50') - self.configure_args.append('-DBoost_COMPILER=-clang-darwin') - - self.configure_args.append(self.source_dir) - - elif self.options.compiler == "icc": - self.configure_args.append('-DCMAKE_AR:PATH=/opt/intel/bin/xiar') - self.configure_args.append('-DCMAKE_CXX_COMPILER:PATH=/opt/intel/bin/icc') - if self.current_flavor == 'opt': - self.configure_args.append('-DCMAKE_CXX_FLAGS:STRING=-fast') - self.configure_args.append('-DCMAKE_CXX_LINK_FLAGS:STRING=-fast') - self.configure_args.append('-DCMAKE_INCLUDE_PATH:STRING=/opt/local/include') - self.configure_args.append('-DCMAKE_LIBRARY_PATH:STRING=/opt/local/lib') - self.configure_args.append('-DBOOST_ROOT=/opt/local') self.configure_args.append(self.source_dir) else: self.configure_args.append('-DCMAKE_CXX_COMPILER:PATH=' + self.options.compiler) - self.configure_args.append('-DCMAKE_INCLUDE_PATH:STRING=/opt/local/include') - self.configure_args.append('-DCMAKE_LIBRARY_PATH:STRING=/opt/local/lib') - self.configure_args.append('-DBOOST_ROOT=/opt/local') + self.configure_args.append('-DCMAKE_INCLUDE_PATH:STRING=/usr/local/include') + self.configure_args.append('-DCMAKE_LIBRARY_PATH:STRING=/usr/local/lib') + self.configure_args.append('-DBOOST_ROOT=/usr/local') self.configure_args.append(self.source_dir) def setup_for_system(self): @@ -926,13 +897,24 @@ class PrepareBuild(CommandLineApp): self.log.debug('Changing directory to ' + build_dir) os.chdir(build_dir) - self.execute(*(['make'] + make_args)) + self.execute(*(['ninja'] + make_args)) finally: os.chdir(self.source_dir) def phase_check(self, *args): self.log.info('Executing phase: update') - self.execute(*(['ctest'] + make_args)) + build_dir = self.ensure(self.build_directory()) + try: + self.log.debug('Changing directory to ' + build_dir) + os.chdir(build_dir) + + make_args = list(args) + if self.options.jobs > 1: + make_args.append('-j%d' % self.options.jobs) + + self.execute(*(['ctest'] + list(make_args))) + finally: + os.chdir(self.source_dir) def phase_update(self, *args): self.log.info('Executing phase: update') diff --git a/lib/Makefile b/lib/Makefile index 92ec38ce..68755f18 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -2,7 +2,7 @@ # This is only important if you intend to produce a Ledger binary for # installation. -STOW_ROOT = /usr/local/stow +STOW_ROOT = /usr/local/Cellar/boost PRODUCTS = $(HOME)/Products GCC_VERSION = 4.7 @@ -37,14 +37,10 @@ endif BOOST_FLAGS = toolset=$(BOOST_TOOLSET) --layout=versioned \ link=shared threading=single $(BOOST_DEFINES) BOOST_DIR = boost_$(BOOST_VERSION)-$(DIR_SUFFIX) -BOOST_STOW = $(STOW_ROOT)/$(BOOST_DIR) +BOOST_STOW = $(STOW_ROOT)/$(BOOST_VERSION) BOOST_BUILD = $(PRODUCTS)/$(BOOST_DIR) -ICU_FLAGS = -sHAVE_ICU=1 -sICU_PATH=$(STOW_ROOT)/icu-$(DIR_SUFFIX) -BOOST_ICU_DIR = boost_$(BOOST_VERSION)-icu-$(DIR_SUFFIX) -BOOST_ICU_STOW = $(STOW_ROOT)/$(BOOST_ICU_DIR) -BOOST_ICU_BUILD = $(PRODUCTS)/$(BOOST_ICU_DIR) -all: boost-build #icu-build boost-icu-build +all: boost-build prepare-boost: perl -i -pe 's/local command = \[ common\.get-invocation-command darwin : g\+\+ : .*/local command = [ common.get-invocation-command darwin : g++ : $(CXX) ] ;/;' $(BOOST_SOURCE)/tools/build/v2/tools/darwin.jam @@ -56,29 +52,5 @@ boost-build: prepare-boost ./b2 $(OPTJ) debug release --prefix=$(BOOST_STOW) \ --build-dir=$(BOOST_BUILD) $(BOOST_FLAGS) install) -icu-build: - -(cd icu/source; make distclean) - (cd icu/source; sh autogen.sh; \ - ./configure CPPFLAGS="$(CPPFLAGS)" \ - CFLAGS="$(CFLAGS)" \ - LDFLAGS="$(LDFLAGS)" \ - CC="$(CC)" CXX="$(CXX)" LD="$(LD)" \ - --enable-static --enable-debug \ - --prefix=$(STOW_ROOT)/icu-$(DIR_SUFFIX) && \ - make install) - -boost-icu-build: - (cd $(BOOST_SOURCE) && \ - sh bootstrap.sh && \ - ./bjam $(OPTJ) debug --prefix=$(BOOST_ICU_STOW) \ - --build-dir=$(BOOST_ICU_BUILD) \ - $(BOOST_FLAGS) $(ICU_FLAGS) install) - clean: -rm -fr $(BOOST_STOW) $(BOOST_BUILD) - -rm -fr $(BOOST_ICU_STOW) $(BOOST_ICU_BUILD) - -rm -fr $(STOW_ROOT)/icu-$(DIR_SUFFIX) - -(cd icu/source; make distclean) - -lib-clean: - -(cd icu/source; make distclean) diff --git a/lib/build.sh b/lib/build.sh index 4fadccfa..4f3f2e7f 100755 --- a/lib/build.sh +++ b/lib/build.sh @@ -4,7 +4,7 @@ # clang-3.1 from MacPorts. I build my own Boost instead of using MacPorts' # Boost in order to get better debugging support, and to link with libc++. -export PATH=$PATH:/opt/local/lib/openmpi/bin +#export PATH=$PATH:/opt/local/lib/openmpi/bin cat > ~/user-config.jam <-std=c++11 ; @@ -14,4 +14,4 @@ EOF # instead of /usr/local/lib/libc++.1.dylib make CXX=clang++ LD=clang++ CC=clang OPTJ=-j20 \ BOOST_TOOLSET=clang-darwin DIR_SUFFIX=clang31 \ - BOOST_DEFINES="-sHAVE_ICONV=1 -sICONV_PATH=/usr/local -sHAVE_ICU=1 -sICU_PATH=/usr/local cxxflags=\"-g -std=c++11 $* -nostdlibinc -isystem /usr/local/include -isystem /opt/local/include -isystem /usr/local/include/c++/v1 -isystem /usr/include -stdlib=libc++\" linkflags=\"-g $* -L/usr/local/lib -L/opt/local/lib -L/usr/lib /usr/local/lib/libc++.dylib -stdlib=libc++\"" + BOOST_DEFINES="-sHAVE_ICONV=1 -sHAVE_ICU=1 -sICU_PATH=/usr/local/opt/icu4c cxxflags=\"-g -std=c++11 $* -nostdlibinc -isystem /usr/local/include -isystem /usr/local/include/c++/v1 -isystem /usr/include -stdlib=libc++\" linkflags=\"-g $* -L/usr/local/lib -L/usr/lib /usr/local/lib/libc++.dylib -stdlib=libc++\"" diff --git a/tools/build.sh b/tools/build.sh index a37b06f4..2abf70b8 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -6,10 +6,10 @@ shift 1 JOBS=-j$(sysctl -n hw.activecpu) OPTIONS="$flavor --debug --python --doxygen $JOBS" -time ( \ - cd ~/src/ledger ; \ - PATH=/usr/local/bin:/opt/local/bin:$PATH \ - nice -n 20 ./acprep $OPTIONS make "$@" && \ - PATH=/usr/local/bin:/opt/local/bin:$PATH \ - nice -n 20 ./acprep $OPTIONS check "$@" \ +time ( \ + cd ~/src/ledger ; \ + PATH=/usr/local/bin:/opt/local/bin:$PATH \ + nice -n 20 ./acprep $OPTIONS make $JOBS "$@" && \ + PATH=/usr/local/bin:/opt/local/bin:$PATH \ + nice -n 20 ./acprep $OPTIONS check $JOBS "$@" \ ) -- cgit v1.2.3 From a9bd40a1e3959c35f5c72e70825594675b23446c Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 27 Sep 2012 17:40:17 -0500 Subject: Don't use the ninja build command by default --- acprep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'acprep') diff --git a/acprep b/acprep index 25f565f3..ebf776db 100755 --- a/acprep +++ b/acprep @@ -897,7 +897,7 @@ class PrepareBuild(CommandLineApp): self.log.debug('Changing directory to ' + build_dir) os.chdir(build_dir) - self.execute(*(['ninja'] + make_args)) + self.execute(*(['make'] + make_args)) finally: os.chdir(self.source_dir) -- cgit v1.2.3 From dcd64a67823b2f53cc2e28fe74d5ab2cbcf4e60c Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 27 Sep 2012 17:42:43 -0500 Subject: Added -N/--ninja option to acprep --- acprep | 10 ++++++++-- tools/build.sh | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'acprep') diff --git a/acprep b/acprep index ebf776db..26f8d8b2 100755 --- a/acprep +++ b/acprep @@ -300,6 +300,9 @@ class PrepareBuild(CommandLineApp): action="store", dest="compiler", help='Use the Clang C++ compiler') + op.add_option('-N', '--ninja', action='store_true', dest='use_ninja', + default=False, + help='Use ninja to build, rather than make') op.add_option('', '--no-git', action='store_true', dest='no_git', default=False, help='Do not call out to Git; useful for offline builds') @@ -657,7 +660,6 @@ class PrepareBuild(CommandLineApp): ######################################################################### def setup_for_johnw(self): - self.configure_args.append('-GNinja') self.configure_args.append('-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON') if not self.options.compiler: @@ -690,6 +692,9 @@ class PrepareBuild(CommandLineApp): if self.options.no_python: self.configure_args.remove('-DUSE_PYTHON=1') + if self.options.use_ninja: + self.configure_args.append('-GNinja') + if exists('/Users/johnw/Projects/ledger/plan/TODO'): self.setup_for_johnw() @@ -897,7 +902,8 @@ class PrepareBuild(CommandLineApp): self.log.debug('Changing directory to ' + build_dir) os.chdir(build_dir) - self.execute(*(['make'] + make_args)) + self.execute(*(['ninja' if self.options.use_ninja else 'make'] + + make_args)) finally: os.chdir(self.source_dir) diff --git a/tools/build.sh b/tools/build.sh index 2abf70b8..e79689e3 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -4,7 +4,7 @@ flavor=$1 shift 1 JOBS=-j$(sysctl -n hw.activecpu) -OPTIONS="$flavor --debug --python --doxygen $JOBS" +OPTIONS="$flavor --debug --python --ninja --doxygen $JOBS" time ( \ cd ~/src/ledger ; \ -- cgit v1.2.3 From 5ee03de0ad8c2df38bc10acf67f02cf862c6c83c Mon Sep 17 00:00:00 2001 From: Johann Klähn Date: Wed, 30 Jan 2013 01:04:29 +0100 Subject: fix option handling in acprep Both the `--local` option and the default to build local if no build directory exists did not work, because `build_directory()` uses `self.options.build_dir`, but the default and the `--local` option used `self.build_dir`. I changed the code to always use `self.options` for options/flags. Now `self.options` is set to the default values of OptParser and is updated when `parse_args` is called in `run`. After this commit ledger will be built in: * The directory specified using `--output=` * Else in a subdirectory of `./build` or `~/Products` if one of those directories exist and `--local` is not used. * Else inside the source tree (default). --- acprep | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) (limited to 'acprep') diff --git a/acprep b/acprep index 26f8d8b2..6330a7f8 100755 --- a/acprep +++ b/acprep @@ -101,13 +101,6 @@ class CommandLineApp(object): log_handler = None boost_major = "1_50" - options = { - 'debug': False, - 'verbose': False, - 'logfile': False, - 'loglevel': False - } - def __init__(self): "Initialize CommandLineApp." # Create the logger @@ -137,7 +130,8 @@ class CommandLineApp(object): op.add_option('', '--loglevel', metavar='LEVEL', type='string', action='store', dest='loglevel', default=False, help='set log level: DEBUG, INFO, WARNING, ERROR, CRITICAL') - return + + self.options = op.get_default_values() def main(self, *args): """Main body of your application. @@ -167,7 +161,7 @@ class CommandLineApp(object): Process options and execute callback functions as needed. This method should not need to be overridden, if the main() method is defined.""" # Process the options supported and given - self.options, main_args = self.option_parser.parse_args() + self.options, main_args = self.option_parser.parse_args(values=self.options) if self.options.logfile: fh = logging.handlers.RotatingFileHandler(self.options.logfile, @@ -238,9 +232,7 @@ class PrepareBuild(CommandLineApp): self.current_ver = None #self.current_flavor = 'default' self.current_flavor = 'debug' - self.prefix_dir = None self.products_dir = None - self.build_dir = self.source_dir self.configure_args = [] self.CXXFLAGS = [] self.LDFLAGS = [] @@ -264,7 +256,7 @@ class PrepareBuild(CommandLineApp): products = self.default_products_directory() if (exists(products) and isdir(products)) or \ (exists('build') and isdir('build')): - self.build_dir = None + self.options.build_dir = None def __init__(self): CommandLineApp.__init__(self) @@ -272,8 +264,6 @@ class PrepareBuild(CommandLineApp): self.source_dir = os.getcwd() - self.initialize() - op = self.option_parser op.add_option('', '--help', action="callback", @@ -321,11 +311,16 @@ class PrepareBuild(CommandLineApp): dest="option_products", help='Collect all build products in this directory') op.add_option('', '--output', metavar='DIR', action="store", + default=self.source_dir, dest="build_dir", help='Build in the specified directory') op.add_option('', '--local', action="callback", callback=self.option_local, help='Build directly within the source tree (default)') + self.options = op.get_default_values() + + self.initialize() + def main(self, *args): if args and args[0] in ['default', 'debug', 'opt', 'gcov', 'gprof']: self.current_flavor = args[0] @@ -740,7 +735,7 @@ class PrepareBuild(CommandLineApp): def option_local(self, option=None, opt_str=None, value=None, parser=None): self.log.debug('Saw option --local') - self.build_dir = self.source_dir + self.options.build_dir = self.source_dir def option_help(self, option=None, opt_str=None, value=None, parser=None): self.phase_help() @@ -841,7 +836,7 @@ class PrepareBuild(CommandLineApp): try: os.chdir(build_dir) - need_to_config = not isfile('Makefile') + need_to_config = not isfile('rules.ninja' if self.options.use_ninja else 'Makefile') if need_to_config: self.log.debug('Source => ' + self.source_dir) self.log.debug('Build => ' + build_dir) @@ -945,10 +940,10 @@ class PrepareBuild(CommandLineApp): ######################################################################### def configure_flavor(self, flavor, reset=True): - self.initialize() # reset everything - self.build_dir = None # use the build/ tree + self.initialize() # reset everything self.current_flavor = flavor - self.prefix_dir = None + self.options.build_dir = None # use the build/ tree + self.options.prefix_dir = None if reset and exists(self.build_directory()) and \ isdir(self.build_directory()): -- cgit v1.2.3 From 9e3652dd4fc4bea3453b5b79f9a687501a63cb90 Mon Sep 17 00:00:00 2001 From: Johann Klähn Date: Wed, 30 Jan 2013 23:31:39 +0100 Subject: acprep: pass options starting with -D to CMake --- acprep | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'acprep') diff --git a/acprep b/acprep index 6330a7f8..fe49be47 100755 --- a/acprep +++ b/acprep @@ -875,7 +875,7 @@ class PrepareBuild(CommandLineApp): make_args = [] for arg in args: - if arg.startswith('--'): + if arg.startswith('--') or arg.startswith('-D'): config_args.append(arg) else: make_args.append(arg) @@ -1068,12 +1068,17 @@ typical user: submodule Updates Git submodules (better to use 'pull') version Output current HEAD version to version.m4 -NOTE: If you wish to pass options to configure or make, add "--" followed by -your options. Here are some real-world examples: +NOTE: If you wish to pass options to CMake or make, add "--" followed by +your options. Those starting with "-D" or "--" will be passed on to CMake, +positional arguments and other options will be passed to make. +For the 'config' and 'configure' phase everything will be passed to CMake. + +Here are some real-world examples: ./acprep - ./acprep opt -- make -j3 - ./acprep --enable-doxygen""" + ./acprep --python + ./acprep opt make + ./acprep make doc -- -DBUILD_WEB_DOCS=1""" sys.exit(0) PrepareBuild().run() -- cgit v1.2.3 From 20217e7c9c990039a264b94637bba6b2caffe885 Mon Sep 17 00:00:00 2001 From: Johann Klähn Date: Wed, 30 Jan 2013 23:37:37 +0100 Subject: fix --no-python option This would fail with `ValueError: list.remove(x): x not in list`. --- acprep | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'acprep') diff --git a/acprep b/acprep index fe49be47..ca718136 100755 --- a/acprep +++ b/acprep @@ -301,10 +301,9 @@ class PrepareBuild(CommandLineApp): help='Enable use of Doxygen to build ref manual ("make docs")') op.add_option('', '--python', action='store_true', dest='python', default=False, - help='Enable Python support (if disabled in acprep)') - op.add_option('', '--no-python', action='store_true', dest='no_python', - default=False, - help='Do not enable Python support by default') + help='Enable Python support') + op.add_option('', '--no-python', action='store_false', dest='python', + help='Disable python support (default)') op.add_option('', '--prefix', metavar='DIR', action="store", dest="prefix_dir", help='Use custom installation prefix') op.add_option('', '--products', metavar='DIR', action="store", @@ -684,8 +683,6 @@ class PrepareBuild(CommandLineApp): self.configure_args.append('-DUSE_DOXYGEN=1') if self.options.python: self.configure_args.append('-DUSE_PYTHON=1') - if self.options.no_python: - self.configure_args.remove('-DUSE_PYTHON=1') if self.options.use_ninja: self.configure_args.append('-GNinja') -- cgit v1.2.3 From be7af24250260c52668ffa27b93c8a45f68b58d5 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 30 Jan 2013 16:59:42 -0600 Subject: Upgrade to Boost 1.52 --- acprep | 2 +- lib/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'acprep') diff --git a/acprep b/acprep index 26f8d8b2..b83d1f19 100755 --- a/acprep +++ b/acprep @@ -99,7 +99,7 @@ class CommandLineApp(object): force_exit = True # If true, always ends run() with sys.exit() log_handler = None - boost_major = "1_50" + boost_major = "1_52" options = { 'debug': False, diff --git a/lib/Makefile b/lib/Makefile index 68755f18..ddbe0585 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -6,7 +6,7 @@ STOW_ROOT = /usr/local/Cellar/boost PRODUCTS = $(HOME)/Products GCC_VERSION = 4.7 -BOOST_VERSION = 1_50_0 +BOOST_VERSION = 1_52_0 CC = gcc-mp-$(GCC_VERSION) ifeq ($(CC),clang) -- cgit v1.2.3 From ccca974dadc9c57805aeb47565eecd4e25c9d368 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 30 Jan 2013 17:00:22 -0600 Subject: Use -O3 with Clang instead of -O4 --- acprep | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'acprep') diff --git a/acprep b/acprep index b83d1f19..36481f4a 100755 --- a/acprep +++ b/acprep @@ -666,8 +666,10 @@ class PrepareBuild(CommandLineApp): self.configure_args.append('-DCMAKE_CXX_COMPILER:PATH=/usr/local/bin/clang++') if self.current_flavor == 'opt': - self.configure_args.append('-DCMAKE_CXX_FLAGS_RELEASE:STRING=-O4') - self.configure_args.append('-DCMAKE_CXX_LINK_FLAGS_RELEASE:STRING=-O4') + self.configure_args.append('-DCMAKE_CXX_FLAGS_RELEASE:STRING=-O3') + self.configure_args.append('-DCMAKE_EXE_LINKER_FLAGS:STRING=-O3') + self.configure_args.append('-DCMAKE_SHARED_LINKER_FLAGS:STRING=-O3') + self.configure_args.append('-DCMAKE_MODULE_LINKER_FLAGS:STRING=-O3') #else: # self.CXXFLAGS.append('-g -O1 -faddress-sanitizer') # self.LDFLAGS.append('-g -O1 -faddress-sanitizer') -- cgit v1.2.3