/usr/bin/rivet-buildplugin is in rivet-plugins-dev 1.8.3-1.3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | #!/usr/bin/env bash
## -*- sh -*-
## bin/rivet-buildplugin. Generated from rivet-buildplugin.in by configure.
## 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
echo "TODO:"
echo " * is there a GCC option to parallelise the single-command compilation?"
test -n "$tmp"
exit $?
fi
## 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 "/usr/bin/g++" 2> /dev/null)
abscxx=$(which "$CXX" 2> /dev/null)
if [[ -x "$rivetcxx" ]]; then
mycxx="/usr/bin/g++"
elif [[ -x "$abscxx" ]]; then
mycxx=$CXX
fi
## Get Rivet system C++ compiler flags
mycxxflags=""
if [[ -n " -pedantic -ansi -Wall -Wno-long-long -Wno-format" ]]; then
mycxxflags=" -pedantic -ansi -Wall -Wno-long-long -Wno-format"
fi
if [[ -n "-g -O2 -fstack-protector-strong -Wformat -Werror=format-security" ]]; then
mycxxflags="$mycxxflags -g -O2 -fstack-protector-strong -Wformat -Werror=format-security"
fi
## Get Rivet system C preprocessor flags (duplicating that in rivet-config.in)
mycppflags=""
prefix="/usr"
irivet="${prefix}/include"
test -n "$irivet" && mycppflags="$mycppflags -I${irivet}"
ihepmc="/usr/include"
test -n "$ihepmc" && mycppflags="$mycppflags -I${ihepmc}"
ifastjet="/usr/include"
test -n "$ifastjet" && mycppflags="$mycppflags -I${ifastjet}"
igsl="/usr/include"
test -n "$igsl" && mycppflags="$mycppflags -I${igsl}"
iboost="/usr/include"
test -n "$iboost" && mycppflags="$mycppflags -I${iboost}"
## Get Rivet system linker flags (duplicating that in rivet-config.in)
myldflags=""
lrivet="/usr/lib/x86_64-linux-gnu"
test -n "$lrivet" && myldflags="$mycppflags -L${lrivet}"
lhepmc="/usr/lib/x86_64-linux-gnu"
test -n "$lhepmc" && myldflags="$mycppflags -L${lhepmc}"
lfastjet="/usr/lib/x86_64-linux-gnu"
test -n "$lfastjet" && myldflags="$mycppflags -L${lfastjet}"
## Link against ROOT if requested
with_root=$(echo $* | egrep -- '--\<with-root\>')
# echo $with_root
tmp=${@//--with-root/}
set $tmp
## 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
echo "Using default library name 'RivetAnalysis.so'"
libname="RivetAnalysis.so"
fi
## Get the source files (and more flags)
sources_and_flags="$@"
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
eval $cmd
|