2011-11-25 21:30:36 +04:00
|
|
|
#BUILDING MOSES
|
2011-11-21 18:31:10 +04:00
|
|
|
#
|
2011-11-25 21:30:36 +04:00
|
|
|
#PACKAGES
|
|
|
|
#Language models (optional):
|
2011-11-25 15:55:36 +04:00
|
|
|
#--with-irstlm=/path/to/irstlm
|
|
|
|
#--with-srilm=/path/to/srilm See moses/src/LM/Jamfile for more options.
|
2011-11-21 18:31:10 +04:00
|
|
|
#--with-randlm=/path/to/randlm
|
|
|
|
#KenLM is always compiled.
|
|
|
|
#
|
2011-11-25 15:55:36 +04:00
|
|
|
#--with-boost=/path/to/boost
|
|
|
|
#If Boost is in a non-standard location, specify it here. This directory is
|
|
|
|
#expected to contain include and lib or lib64.
|
|
|
|
#
|
2011-11-21 21:19:24 +04:00
|
|
|
#--with-xmlrpc-c=/path/to/xmlrpc-c for libxmlrpc-c (used by server)
|
|
|
|
#Note that, like language models, this is the --prefix where the library was
|
|
|
|
#installed, not some executable within the library.
|
|
|
|
#
|
2011-11-25 20:53:02 +04:00
|
|
|
#--with-giza=/path/to/giza
|
|
|
|
#Indicates where binaries GIZA++, snt2cooc.out, and mkcls live.
|
|
|
|
#Builds scripts/training/train-model.perl using these paths.
|
|
|
|
#
|
2011-11-21 21:19:24 +04:00
|
|
|
#
|
2011-11-25 20:53:02 +04:00
|
|
|
#INSTALLATION
|
2011-11-23 18:01:58 +04:00
|
|
|
#--install=/path/to/install sets the install directory (default dist).
|
2011-11-25 20:53:02 +04:00
|
|
|
#--install-scripts=/path/to/scripts copies scripts into a directory.
|
2011-11-23 18:01:58 +04:00
|
|
|
#--git appends the git revision to the install directory name.
|
2011-11-21 21:19:24 +04:00
|
|
|
#
|
2011-11-25 21:30:36 +04:00
|
|
|
#
|
|
|
|
#BUILD OPTIONS
|
2011-11-23 15:29:42 +04:00
|
|
|
# By default, the build is multi-threaded, optimized, and statically linked.
|
|
|
|
# Pass these to change the build:
|
2011-11-21 18:31:10 +04:00
|
|
|
#
|
2011-11-23 15:29:42 +04:00
|
|
|
# threading=single|multi controls threading (default multi)
|
2011-11-21 18:31:10 +04:00
|
|
|
#
|
2011-11-23 15:29:42 +04:00
|
|
|
# variant=release|debug|profile builds optimized (default), for debug, or for
|
|
|
|
# profiling
|
|
|
|
#
|
|
|
|
# link=static|shared controls linking (default static)
|
|
|
|
#
|
|
|
|
# debug-symbols=on|off include (default) or exclude debugging
|
|
|
|
# information also known as -g
|
|
|
|
#
|
2011-11-25 22:09:07 +04:00
|
|
|
# --notrace compiles without TRACE macros
|
2011-11-25 21:30:36 +04:00
|
|
|
#
|
2011-11-23 15:29:42 +04:00
|
|
|
#
|
2011-11-25 21:30:36 +04:00
|
|
|
#CONTROLLING THE BUILD
|
2011-11-21 21:19:24 +04:00
|
|
|
#-a to build from scratch
|
2011-11-21 18:31:10 +04:00
|
|
|
#-j$NCPUS to compile in parallel
|
2011-11-23 15:29:42 +04:00
|
|
|
#--clean to clean
|
2011-11-21 18:31:10 +04:00
|
|
|
|
2011-11-21 15:42:46 +04:00
|
|
|
path-constant TOP : . ;
|
|
|
|
|
2011-11-23 23:12:44 +04:00
|
|
|
# Shell with trailing line removed http://lists.boost.org/boost-build/2007/08/17051.php
|
|
|
|
rule trim-nl ( str ) {
|
|
|
|
return [ MATCH "([^
|
|
|
|
]*)" : $(str) ] ;
|
|
|
|
}
|
|
|
|
rule _shell ( cmd ) {
|
|
|
|
return [ trim-nl [ SHELL $(cmd) ] ] ;
|
|
|
|
}
|
|
|
|
|
2011-11-21 15:42:46 +04:00
|
|
|
import option ;
|
2011-11-23 23:12:44 +04:00
|
|
|
|
|
|
|
rule test_flags ( flags ) {
|
|
|
|
if [ SHELL $(TOP)"/jam-files/test.sh "$(flags) ] = 0 {
|
|
|
|
return true ;
|
|
|
|
} else {
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-25 15:55:36 +04:00
|
|
|
rule auto_shared ( name : additional ? ) {
|
|
|
|
additional ?= "" ;
|
|
|
|
if [ test_flags $(additional)" -static -l"$(name) ] {
|
2011-11-23 23:12:44 +04:00
|
|
|
return ;
|
|
|
|
} else {
|
|
|
|
return "<link>shared" ;
|
|
|
|
}
|
2011-11-21 15:42:46 +04:00
|
|
|
}
|
2011-11-23 23:12:44 +04:00
|
|
|
|
2011-11-25 15:55:36 +04:00
|
|
|
with-boost = [ option.get "with-boost" ] ;
|
|
|
|
if $(with-boost) {
|
|
|
|
L-boost-search = -L$(with-boost)/lib" "-L$(with-boost)/lib64 ;
|
|
|
|
boost-search = <search>$(with-boost)/lib <search>$(with-boost)/lib64 ;
|
2011-11-26 16:18:17 +04:00
|
|
|
I-boost-include = -I$(with-boost)/include ;
|
2011-11-25 15:55:36 +04:00
|
|
|
boost-include = <include>$(with-boost)/include ;
|
|
|
|
} else {
|
|
|
|
L-boost-search = "" ;
|
|
|
|
boost-search = ;
|
2011-11-26 16:18:17 +04:00
|
|
|
I-boost-include = "" ;
|
|
|
|
boost-include = ;
|
|
|
|
}
|
|
|
|
|
|
|
|
boost-shell = [ SHELL "g++ "$(I-boost-include)" -dM -x c++ -E /dev/null -include boost/version.hpp |grep '#define BOOST_VERSION '" : exit-status ] ;
|
|
|
|
if $(boost-shell[2]) != 0 {
|
|
|
|
exit Boost does not seem to be installed or g++ is confused. : 1 ;
|
|
|
|
}
|
|
|
|
boost-version = [ MATCH "#define BOOST_VERSION ([0-9]*)" : $(boost-shell[1]) ] ;
|
|
|
|
if $(boost-version) < 103600 {
|
|
|
|
exit You have Boost $(boost-version). Moses requires at least 103600 (and preferably newer). : 1 ;
|
2011-11-25 15:55:36 +04:00
|
|
|
}
|
|
|
|
#Are we linking static binaries against shared boost?
|
|
|
|
boost-auto-shared = [ auto_shared "boost_program_options" : L-boost-search ] ;
|
2011-11-21 18:31:10 +04:00
|
|
|
#Convenience rule for boost libraries. Defines library boost_$(name).
|
2011-11-23 23:12:44 +04:00
|
|
|
rule boost_lib ( name macro ) {
|
|
|
|
#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.
|
2011-11-25 15:55:36 +04:00
|
|
|
if [ test_flags $(L-boost-search)" -lboost_"$(name)"-mt" ] {
|
|
|
|
lib inner_boost_$(name) : : <threading>single $(boost-search) <name>boost_$(name) ;
|
|
|
|
lib inner_boost_$(name) : : <threading>multi $(boost-search) <name>boost_$(name)-mt ;
|
2011-11-23 23:12:44 +04:00
|
|
|
} else {
|
2011-11-25 15:55:36 +04:00
|
|
|
lib inner_boost_$(name) : : $(boost-search) <name>boost_$(name) ;
|
2011-11-23 23:12:44 +04:00
|
|
|
}
|
|
|
|
|
2011-11-25 15:55:36 +04:00
|
|
|
alias boost_$(name) : inner_boost_$(name) : $(boost-auto-shared) : : <link>shared:<define>BOOST_$(macro) $(boost-include) ;
|
2011-11-21 18:31:10 +04:00
|
|
|
}
|
2011-11-23 23:12:44 +04:00
|
|
|
#See tools/build/v2/contrib/boost.jam in a boost distribution for a table of macros to define.
|
|
|
|
boost_lib thread THREAD_DYN_DLL ;
|
|
|
|
boost_lib program_options PROGRAM_OPTIONS_DYN_LINK ;
|
|
|
|
boost_lib unit_test_framework TEST_DYN_LINK ;
|
2011-11-21 15:42:46 +04:00
|
|
|
|
2011-11-23 18:01:58 +04:00
|
|
|
#Link normally to a library, but sometimes static isn't installed so fall back to dynamic.
|
|
|
|
rule external_lib ( name ) {
|
2011-11-23 23:12:44 +04:00
|
|
|
lib $(name) : : [ auto_shared $(name) ] ;
|
2011-11-23 18:01:58 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
external_lib z ;
|
|
|
|
|
|
|
|
#libSegFault prints a stack trace on segfault. Link against it if available.
|
2011-11-23 23:12:44 +04:00
|
|
|
if [ test_flags "-lSegfault" ] {
|
2011-11-23 18:01:58 +04:00
|
|
|
external_lib SegFault ;
|
|
|
|
segfault = <library>SegFault ;
|
2011-11-21 19:09:38 +04:00
|
|
|
}
|
|
|
|
|
2011-11-22 22:13:44 +04:00
|
|
|
trace = [ option.get "notrace" : <define>TRACE_ENABLE=1 ] ;
|
2011-11-21 15:42:46 +04:00
|
|
|
|
2011-11-18 18:37:01 +04:00
|
|
|
project : default-build
|
|
|
|
<threading>multi
|
|
|
|
<warnings>on
|
2011-11-22 22:17:31 +04:00
|
|
|
<debug-symbols>on
|
2011-11-18 18:37:01 +04:00
|
|
|
<variant>release
|
|
|
|
<link>static
|
|
|
|
;
|
|
|
|
|
|
|
|
project : requirements
|
|
|
|
<threading>multi:<define>WITH_THREADS
|
|
|
|
<threading>multi:<library>boost_thread
|
2011-11-23 18:01:58 +04:00
|
|
|
$(segfault)
|
2011-11-22 20:06:34 +04:00
|
|
|
<define>_FILE_OFFSET_BITS=64 <define>_LARGE_FILES
|
2011-11-18 20:25:45 +04:00
|
|
|
$(trace)
|
2011-11-18 18:37:01 +04:00
|
|
|
;
|
|
|
|
|
2011-11-21 18:31:10 +04:00
|
|
|
#Add directories here if you want their incidental targets too (i.e. tests).
|
2011-11-18 18:37:01 +04:00
|
|
|
build-project lm ;
|
|
|
|
build-project util ;
|
2011-11-21 22:20:52 +04:00
|
|
|
#Trigger instllation into legacy paths.
|
2011-11-26 02:14:04 +04:00
|
|
|
build-project mert ;
|
2011-11-21 22:20:52 +04:00
|
|
|
build-project moses-cmd/src ;
|
|
|
|
build-project moses-chart-cmd/src ;
|
2011-11-26 16:18:17 +04:00
|
|
|
#Scripts have their own binaries.
|
2011-11-25 20:53:02 +04:00
|
|
|
build-project scripts ;
|
2011-11-18 18:37:01 +04:00
|
|
|
|
2011-11-21 15:42:46 +04:00
|
|
|
install-location = [ option.get "install" : $(TOP)/dist ] ;
|
2011-11-23 18:01:58 +04:00
|
|
|
|
|
|
|
if [ option.get "git" : : "yes" ] {
|
2011-11-25 18:41:49 +04:00
|
|
|
local revision = [ _shell "git rev-parse --verify HEAD |head -c 7" ] ;
|
|
|
|
constant GITTAG : "."$(revision) ;
|
|
|
|
} else {
|
|
|
|
constant GITTAG : "" ;
|
2011-11-23 18:01:58 +04:00
|
|
|
}
|
|
|
|
|
2011-11-25 18:41:49 +04:00
|
|
|
install-location = $(install-location)$(GITTAG) ;
|
|
|
|
|
2011-11-18 18:37:01 +04:00
|
|
|
install dist :
|
|
|
|
lm//query
|
|
|
|
lm//build_binary
|
|
|
|
moses-chart-cmd/src//moses_chart
|
|
|
|
moses-cmd/src//programs
|
|
|
|
CreateOnDisk/src//CreateOnDisk
|
2011-11-18 20:25:45 +04:00
|
|
|
mert//programs
|
2011-11-23 18:48:50 +04:00
|
|
|
contrib/server//mosesserver
|
2011-11-23 16:10:45 +04:00
|
|
|
misc//programs
|
2011-11-21 15:42:46 +04:00
|
|
|
: <location>$(install-location) <install-type>EXE <install-dependencies>on <link>shared:<dll-path>$(install-location) <link>shared:<install-type>LIB ;
|