Page MenuHomeHEPForge

No OneTemporary

diff --git a/bin/rivet-buildplugin.in b/bin/rivet-buildplugin.in
--- a/bin/rivet-buildplugin.in
+++ b/bin/rivet-buildplugin.in
@@ -1,149 +1,149 @@
#!/usr/bin/env bash
## -*- sh -*-
## @configure_input@
## Print help
PROG=$(basename $0)
tmp=$(echo $* | egrep -- '--\<help\>|-\<h\>')
if test $# -lt 1 || test -n "$tmp"; then
echo "$PROG: compilation helper for Rivet analysis plugins"
echo
echo "Usage: $PROG [<libname>] <source1> [<source2> [compiler_flags] ...]"
echo
echo "<libname> can be a path, provided the filename is of the form 'Rivet*.so'"
echo "If <libname> is not specified, the default name is 'RivetAnalysis.so'."
echo
echo "To make special build variations you can add appropriate compiler flags"
echo "to the arguments and these will be passed directly to the compiler. For"
echo "example, for a debug build of your plugin library, add '-g', and for a"
echo "32 bit build on a 64 bit system add '-m32'."
echo
echo "Options:"
echo " -h | --help: display this help message"
echo " --with-root: add ROOT link options (requires root-config on system)"
echo " --cmd|--dry-run: just print the generated compiler command, do not execute"
echo
echo "TODO:"
echo " * is there a GCC option to parallelise the single-command compilation?"
test -n "$tmp"
exit $?
fi
## These variables need to exist
## Note no use of $DESTDIR... we ignore it so that destdir can be used
## for temp installs later copied to /
prefix=@prefix@
exec_prefix=@exec_prefix@
datarootdir=@datarootdir@
## Work out shared library build flags by platform
shared_flags=
SWVERS=$(which sw_vers 2> /dev/null)
if test "$SWVERS" && test -x "$SWVERS"; then
## Mac OS X
shared_flags="-undefined dynamic_lookup -bundle"
else
## Unix
shared_flags="-shared -fPIC"
fi
## Get Rivet system C++ compiler (fall back to $CXX and then g++ if needed)
mycxx=g++
-rivetcxx=$(which "@RIVETCXX@" 2> /dev/null)
+rivetcxx=$(which $(echo "@RIVETCXX@" | awk '{print $1}') 2> /dev/null)
abscxx=$(which "$CXX" 2> /dev/null)
if [[ -x "$rivetcxx" ]]; then
mycxx="@CXX@"
elif [[ -x "$abscxx" ]]; then
mycxx=$CXX
fi
## Get Rivet system C++ compiler flags
mycxxflags=""
if [[ -n "@AM_CXXFLAGS@" ]]; then
mycxxflags="@AM_CXXFLAGS@"
fi
if [[ -n "@RIVETCXXFLAGS@" ]]; then
mycxxflags="$mycxxflags @RIVETCXXFLAGS@"
fi
## Get Rivet system C preprocessor flags (duplicating that in rivet-config.in)
mycppflags=""
prefix="@prefix@"
exec_prefix="@exec_prefix@"
irivet="@includedir@"
test -n "$irivet" && mycppflags="$mycppflags -I${irivet}"
ihepmc="@HEPMCINCPATH@"
test -n "$ihepmc" && mycppflags="$mycppflags -I${ihepmc}"
iyoda="@YODAINCPATH@"
test -n "$iyoda" && mycppflags="$mycppflags -I${iyoda}"
ifastjet="@FASTJETINCPATH@"
test -n "$ifastjet" && mycppflags="$mycppflags -I${ifastjet}"
igsl="@GSLINCPATH@"
test -n "$igsl" && mycppflags="$mycppflags -I${igsl}"
# iboost="@BOOST_CPPFLAGS@"
# test -n "$iboost" && mycppflags="$mycppflags ${iboost}"
## Get Rivet system linker flags (duplicating that in rivet-config.in)
myldflags=""
lrivet="@libdir@"
test -n "$lrivet" && myldflags="$myldflags -L${lrivet}"
lhepmc="@HEPMCLIBPATH@"
test -n "$lhepmc" && myldflags="$myldflags -L${lhepmc}"
lyoda="@YODALIBPATH@"
test -n "$lyoda" && myldflags="$myldflags -L${lyoda}"
lfastjet="@FASTJETCONFIGLIBADD@"
test -n "$lfastjet" && myldflags="$myldflags ${lfastjet}"
## Detect whether the linker accepts the --no-as-needed flag and prepend the linker flag with it if possible
if (cd /tmp && echo -e 'int main() { return 0; }' > $$.cc; $mycxx -Wl,--no-as-needed $$.cc -o $$ 2> /dev/null); then
myldflags="-Wl,--no-as-needed $myldflags"
fi
## Link against ROOT if requested
with_root=$(echo $* | egrep -- '--\<with-root\>')
# echo $with_root
tmp=${@//--with-root/}
set $tmp #< Set positional params
## Just show the compiler command rather than execute it, if requested
only_show=$(echo $* | egrep -- '--\<cmd\>|--\<dry-run\>')
# echo $only_show
tmp=$(echo $@ | sed -e 's/--cmd//g' -e 's/--dry-run//g')
set $tmp #< Set positional params
## Get and check the library name
libname=$1
match1=$(basename "$libname" | egrep '^.*\.so')
match2=$(basename "$libname" | egrep '^Rivet.*\.so')
if test -n "$match1"; then
if test -z "$match2"; then
echo "Library name '$libname' does not have the required 'Rivet*.so' name pattern" 1>&2
exit 1
fi
## If we're using the first arg as the library name, shift it off the positional list
shift
else
if [[ -z $only_show ]]; then
echo "Using default library name 'RivetAnalysis.so'"
fi
libname="RivetAnalysis.so"
fi
## Get the source files (and more flags)
sources_and_flags="$@ -lRivet"
if [[ -n $with_root ]]; then
root_flags=$(root-config --libs --cflags 2> /dev/null)
# echo $root_flags
sources_and_flags="$root_flags $sources_and_flags"
fi
## Build
cmd="$mycxx -o \"$libname\" $shared_flags $mycppflags $mycxxflags $myldflags $sources_and_flags"
echo $cmd
if [[ -z $only_show ]]; then
eval $cmd
fi

File Metadata

Mime Type
text/x-diff
Expires
Wed, May 14, 11:39 AM (10 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5110464
Default Alt Text
(5 KB)

Event Timeline