Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Germann <ugermann@inf.ed.ac.uk>2015-03-20 21:51:49 +0300
committerUlrich Germann <ugermann@inf.ed.ac.uk>2015-03-20 21:51:49 +0300
commitb1c9d8a5284ec505a112df52281639ff044830dd (patch)
treec9e3a3444c06760e67e32bc91fb0fca5c329f895
parente40fbbc2cb3259087d1e9cae64c5fc2bb2ab58f1 (diff)
Bjam is the most awful build system in the world.
-rw-r--r--Jamroot55
-rw-r--r--contrib/server/Jamfile15
-rw-r--r--jam-files/server.jam97
-rw-r--r--moses/Jamfile54
4 files changed, 143 insertions, 78 deletions
diff --git a/Jamroot b/Jamroot
index b58ba9211..b0d67f8c9 100644
--- a/Jamroot
+++ b/Jamroot
@@ -77,11 +77,31 @@ import modules ;
import path ;
path-constant TOP : . ;
include $(TOP)/jam-files/sanity.jam ;
-
-# check if we have xmlrpc-c's abyss server available
-# if yes, include server capabilities in the moses executable
include $(TOP)/jam-files/server.jam ;
+# exit : 0 ;
+
+if [ build_server ] != no
+{
+ echo "XMLRPC-C: BUILDING MOSES WITH XMLRPC_C LIBRARY VERSION $(xmlrpc-c-version)" ;
+
+ 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) : " " ]
+ {
+ libname = [ MATCH "-l(xmlrpc.*)" : $(i) ] ;
+ if $(libname)
+ {
+ external-lib $(libname)
+ : : <runtime-link>static:<link>static <runtime-link>shared:<link>shared ;
+ requirements += <library>$(libname) ;
+ }
+ }
+}
+# echo $(requirements) ;
+# exit 0 ;
boost 104400 ;
external-lib z ;
@@ -102,6 +122,18 @@ if ! [ option.get "without-tcmalloc" : : "yes" ] && [ test_library "tcmalloc_min
echo "Tip: install tcmalloc for faster threading. See BUILD-INSTRUCTIONS.txt for more information." ;
}
+if [ option.get "filter-warnings" : : "yes" ] {
+ # given the low coding standards in Moses, we may want to filter out
+ # warnings about poor coding practice that no-one is ever going to fix
+ # anyway ...
+ requirements += <cxxflags>-Wno-deprecated ;
+ requirements += <cxxflags>-Wno-reorder ;
+ requirements += <cxxflags>-Wno-sign-compare ;
+ requirements += <cxxflags>-Wno-unused-but-set-variable ;
+ requirements += <cxxflags>-Wno-unused-result ;
+ requirements += <cxxflags>-Wno-unused-variable ;
+}
+
if [ option.get "debug-build" : : "yes" ] {
requirements += <cxxflags>-Og ;
echo "Building with -Og to enable easier profiling and debugging. Only available on gcc 4.8+." ;
@@ -124,23 +156,6 @@ requirements += [ option.get "with-mm" : : <define>PT_UG ] ;
requirements += [ option.get "with-mm" : : <define>MAX_NUM_FACTORS=4 ] ;
requirements += [ option.get "unlabelled-source" : : <define>UNLABELLED_SOURCE ] ;
-if ( $(build-moses-server) = true )
-{
- xmlrpc-linkflags = [ shell_or_die "$(xmlrpc-command) c++2 abyss-server --libs" ] ;
- xmlrpc-cxxflags = [ shell_or_die "$(xmlrpc-command) c++2 abyss-server --cflags" ] ;
-
- requirements += <define>HAVE_XMLRPC_C ;
- requirements += <linkflags>$(xmlrpc-linkflags) ;
- requirements += <cxxflags>$(xmlrpc-cxxflags) ;
- # alias mserverlib : $(TOP)/moses/server//mserver ;
- echo "BUILDING MOSES SERVER" ;
-}
-else
-{
- echo "NOT BUILDING MOSES SERVER" ;
- # alias mserverlib ;
-}
-
if [ option.get "with-oxlm" ] {
external-lib boost_serialization ;
external-lib gomp ;
diff --git a/contrib/server/Jamfile b/contrib/server/Jamfile
index 030f817c2..06624514b 100644
--- a/contrib/server/Jamfile
+++ b/contrib/server/Jamfile
@@ -3,11 +3,17 @@
import option ;
import path ;
-
+if [ option.get "no-xmlrpc-c" : : "yes" ]
+{
+ echo "Not building mosesserver." ;
+}
+else
+{
with-xmlrpc-c = [ option.get "with-xmlrpc-c" ] ;
if $(with-xmlrpc-c) {
+ echo Bulding mosesserver. ;
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ;
- echo "!!! You are linking the XMLRPC-C library; Do NOT use v.1.25.29 !!!" ;
+ echo "!!! You are linking the XMLRPC-C library; Do NOT use v.1.25.29 !!!" ;
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ;
build-moses-server = true ;
@@ -26,6 +32,7 @@ if $(with-xmlrpc-c) {
}
xmlrpc-command = "xmlrpc-c-config" ;
}
+}
rule shell_or_die ( cmd ) {
local ret = [ _shell $(cmd) : exit-status ] ;
@@ -38,8 +45,8 @@ rule shell_or_die ( cmd ) {
if $(build-moses-server) = true
{
- xmlrpc-linkflags = [ shell_or_fail "$(xmlrpc-command) c++2 abyss-server --libs" ] ;
- xmlrpc-cxxflags = [ shell_or_fail "$(xmlrpc-command) c++2 abyss-server --cflags" ] ;
+ xmlrpc-linkflags = [ shell_or_die "$(xmlrpc-command) c++2 abyss-server --libs" ] ;
+ xmlrpc-cxxflags = [ shell_or_die "$(xmlrpc-command) c++2 abyss-server --cflags" ] ;
exe mosesserver :
mosesserver.cpp
diff --git a/jam-files/server.jam b/jam-files/server.jam
index e8dcc4255..1cb2e0d38 100644
--- a/jam-files/server.jam
+++ b/jam-files/server.jam
@@ -1,14 +1,8 @@
-import modules ;
-import option ;
-import os ;
-import path ;
-import project ;
-import build-system ;
-import version ;
+# import path ;
+import option ;
# Is the XMLRPC-C server available?
-build-moses-server = false ;
rule shell_or_die ( cmd ) {
local ret = [ _shell $(cmd) : exit-status ] ;
if $(ret[2]) != 0 {
@@ -17,43 +11,76 @@ rule shell_or_die ( cmd ) {
return $(ret[1]) ;
}
-with-xmlrpc-c = [ option.get "with-xmlrpc-c" ] ;
+build-server = [ option.get "no-xmlrpc-c" : "yes" : "no" ] ;
-if $(with-xmlrpc-c)
+if $(build-server) = yes
{
- # this should be migrated to a proper version check
- echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ;
- echo "!!! You are linking the XMLRPC-C library; Do NOT use v.1.25.29 !!!" ;
- echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ;
-
- xmlrpc-command = $(with-xmlrpc-c)/bin/xmlrpc-c-config ;
- if ! [ path.exists $(xmlrpc-command) ]
- {
- exit Could not find $(xmlrpc-command) : 1 ;
+ # by default, we try to build server capabilities into the server
+ xmlrpc-c-path = [ option.get "with-xmlrpc-c" ] ;
+ if $(xmlrpc-c-path) = ""
+ {
+ xmlrpc-c-config-cmd = "xmlrpc-c-config" ;
}
- else
+ else
{
- build-moses-server = true ;
+ xmlrpc-c-config-cmd = "$(xmlrpc-c-path)/bin/xmlrpc-c-config" ;
}
-}
-else
-{
- xmlrpc-check = [ _shell "xmlrpc-c-config --features 2>/dev/null" : exit-status ] ;
+ # check if xmlrpc-config is available
+ xmlrpc-check = [ _shell "$(xmlrpc-c-config-cmd) --features 2>/dev/null" : exit-status ] ;
if $(xmlrpc-check[2]) = 0
- {
+ {
+ # xmlrpc-c-config was found. Now check if abyss server is available
if [ MATCH "(abyss-server)" : $(xmlrpc-check[1]) ]
{
- build-moses-server = true ;
- }
- else
- {
- echo "Found xmlrpc-c but it does not have abyss-server. Skipping mosesserver." ;
- }
- }
- xmlrpc-command = "xmlrpc-c-config" ;
+ # Yes, abyss server is available. Is it the right xmlrpc-c version
+ # Version 1.25.29 does not work.
+ xmlrpc-check = [ _shell "$(xmlrpc-c-config-cmd) --version 2>/dev/null" : exit-status ] ;
+ xmlrpc-c-version = $(xmlrpc-check[1]) ;
+ if [ MATCH "(1.25.29)" : $(xmlrpc-c-version) ]
+ {
+ echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ;
+ echo "XMLRPC-C: Moses is not compatible with xmlrpc-c version $(xmlrpc-c-version). " ;
+ echo "XMLRPC-C: Use another one or compile without server functionality (--no-xmlrpc-c)." ;
+ echo "XMLRPC-C: Build aborted." ;
+ exit : 1 ;
+ }
+ else
+ {
+ # echo "XMLRPC-C: Found abyss server." ;
+ }
+ }
+ else
+ {
+ echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ;
+ echo "XMLRPC-C: Found xmlrpc-c but it does not provide the abyss server." ;
+ echo "XMLRPC-C: Use another xmlrpc-c installation that provides one " ;
+ echo "XMLRPC-C: or compile without server functionality (--no-xmlrpc-c)." ;
+ exit : 1 ;
+ }
+ }
+ else if [ option.get "with-xmlrpc-c" ]
+ {
+ echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ;
+ echo "XMLRPC-C: Could not find $(xmlrpc-c-config-cmd). Build aborted. " ;
+ exit : 1 ;
+ }
+ else
+ {
+ build-server = no ;
+ rule build_server { return no ; }
+ }
}
-
+if $(build-server) = yes
+{
+ xmlrpc-path = [ _shell "$(xmlrpc-c-config-cmd) --prefix 2>/dev/null" : exit-status ] ;
+ rule build_server { return $(xmlrpc-c-config-cmd) ; }
+ rule xmlrpc_path { return $(xmlrpc-path[1]) ; }
+}
+else
+{
+ rule build_server { return no ; }
+}
diff --git a/moses/Jamfile b/moses/Jamfile
index 5f3f80c8c..6d9e691db 100644
--- a/moses/Jamfile
+++ b/moses/Jamfile
@@ -3,20 +3,6 @@ path-constant FACTOR-LOG : bin/factor.log ;
update-if-changed $(FACTOR-LOG) $(max-factors) ;
max-factors = <define>MAX_NUM_FACTORS=$(max-factors) <dependency>$(FACTOR-LOG) ;
-include $(TOP)/jam-files/server.jam ;
-
-if ( $(build-moses-server) = true )
-{
- alias mserverlib : [ glob server/*.cpp ] ;
- echo "BUILDING MOSES SERVER" ;
-}
-else
-{
- echo "NOT BUILDING MOSES SERVER" ;
- alias mserverlib ;
-}
-
-
with-dlib = [ option.get "with-dlib" ] ;
if $(with-dlib) {
dlib = <define>WITH_DLIB <include>$(with-dlib) ;
@@ -68,6 +54,28 @@ update-if-changed $(LM-LOG) $(current) ;
obj FF_Factory.o : FF/Factory.cpp LM//macros headers ../lm//kenlm mmlib : <dependency>$(LM-LOG) ;
+# check if we have xmlrpc-c's abyss server available
+# if yes, include server capabilities in the moses executable
+# include $(TOP)/jam-files/server.jam ;
+
+xmlrpc-c-config-cmd = [ build_server ] ;
+if $(xmlrpc-c-config-cmd) = no
+{
+ echo "NOT BUILDING MOSES SERVER!" ;
+ alias mserver ;
+ alias xmlrpc-linkflags ;
+}
+else
+{
+ xmlprc-version = [ shell_or_die "$(xmlrpc-c-config-cmd) --version" ] ;
+ xmlprc-linkflags = [ shell_or_die "$(xmlrpc-c-config-cmd) --version" ] ;
+ echo "building moses server with xmlrpc-c version $(xmlrpc-c-version)" ;
+ alias mserver : [ glob server/*.cpp ] ;
+}
+
+
+
+
if [ option.get "with-mm" : no : yes ] = yes
{
alias mmlib :
@@ -113,11 +121,19 @@ lib moses :
SyntacticLanguageModel.cpp
*Test.cpp Mock*.cpp FF/*Test.cpp
FF/Factory.cpp
-] vwfiles
-headers FF_Factory.o LM//LM TranslationModel/CompactPT//CompactPT TranslationModel/ProbingPT//ProbingPT synlm ThreadPool
-
-..//search ../util/double-conversion//double-conversion ..//z ../OnDiskPt//OnDiskPt
-$(TOP)//boost_filesystem $(TOP)//boost_iostreams mmlib mserverlib
+]
+vwfiles synlm mmlib mserver headers
+FF_Factory.o
+LM//LM
+TranslationModel/CompactPT//CompactPT
+TranslationModel/ProbingPT//ProbingPT
+ThreadPool
+..//search
+../util/double-conversion//double-conversion
+..//z
+../OnDiskPt//OnDiskPt
+$(TOP)//boost_filesystem
+$(TOP)//boost_iostreams
:
<threading>single:<source>../util//rt
;