More fiddling with bjam.

This commit is contained in:
Ulrich Germann 2015-03-26 16:38:05 +00:00
parent b3ff4ff13a
commit 4410e9225a
2 changed files with 210 additions and 0 deletions

116
jam-files/curlpp.jam Normal file
View File

@ -0,0 +1,116 @@
# -*- jam -*-
# configuration for curlpp
# I haven't been able to wrap my mind around bjam yet, so chances are
# there's a much better way to do things.
module curlppvars { } # this stores the variables we want to keep
if [ option.get "no-curlpp" : : yes ]
{
rule curlpp ( what ? ) { } # never return anything
}
else
{
local version ;
local prefix ;
# check if a non-standard location for curl is given
local curlpp = [ option.get "with-curlpp" ] ;
if ! $(curlpp) # maybe via environment variable CURLPP_ROOT ?
{
local where = [ os.environ "CURLPP_ROOT" ] ;
if $(where)
{
option.set "with-curlpp" : $(where) ;
local msg = "setting --with-curlpp=$(where) via environment " ;
echo "$(msg) variable CURLPP_ROOT" ;
}
curlpp = [ option.get "with-curlpp" ] ;
}
local config ;
if $(curlpp)
{
config = $(curlpp)/bin/curlpp-config ;
}
else # is curlpp-config in the path ?
{
local curlpp-check = [ _shell "curlpp-config >/dev/null" : exit-status ] ;
if $(curlpp-check[2]) = 0 { config = curlpp-config ; }
}
if $(config)
{
prefix = [ shell_or_die "$(config) --prefix" ] ;
version = [ shell_or_die "$(config) --version" ] ;
version = [ SPLIT_BY_CHARACTERS $(version) : " " ] ;
version = [ trim-nl $(version[2]) ] ;
modules.poke curlppvars : prefix : $(prefix) ;
modules.poke curlppvars : version : $(version) ;
requirements += <define>HAVE_CURLPP ;
local cpp-cflags = [ shell_or_die "$(config) --cflags" ] ;
for local i in [ SPLIT_BY_CHARACTERS $(cpp-cflags) : " " ]
{
local incpath = [ MATCH "-I(.*)" : $(i) ] ;
if $(incpath)
{
# echo "CURLPP: $(i)" ;
requirements += <include>$(incpath) ;
}
}
local cpp-libs = [ shell_or_die "$(config) --libs" ] ;
local cpp-prefix = [ shell_or_die "$(config) --prefix" ] ;
for local i in [ SPLIT_BY_CHARACTERS $(cpp-libs) : " " ]
{
local libpath = [ MATCH "^-L(.*)" : $(i) ] ;
if $(libpath) { requirements += <library-path>$(libpath) ; }
local libname = [ MATCH "^-l(.*)" : $(i) ] ;
if $(libname)
{
# local curl = [ MATCH "^-l(.*pp)" : $(i) ] ;
# if [ path.exists $(cpp-prefix)/lib/lib$(libname).a ]
# {
# echo "CURLPP: STATIC LINKING FOR LIBRARY: $(libname)" ;
# lib $(libname) : : <link>static ;
# }
# else
# {
external-lib $(libname) ;
# }
requirements += <library>$(libname)/<link>shared ;
}
else
{
requirements += <linkflags>$(i) ;
}
# requirements += <library-path>/usr/lib/x86_64-linux-gnu ;
# for local xtra in idn rtmp ssl crypto ssl crypto ldap rt
# {
# external-lib $(xtra) : /usr/lib/x86_64-linux-gnu ;
# requirements += <library>$(xtra) ;
# }
}
# the rule curlpp provides access to all the variables defined in this file
# if none argument is given, it returns $(version), which should only be
# defined if curl is available
rule curlpp ( what ? )
{
if $(what)
{
retval = [ modules.peek curlppvars : $(what) ] ;
if $(retval) { return $(retval) ; }
}
else { return "yes" ; }
}
}
else { rule curlpp { } }
}
if [ curlpp ]
{
local prefix = [ curlpp prefix ] ;
local version = [ curlpp version ] ;
echo "CULRPP: USING VERSION $(version) FROM $(prefix)" ;
}

94
jam-files/xmlrpc-c.jam Normal file
View File

@ -0,0 +1,94 @@
# This module handles the use (or non-use) of the externall
# xmlrpc-c library (including the abyss server) that is needed for
# moses server functionality
if [ option.get "no-xmlrpc-c" ]
{
rule xmlrpc-c ( what ? ) { } # never return anything
}
else
{
local xmlrpc = [ option.get "with-xmlrpc-c" ] ;
if ! $(xmlrpc) # check for environment variable
{
local where = [ os.environ "XMLRPC_C_ROOT" ] ;
if $(where)
{
option.set "with-xmlrpc-c" : $(where) ;
local msg = "setting --with-xmlrpc-c=$(where) via environment " ;
echo "$(msg) variable XMLRPC_C_ROOT" ;
}
xmlrpc = [ option.get "with-xmlrpc-c" ] ;
}
local config ;
if ! $(xmlrpc) { config = "xmlrpc-c-config" ; }
else { config = "$(xmlrpc)/bin/xmlrpc-c-config" ; }
# check if xmlrpc-config can be executed
xmlrpc-check = [ _shell "$(config) --features 2>/dev/null" : exit-status ] ;
if $(xmlrpc-check[2]) = 0 # yes it can
{
# is the abyss server is available ?
if [ MATCH "(abyss-server)" : $(xmlrpc-check[1]) ]
{
# Yes, abyss server is available. Is it the right xmlrpc-c version ?
# Note: Version 1.25.29 does not work.
xmlrpc-check = [ _shell "$(config) --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 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ;
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 $(config). " ;
echo "Build aborted. " ;
echo "Use --no-xmlrpc-c to compile moses without server functionality. " ;
exit : 1 ;
}
local prefix = [ shell_or_die "$(config) --prefix" ] ;
local version = [ shell_or_die "$(config) --version" ] ;
echo "XMLRPC-C: USING VERSION $(version) FROM $(prefix)" ;
# now add stuff to the requirements
local cflags = [ shell_or_die "$(config) c++2 abyss-server --cflags" ] ;
requirements += <define>HAVE_XMLRPC_C ;
requirements += <cxxflags>$(xmlrpc-cxxflags) ;
local libs = [ shell_or_die "$(config) c++2 abyss-server --libs" ] ;
for local i in [ SPLIT_BY_CHARACTERS $(libs) : " " ]
{
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) ;
}
}
rule xmlrpc { return yes ; }
}