summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2012-08-16 17:32:33 -0400
committerKenneth Heafield <github@kheafield.com>2012-08-16 17:32:33 -0400
commitbc94f8c8c3fc3978a68859a67d33ccd243437016 (patch)
tree9f0555d664a7654c41ba1705d810b87cee645e06
parentf82833385b7cf3c01dc2f92830119dfe3ebc573e (diff)
Update build system, add missing cc files
-rw-r--r--Jamroot2
-rw-r--r--decoder/Jamfile3
-rw-r--r--jam-files/sanity.jam116
3 files changed, 96 insertions, 25 deletions
diff --git a/Jamroot b/Jamroot
index 87a5a53d..ef426146 100644
--- a/Jamroot
+++ b/Jamroot
@@ -14,7 +14,7 @@ boost 104400 ;
external-lib z ;
with-google-hash = [ option.get "with-google-hash" ] ;
-if [ test_header google/dense_hash_map ] || $(with-google-hash) {
+if [ test_header sparsehash/dense_hash_map ] || $(with-google-hash) {
requirements += <define>HAVE_SPARSEHASH <include>$(with-google-hash) ;
}
diff --git a/decoder/Jamfile b/decoder/Jamfile
index 06c5bfda..da02d063 100644
--- a/decoder/Jamfile
+++ b/decoder/Jamfile
@@ -55,6 +55,9 @@ lib decoder :
JSON_parser.c
json_parse.cc
grammar.cc
+ rescore_translator.cc
+ hg_remove_eps.cc
+ hg_union.cc
$(glc)
..//utils
..//mteval
diff --git a/jam-files/sanity.jam b/jam-files/sanity.jam
index aefed9c0..809a186b 100644
--- a/jam-files/sanity.jam
+++ b/jam-files/sanity.jam
@@ -3,6 +3,8 @@ import option ;
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 * ) {
@@ -50,13 +52,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" ;
+ }
}
}
@@ -86,28 +100,19 @@ else {
boost-include = ;
}
}
-
-requirements = ;
#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 ) {
+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" ] {
-# if [ test_flags $(L-boost-search)" -lboost_"$(name) ] {
-# lib inner_boost_$(name) : : <threading>single $(boost-search) <name>boost_$(name) ;
-# lib inner_boost_$(name) : : <threading>multi $(boost-search) <name>boost_$(name)-mt ;
-# } else {
- if ! <threading>multi in $(requirements) {
- requirements += <threading>multi ;
- }
- lib inner_boost_$(name) : : <threading>multi $(boost-search) <name>boost_$(name)-mt ;
-# }
+ 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) ;
+ 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) ;
@@ -115,7 +120,7 @@ rule boost-lib ( name macro ) {
#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)" ;
@@ -125,13 +130,14 @@ 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 ;
}
+ boost-lib-version = [ MATCH "#define BOOST_LIB_VERSION \"([^\"]*)\"" : $(boost-shell[1]) ] ;
#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 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 serialization SERIALIZATION_DYN_LINK ;
- boost-lib mpi MPI_DYN_LINK ;
+ boost-lib filesystem FILE_SYSTEM_DYN_LINK ;
}
#Link normally to a library, but sometimes static isn't installed so fall back to dynamic.
@@ -157,10 +163,10 @@ rule external-lib ( name : search-path * ) {
local ignored = @($(build-log):E=$(script)) ;
}
-{
- #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 ;
@@ -178,8 +184,9 @@ if [ option.get "git" : : "yes" ] {
prefix = [ option.get "prefix" ] ;
if $(prefix) {
prefix = [ path.root $(prefix) [ path.pwd ] ] ;
+ prefix = $(prefix)$(GITTAG) ;
} else {
- prefix = $(TOP)/dist$(GITTAG) ;
+ prefix = $(TOP)$(GITTAG) ;
}
bindir = [ option.get "bindir" : $(prefix)/bin ] ;
@@ -195,7 +202,68 @@ rule install-headers ( name : list * : source-root ? ) {
}
rule build-projects ( projects * ) {
- for p in $(projects) {
+ for local p in $(projects) {
build-project $(p) ;
}
}
+
+#Only one post build hook is allowed. Allow multiple.
+post-hooks = ;
+rule post-build ( ok ? ) {
+ for local r in $(post-hooks) {
+ $(r) $(ok) ;
+ }
+}
+IMPORT $(__name__) : post-build : : $(__name__).post-build ;
+build-system.set-post-build-hook $(__name__).post-build ;
+rule add-post-hook ( names * ) {
+ post-hooks += $(names) ;
+}
+
+
+#Backend for writing content to files after build completes.
+post-files = ;
+post-contents = ;
+rule save-post-build ( ok ? ) {
+ if $(ok) {
+ while $(post-files) {
+ local ignored = @($(post-files[1]):E=$(post-contents[1])) ;
+ post-files = $(post-files[2-]) ;
+ post-contents = $(post-contents[2-]) ;
+ }
+ }
+}
+add-post-hook save-post-build ;
+
+#Queue content to be written to file when build completes successfully.
+rule add-post-write ( name content ) {
+ post-files += $(name) ;
+ post-contents += $(content) ;
+}
+
+#Compare contents of file with current. If they're different, force the targets to rebuild then overwrite the file.
+rule always-if-changed ( file current : targets * ) {
+ local previous = inconsistent ;
+ if [ path.exists $(file) ] {
+ previous = [ _shell "cat $(file)" ] ;
+ }
+ if $(current) != $(previous) {
+ #Write inconsistent while the build is running
+ if [ path.exists $(file) ] {
+ local ignored = @($(file):E=inconsistent) ;
+ }
+ add-post-write $(file) $(current) ;
+ for local i in $(targets) {
+ always $(i) ;
+ }
+ }
+}
+
+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 ;
+ }
+}