More error checking for moses server

This commit is contained in:
Kenneth Heafield 2011-11-30 08:53:13 +00:00
parent 379b162f20
commit d4099a7455
2 changed files with 19 additions and 7 deletions

View File

@ -59,12 +59,12 @@
path-constant TOP : . ;
# Shell with trailing line removed http://lists.boost.org/boost-build/2007/08/17051.php
rule trim-nl ( str ) {
rule trim-nl ( str extras * ) {
return [ MATCH "([^
]*)" : $(str) ] ;
]*)" : $(str) ] $(extras) ;
}
rule _shell ( cmd ) {
return [ trim-nl [ SHELL $(cmd) ] ] ;
rule _shell ( cmd : extras * ) {
return [ trim-nl [ SHELL $(cmd) : $(extras) ] ] ;
}
import option ;

View File

@ -1,11 +1,15 @@
#If you get compilation errors here, make sure you have xmlrpc-c installed properly. . .
#If you get compilation errors here, make sure you have xmlrpc-c installed properly, including the abyss server option.
import option ;
import path ;
with-xmlrpc-c = [ option.get "with-xmlrpc-c" ] ;
if $(with-xmlrpc-c) {
build-moses-server = true ;
shell-prefix = $(with-xmlrpc-c)/bin/ ;
if ! [ path.exists $(shell-prefix)xmlrpc-c-config ] {
exit Could not find $(shell-prefix)xmlrpc-c-config : 1 ;
}
} else {
if [ SHELL $(TOP)"/jam-files/test.sh -include xmlrpc-c/base.hpp -lxmlrpc_server_abyss++" ] = 0 {
build-moses-server = true ;
@ -13,10 +17,18 @@ if $(with-xmlrpc-c) {
shell-prefix = "" ;
}
rule shell_or_die ( cmd ) {
local ret = [ _shell $(cmd) : exit-status ] ;
if $(ret[2]) != 0 {
exit "Failed to run $(cmd)" : 1 ;
}
return $(ret[1]) ;
}
if $(build-moses-server) = true
{
xmlrpc-linkflags = [ _shell "$(shell-prefix)xmlrpc-c-config c++2 abyss-server --libs" ] ;
xmlrpc-cxxflags = [ _shell "$(shell-prefix)xmlrpc-c-config c++2 abyss-server --cflags" ] ;
xmlrpc-linkflags = [ shell_or_die "$(shell-prefix)xmlrpc-c-config c++2 abyss-server --libs" ] ;
xmlrpc-cxxflags = [ shell_or_die "$(shell-prefix)xmlrpc-c-config c++2 abyss-server --cflags" ] ;
exe mosesserver : mosesserver.cpp ../../moses/src//moses ../../OnDiskPt/src//OnDiskPt : <linkflags>$(xmlrpc-linkflags) <cxxflags>$(xmlrpc-cxxflags) ;
} else {