diff options
author | Barry Haddow <barry.haddow@gmail.com> | 2012-09-27 01:49:33 +0400 |
---|---|---|
committer | Barry Haddow <barry.haddow@gmail.com> | 2012-09-27 01:49:33 +0400 |
commit | 0a950ee9f4227c8afbbe58d03a854745479ffbc0 (patch) | |
tree | 3e4515adc6b3323f8742ff5addde2f29da2002c8 /jam-files | |
parent | 1ce788e2b83dc9b359f6132e7e82774f9d0777b1 (diff) | |
parent | ab60d1ad6f93a78e80e665bc6c7d32b61b7c1c52 (diff) |
Merge remote branch 'github/master' into miramerge
Compiles, but not tested. Had to disable relent filter. Strangely, it seems to contain the
whole of moses-cmd.
Conflicts:
Jamroot
OnDiskPt/TargetPhrase.cpp
moses-cmd/src/Main.cpp
moses/src/AlignmentInfo.cpp
moses/src/AlignmentInfo.h
moses/src/ChartTranslationOptionCollection.cpp
moses/src/ChartTranslationOptionCollection.h
moses/src/GenerationDictionary.cpp
moses/src/Jamfile
moses/src/Parameter.cpp
moses/src/PhraseDictionary.cpp
moses/src/StaticData.cpp
moses/src/StaticData.h
moses/src/TargetPhrase.h
moses/src/TranslationSystem.cpp
moses/src/TranslationSystem.h
moses/src/Word.cpp
phrase-extract/score.cpp
regression-testing/Jamfile
scripts/ems/experiment.meta
scripts/ems/experiment.perl
scripts/training/train-model.perl
Diffstat (limited to 'jam-files')
-rw-r--r-- | jam-files/fail/Jamroot | 4 | ||||
-rw-r--r-- | jam-files/sanity.jam | 62 |
2 files changed, 54 insertions, 12 deletions
diff --git a/jam-files/fail/Jamroot b/jam-files/fail/Jamroot new file mode 100644 index 000000000..c3584d896 --- /dev/null +++ b/jam-files/fail/Jamroot @@ -0,0 +1,4 @@ +actions fail { + false +} +make fail : : fail ; diff --git a/jam-files/sanity.jam b/jam-files/sanity.jam index c846bec6c..a2616f6bf 100644 --- a/jam-files/sanity.jam +++ b/jam-files/sanity.jam @@ -4,6 +4,7 @@ import os ; import path ; import project ; import build-system ; +import version ; #Shell with trailing line removed http://lists.boost.org/boost-build/2007/08/17051.php rule trim-nl ( str extras * ) { @@ -14,6 +15,13 @@ rule _shell ( cmd : extras * ) { return [ trim-nl [ SHELL $(cmd) : $(extras) ] ] ; } +rule shell_or_fail ( cmd ) { + local ret = [ SHELL $(cmd) : exit-status ] ; + if $(ret[2]) != 0 { + exit $(cmd) failed : 1 ; + } +} + cxxflags = [ os.environ "CXXFLAGS" ] ; cflags = [ os.environ "CFLAGS" ] ; ldflags = [ os.environ "LDFLAGS" ] ; @@ -51,13 +59,25 @@ rule test_library ( name ) { constant CLEANING : $(cleaning) ; } +requirements = ; + +FORCE-STATIC = [ option.get "static" : : "yes" ] ; +if $(FORCE-STATIC) { + requirements += <runtime-link>static ; +} + #Determine if a library can be compiled statically. rule auto-shared ( name : additional * ) { additional ?= "" ; if [ test_flags $(additional)" -static -l"$(name) ] { return ; } else { - return "<link>shared" ; + if $(FORCE-STATIC) { + echo "Could not statically link against lib $(name). Your build will probably fail." ; + return ; + } else { + return "<link>shared" ; + } } } @@ -88,18 +108,16 @@ else { } } -#Are we linking static binaries against shared boost? -boost-auto-shared = [ auto-shared "boost_program_options" : $(L-boost-search) ] ; #Convenience rule for boost libraries. Defines library boost_$(name). rule boost-lib ( name macro : deps * ) { #Link multi-threaded programs against the -mt version if available. Old #versions of boost do not have -mt tagged versions of all libraries. Sadly, #boost.jam does not handle this correctly. - if [ test_flags $(L-boost-search)" -lboost_"$(name)"-mt" ] { - lib inner_boost_$(name) : : <threading>single $(boost-search) <name>boost_$(name) : : <library>$(deps) ; - lib inner_boost_$(name) : : <threading>multi $(boost-search) <name>boost_$(name)-mt : : <library>$(deps) ; + if [ test_flags $(L-boost-search)" -lboost_"$(name)"-mt$(boost-lib-version)" ] { + lib inner_boost_$(name) : : <threading>single $(boost-search) <name>boost_$(name)$(boost-lib-version) : : <library>$(deps) ; + lib inner_boost_$(name) : : <threading>multi $(boost-search) <name>boost_$(name)-mt$(boost-lib-version) : : <library>$(deps) ; } else { - lib inner_boost_$(name) : : $(boost-search) <name>boost_$(name) : : <library>$(deps) ; + lib inner_boost_$(name) : : $(boost-search) <name>boost_$(name)$(boost-lib-version) : : <library>$(deps) ; } alias boost_$(name) : inner_boost_$(name) : $(boost-auto-shared) : : <link>shared:<define>BOOST_$(macro) $(boost-include) ; @@ -107,7 +125,7 @@ rule boost-lib ( name macro : deps * ) { #Argument is e.g. 103600 rule boost ( min-version ) { - local cmd = "bash -c \"g++ "$(I-boost-include)" -dM -x c++ -E /dev/null -include boost/version.hpp 2>/dev/null |grep '#define BOOST_VERSION '\"" ; + local cmd = "bash -c \"g++ "$(I-boost-include)" -dM -x c++ -E /dev/null -include boost/version.hpp 2>/dev/null |grep '#define BOOST_'\"" ; local boost-shell = [ SHELL "$(cmd)" : exit-status ] ; if $(boost-shell[2]) != 0 && $(CLEANING) = no { echo Failed to run "$(cmd)" ; @@ -117,12 +135,24 @@ rule boost ( min-version ) { if $(boost-version) < $(min-version) && $(CLEANING) = no { exit You have Boost $(boost-version). This package requires Boost at least $(min-version) (and preferably newer). : 1 ; } + # If matching version tags exist, use them. + boost-lib-version = [ MATCH "#define BOOST_LIB_VERSION \"([^\"]*)\"" : $(boost-shell[1]) ] ; + if [ test_flags $(L-boost-search)" -lboost_program_options-"$(boost-lib-version) ] { + boost-lib-version = "-"$(boost-lib-version) ; + } else { + boost-lib-version = "" ; + } + + #Are we linking static binaries against shared boost? + boost-auto-shared = [ auto-shared "boost_program_options"$(boost-lib-version) : $(L-boost-search) ] ; + #See tools/build/v2/contrib/boost.jam in a boost distribution for a table of macros to define. boost-lib system SYSTEM_DYN_LINK ; boost-lib thread THREAD_DYN_DLL : boost_system ; boost-lib program_options PROGRAM_OPTIONS_DYN_LINK ; boost-lib unit_test_framework TEST_DYN_LINK ; boost-lib iostreams IOSTREAMS_DYN_LINK ; + boost-lib filesystem FILE_SYSTEM_DYN_LINK : boost_system ; } #Link normally to a library, but sometimes static isn't installed so fall back to dynamic. @@ -148,11 +178,10 @@ rule external-lib ( name : search-path * ) { local ignored = @($(build-log):E=$(script)) ; } -requirements = ; -{ - #Boost jam's static clang for Linux is buggy. - requirements += <cxxflags>$(cxxflags) <cflags>$(cflags) <linkflags>$(ldflags) <os>LINUX,<toolset>clang:<link>shared ; +#Boost jam's static clang for Linux is buggy. +requirements += <cxxflags>$(cxxflags) <cflags>$(cflags) <linkflags>$(ldflags) <os>LINUX,<toolset>clang:<link>shared ; +if ! [ option.get "without-libsegfault" : : "yes" ] && ! $(FORCE-STATIC) { #libSegFault prints a stack trace on segfault. Link against it if available. if [ test_flags "-lSegFault" ] { external-lib SegFault ; @@ -244,3 +273,12 @@ rule always-if-changed ( file current : targets * ) { } } } + +if [ option.get "sanity-test" : : "yes" ] { + local current_version = [ modules.peek : JAM_VERSION ] ; + if ( $(current_version[0]) < 2000 && [ version.check-jam-version 3 1 16 ] ) || [ version.check-jam-version 2011 0 0 ] { + EXIT "Sane" : 0 ; + } else { + EXIT "Bad" : 1 ; + } +} |