/usr/lib/x86_64-linux-gnu/metview/compile is in metview 4.8.0-4.
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 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | #!/bin/bash
# **************************** LICENSE START ***********************************
#
# Copyright 2014 ECMWF and INPE. This software is distributed under the terms
# of the Apache License version 2.0. In applying this license, ECMWF does not
# waive the privileges and immunities granted to it by virtue of its status as
# an Intergovernmental Organization or submit itself to any jurisdiction.
#
# ***************************** LICENSE END ************************************
# Script to compile external inline macro functions
#
# The upper part is created by Make in order to copy
# site and platform specific compiler macros from
# Metview configuration files. The rest of the script
# - below - should be site and platform independent.
#
#-- MACRO_EXTRA_LIBS can be set externally to link with custom libs!
#-- MACRO_EXTRA_F77_FLAGS can be set externally for extra Fortran 77 flags!
#-- MACRO_EXTRA_F90_FLAGS can be set externally for extra Fortran 90 flags!
#-- MACRO_EXTRA_CC_FLAGS can be set externally for extra C/C++ flags!
#-- MACRO_EXTRA_INCS is reserved for C programs, for extra -I flags!
# NOTE that we use environment variables METVIEW_DDIR and METVIEW_VVERSION instead
# of METVIEW_DIR and METVIEW_VERSION. We set these in extern.cc when we call the
# popen() routine; we can't always use the normal env vars because these can be
# overwritten by the default modules command at ECMWF.
set -e
CC=/usr/bin/cc
CC_FLAGS=" -g -O2 -fdebug-prefix-map=/build/metview-4.8.0=. -fstack-protector-strong -Wall -pedantic -fPIC -Wdate-time -D_FORTIFY_SOURCE=2 -pipe"
CXX=/usr/bin/c++
CXX_FLAGS=" -g -O2 -fdebug-prefix-map=/build/metview-4.8.0=. -fstack-protector-strong -std=c++11 -Wdate-time -D_FORTIFY_SOURCE=2 -pipe -fpermissive -Wno-write-strings -Wno-deprecated"
F77=/usr/bin/gfortran
F77_FLAGS="-g -O2 -fdebug-prefix-map=/build/metview-4.8.0=. -fstack-protector-strong -fdefault-real-8 -fdefault-double-8"
F90=/usr/bin/gfortran
F90_FLAGS="-g -O2 -fdebug-prefix-map=/build/metview-4.8.0=. -fstack-protector-strong -fdefault-real-8 -fdefault-double-8"
FC_LIBS=""
LIBNAME="lib"
GRIBAPI_LIB="-L/usr/lib/lib -L/usr/lib/lib64 -Wl,-rpath,/usr/lib/lib:/usr/lib/lib64 -leccodes -leccodes_f90 /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/libaec.so /usr/lib/x86_64-linux-gnu/libm.so /usr/lib/x86_64-linux-gnu/libopenjp2.so /usr/lib/x86_64-linux-gnu/libpthread.so -Wl,-rpath,/usr/include/../lib64:/usr/include/../lib"
GRIBAPI_INC=" -I/usr/lib/include -I/usr/include -I/usr/lib/python3/dist-packages/numpy/core/include -I/usr/include/openjpeg-2.1"
MV_EMOSLIB="/usr/lib/x86_64-linux-gnu/libemosR64.a"
LDFLAGS_INLINE=""
MV_EMOSLIB=${MV_EMOSLIB:="-L/usr/local/lib -lemosR64"}
# installed version with own-built GRIB_API - make sure we pick up the right GRIB libs
case $METVIEW_VVERSION in
prod)
if [ "x$MV_BUNDLE_TYPE" == "xMMG" -o "x$MV_BUNDLE_SRC" != "x" ]
then
GRIBAPI_INC="-I$METVIEW_DDIR/include $GRIBAPI_INC"
GRIBAPI_LIB="-L$METVIEW_DDIR/$LIBNAME -Wl,-rpath,/$METVIEW_DDIR/$LIBNAME $GRIBAPI_LIB"
fi
;;
esac
#-- Note that we end up with a duplicated '-lgrib_api' in $FLIBS, but this is because this needs to
#-- come after the fortran library (and it also exists within $GRIBAPI_LIB).
FLIB="-L$METVIEW_DDIR/${LIBNAME} -lmacro_api_f90 -lMvMars $MACRO_EXTRA_LIBS $MV_EMOSLIB $GRIBAPI_INC $GRIBAPI_LIB $LDFLAGS_INLINE -lm -lc"
CLIB="$MACRO_EXTRA_LIBS $GRIBAPI_INC -L$METVIEW_DDIR/${LIBNAME} -lMvMars $MV_EMOSLIB $GRIBAPI_LIB $LDFLAGS_INLINE -lm $FC_LIBS"
CINC="$MACRO_EXTRA_INCS $GRIBAPI_INC -I$METVIEW_DDIR/include"
MX77="$MACRO_EXTRA_F77_FLAGS"
MX90="$MACRO_EXTRA_F90_FLAGS"
MXCC="$MACRO_EXTRA_CC_FLAGS"
cd $METVIEW_TMPDIR
#-- to set trace use macro function 'trace(n)' where n>1
trace=0
if [ "$1" = "-d" ]
then
trace=1
set -x
shift
fi
type="$1"
in="$2"
out="$3"
#-- uncomment if you need to debug...
#set -x
case "$type" in
shell)
## Simply copy input to output and make executable
ln -f "$in" "$out"
chmod +x "$out"
;;
fortran|f77)
ln -s -f "$in" compile$$.f
$F77 -o "$out" $F77_FLAGS $MX77 compile$$.f $FLIB
[ x$MACRO_FORTRAN_DBG != x ] || rm -f compile$$.f
;;
fortran90|f90)
ln -s -f "$in" compile$$.f90
$F90 -o "$out" $F90_FLAGS $MX90 compile$$.f90 $FLIB
[ x$MACRO_FORTRAN_DBG != x ] || rm -f compile$$.f90
;;
C|c)
ln -s -f "$in" compile$$.c
$CC -o "$out" $CC_FLAGS $MXCC $CINC compile$$.c $CLIB
[ x$MACRO_FORTRAN_DBG != x ] || rm -f compile$$.c
;;
C++|c++)
ln -s -f "$in" compile$$.cc
$CXX -o "$out" $CXX_FLAGS $MXCC $CINC compile$$.cc $CLIB
[ x$MACRO_FORTRAN_DBG != x ] || rm -f compile$$.c
;;
*)
# Consider the string as a command
cat <<@ > "$out"
#!/bin/bash
cat <<\end_of_inline_macro$$ > $METVIEW_TMPDIR/\$\$
@
cat "$in" >> "$out"
cat <<@ >> "$out"
end_of_inline_macro$$
$type $METVIEW_TMPDIR/\$\$
e=\$?
rm -f $METVIEW_TMPDIR/\$\$
exit \$e
@
;;
esac
|