diff options
-rw-r--r-- | Jamroot | 51 | ||||
-rw-r--r-- | contrib/server/Jamfile | 2 | ||||
-rw-r--r-- | jam-files/check-environment.jam | 42 | ||||
-rw-r--r-- | jam-files/sanity.jam | 8 | ||||
-rw-r--r-- | moses/Jamfile | 20 |
5 files changed, 78 insertions, 45 deletions
@@ -72,47 +72,38 @@ #--clean to clean #--debug-build to build with Og. Only available with gcc 4.8+ +import os ; import option ; import modules ; import path ; path-constant TOP : . ; + include $(TOP)/jam-files/sanity.jam ; -include $(TOP)/jam-files/server.jam ; -# exit : 0 ; +home = [ os.environ "HOME" ] ; +if [ path.exists $(home)/moses-environment.jam ] +{ include $(home)/moses-environment.jam ; } +include $(TOP)/jam-files/check-environment.jam ; # get resource locations + # from environment variables +include $(TOP)/jam-files/xmlrpc-c.jam ; # xmlrpc-c stuff for the server +include $(TOP)/jam-files/curlpp.jam ; # curlpp stuff for bias lookup (MMT only) + -if [ build_server ] != no +max-order = [ option.get "max-kenlm-order" : 6 : 6 ] ; +if ! [ option.get "max-kenlm-order" ] { - xmlrpc-c-prefix = [ shell_or_die "$(xmlrpc-c-config-cmd) c++2 abyss-server --prefix" ] ; - echo "XMLRPC-C: BUILDING MOSES WITH XMLRPC_C LIBRARY VERSION $(xmlrpc-c-version) FROM $(xmlrpc-c-prefix)" ; - - xmlrpc-cxxflags = [ shell_or_die "$(xmlrpc-c-config-cmd) c++2 abyss-server --cflags" ] ; - requirements += <define>HAVE_XMLRPC_C ; - requirements += <cxxflags>$(xmlrpc-cxxflags) ; - - xmlrpc-linkflags = [ shell_or_die "$(xmlrpc-c-config-cmd) c++2 abyss-server --libs" ] ; - for local i in [ SPLIT_BY_CHARACTERS $(xmlrpc-linkflags) : " " ] - { - local libname = [ MATCH "-l(xmlrpc.*)" : $(i) ] ; - if $(libname) - { - external-lib $(libname) - : : <runtime-link>static:<link>static <runtime-link>shared:<link>shared ; - requirements += <library>$(libname) ; - } - local pathname = [ MATCH "-L(.*)" : $(i) ] ; - if $(pathname) - { - requirements += <library-path>$(pathname) ; - } - } + # some classes in Moses pull in header files from KenLM, so this needs to be + # defined here, not in moses/lm/Jamfile + option.set "max-kenlm-order" : 6 ; + requirements += <define>KENLM_MAX_ORDER=$(max-order) ; } -# echo $(requirements) ; -# exit 0 ; +# exit "all done" : 0 ; + boost 104400 ; external-lib z ; lib dl : : <runtime-link>static:<link>static <runtime-link>shared:<link>shared ; +# lib dl : : <link>static ; requirements += <library>dl ; @@ -139,6 +130,7 @@ if [ option.get "filter-warnings" : : "yes" ] { requirements += <cxxflags>-Wno-unused-but-set-variable ; requirements += <cxxflags>-Wno-unused-result ; requirements += <cxxflags>-Wno-unused-variable ; + requirements += <cxxflags>-Wcomment ; } if [ option.get "debug-build" : : "yes" ] { @@ -307,6 +299,3 @@ if [ path.exists $(TOP)/dist ] && $(prefix) != dist { local temp = [ _shell "mkdir -p $(TOP)/bin" ] ; local temp = [ _shell "rm $(TOP)/bin/moses_chart" ] ; local temp = [ _shell "cd $(TOP)/bin && ln -s moses moses_chart" ] ; - - - diff --git a/contrib/server/Jamfile b/contrib/server/Jamfile index 06624514b..048e540b0 100644 --- a/contrib/server/Jamfile +++ b/contrib/server/Jamfile @@ -11,7 +11,7 @@ else { with-xmlrpc-c = [ option.get "with-xmlrpc-c" ] ; if $(with-xmlrpc-c) { - echo Bulding mosesserver. ; + echo While building mosesserver ... ; echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ; echo "!!! You are linking the XMLRPC-C library; Do NOT use v.1.25.29 !!!" ; echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ; diff --git a/jam-files/check-environment.jam b/jam-files/check-environment.jam new file mode 100644 index 000000000..32866683b --- /dev/null +++ b/jam-files/check-environment.jam @@ -0,0 +1,42 @@ +# get stuff from environment variables if not set on the command line +# unless blocked explicitly +for local what in cmph irstlm +{ + if ! [ option.get "with-$(what)" ] && ! [ option.get "no-$(what)" : : no ] + { + local where = [ os.environ "$(what:U)_ROOT" ] ; + if $(where) + { + echo "setting option with-$(what) from environment variable " + "$(what:U)_ROOT ." ; + option.set "with-$(what)" : $(where) ; + } + } + local where = [ option.get "with-$(what)" ] ; +} + +# if --with-moses-regtest is specified without a directory +local regtest = [ option.get "with-moses-regtest" : no : yes ] ; +if $(regtest) = yes +{ # regtests requested but no path given + echo "Regression tests requested but no path given." ; + local $(where) = [ os.environ "MOSES_REGTEST_ROOT" ] ; + if ! $(where) + { + local HOME = [ os.environ "HOME" ] ; + if [ path.exists $(HOME)/moses-regression-tests ] + { + echo "Using ~/moses-regression-tests as the default." ; + option.set "with-moses-regtest" : "~/moses-regression-tests" ; + } + } + else + { + if [ path.exists $(where) ] + { + echo "Using $(where) from environment variable MOSES_REGTEST_ROOT." + option.set "with-moses-regtest" : $(where) ; + } + } +} + diff --git a/jam-files/sanity.jam b/jam-files/sanity.jam index e991b7eb2..b16343c7b 100644 --- a/jam-files/sanity.jam +++ b/jam-files/sanity.jam @@ -22,6 +22,14 @@ rule shell_or_fail ( cmd ) { } } +rule shell_or_die ( cmd ) { + local ret = [ SHELL $(cmd) : exit-status ] ; + if $(ret[2]) != 0 { + exit $(cmd) failed : 1 ; + } + return [ trim-nl $(ret[1]) ] ; +} + cxxflags = [ os.environ "CXXFLAGS" ] ; cflags = [ os.environ "CFLAGS" ] ; ldflags = [ os.environ "LDFLAGS" ] ; diff --git a/moses/Jamfile b/moses/Jamfile index 822645505..c94750ec6 100644 --- a/moses/Jamfile +++ b/moses/Jamfile @@ -1,3 +1,4 @@ +# -*- jam -*- max-factors = [ option.get "max-factors" : 4 : 4 ] ; path-constant FACTOR-LOG : bin/factor.log ; update-if-changed $(FACTOR-LOG) $(max-factors) ; @@ -58,23 +59,16 @@ obj FF_Factory.o : FF/Factory.cpp LM//macros headers ../lm//kenlm mmlib : <depen # if yes, include server capabilities in the moses executable # include $(TOP)/jam-files/server.jam ; -xmlrpc-c-config = [ build_server ] ; -if $(xmlrpc-c-config) = no +if [ xmlrpc ] { - echo "NOT BUILDING MOSES SERVER!" ; - alias mserver ; - alias xmlrpc-linkflags ; + echo "BUILDING MOSES SERVER!" ; + alias mserver : [ glob server/*.cpp ] ; } else { - xmlprc-version = [ shell_or_die "$(xmlrpc-c-config) --version" ] ; - # xmlprc-linkflags = [ shell_or_die "$(xmlrpc-c-config) --version" ] ; - echo "building moses server with xmlrpc-c version $(xmlrpc-c-version)" ; - alias mserver : [ glob server/*.cpp ] ; -} - - - + echo "NOT BUILDING MOSES SERVER!" ; + alias mserver ; +} if [ option.get "with-mm" : no : yes ] = yes { |