Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:59

0001 #!/bin/sh
0002 
0003 conf=$UTILSDIR/path-$1.conf
0004 sconf=$DEPDIR/path-auto.conf
0005 
0006 rm -fr $DEPDIR
0007 mkdir -p $DEPDIR
0008 
0009 exec >> $sconf
0010 # Nag_C must come first, otherwise we'll mistake `Nag' include
0011 # directory with the one in the LHC++ generic include directory and
0012 # will be unable to locate Nag_C headers.
0013 (cd $DIST; scram tool list | grep "^ *nag_c "; \
0014  scram tool list | grep -v "^ *nag_c" | grep -v '^ *$' | grep -v 'Tool list for' | grep -v '\+\+\+\+' ) |
0015 while read name version rest; do
0016   tooldoc=`cd $DIST; scram tool info $name|grep '^Docfile : '| \
0017            sed 's/.*module=//;s/\&.*//;'`
0018   toolname=`echo $tooldoc | sed 's|.*/||'`
0019   tooltype=`echo $tooldoc | sed 's|^SCRAMToolBox/||; s|/.*||; s|LHCxx|LHC++|g'`
0020 
0021   # try to work around old versions of scram
0022   if [ x"$tooltype" = x"$toolname" ]; then
0023     case $toolname in
0024       GEMINI*      ) tooltype=LHC++ toolname=Gemini ;;
0025       NAG_C        ) tooltype=LHC++ ;;
0026       Objectivity  ) tooltype=LHC++ toolname=Objectivity ;;
0027       ObjectSpace* ) tooltype=LHC++ toolname=ObjectSpace ;;
0028       cern_*       ) tooltype=CERNLIB toolname=cern ;;
0029       OpenInventor ) tooltype=LHC++ ;;
0030       OpenGL       ) tooltype=System ;;
0031       Qt           ) tooltype=LHC++ ;;
0032       X11          ) tooltype=System ;;
0033       *            ) tooltype=Unknown ;;
0034     esac
0035   fi
0036 
0037   [ "$toolname" = NAG_C     ] && toolname=Nag_C
0038   [ "$toolname" = NTupleTag ] && toolname=NtupleTag
0039   [ "$toolname" = QPlotter  ] && toolname=Qplotter
0040 
0041   mapname=$toolname
0042   [ "$toolname" = T_HTL     ] && mapname=HTL
0043   [ "$toolname" = FML_nag   ] && mapname=FML
0044   [ "$toolname" = FML_minuit ] && mapname=FML
0045 
0046   mapfullname="$tooltype/$mapname"
0047   [ "$tooltype" = CompilerTools ] && mapfullname="<Compiler>"
0048 
0049   echo "# $tooltype/$toolname"
0050   libdir=`cd $DIST; scram tool info $name | grep '^LIBDIR=' | sed 's/^[^=]*=//;'`
0051   if [ -n "$libdir" ]; then
0052     for l in `cd $DIST; scram tool info $name | grep '^lib=' | sed 's/^lib=//'`; do
0053       echo "scan libs $libdir/lib$l.so"
0054       echo "scan libs $libdir/lib$l.a"
0055       # FIXME: misses LHC++ copied libraries
0056       #   echo "match /lib$l.so:'$tooltype/$toolname'"
0057       echo "match /lib$l\\.:'$mapfullname'"
0058     done
0059   fi
0060 
0061   # Add compiler's include and lib directories
0062   case $tooltype/$toolname in
0063     */gcc* )
0064       # SCRAM's got a crappy habit of listing all tools in mixed architectures,
0065       # and then misreporting compilers if we are not actually using them on this
0066       # architecture, so filter out a compiler we are not actually using.  Usually
0067       # it has some random garbage path on the wrong architecture.
0068       cxx=`cd $DIST; scram tool tag $name CXX`
0069       test -f "$cxx" -a -x "$cxx" || continue
0070 
0071       root=`echo $cxx | sed 's|/bin/[^/]*$||'`
0072       dir=`$cxx -v 2>&1 | grep /specs | sed 's/.* //; s|/specs||'`
0073       v=`$cxx -dumpversion`
0074       for n in stdc++ g2c gcc_s supc++; do 
0075         echo "match ^$root/lib/lib`echo $n | tr -d +`:'<Compiler>'"
0076         echo "match ^/usr/(local/|)lib/lib`echo $n | tr -d +`:'<Compiler>'"
0077         for f in $root/lib/lib$n*; do [ -f $f ] && echo "scan libs $f"; done
0078         for f in $dir/lib$n*; do [ -f $f ] && echo "scan libs $f"; done
0079       done
0080 
0081       echo "search include .*:(.*):\"$dir/include/\$1\"" # 2.x
0082       echo "search include .*:(.*):\"$root/include/c++/$v/\$1\"" # 3.x
0083       echo "search include .*:(.*):\"$root/include/c++/$v/backward/\$1\"" # 3.x
0084       echo "search include .*:(.*):\"$root/include/c++/$v/ext/\$1\"" # 3.x
0085       echo "search include .*:(.*):\"$root/include/g++/\$1\"" # 2.x
0086 
0087       echo 'match '$dir'/:"<Compiler>"'
0088       echo 'match '$root'/include/c\+\+/:"<Compiler>"'
0089       echo 'match '$root'/include/g\+\+/:"<Compiler>"'
0090 
0091       echo 'symbol ignore . ^MAIN__$'
0092       echo 'symbol ignore . ^_GLOBAL_OFFSET_TABLE_$'
0093 
0094       case $v in
0095         2.* )
0096           echo 'symbol ignore . ^__builtin'
0097           echo 'symbol ignore . ^__pure_virtual'
0098           echo 'symbol ignore . ^__u(div|mod)di'
0099 
0100           echo 'symbol ignore . ^__eh_'
0101           echo 'symbol ignore . ^__gmon_'
0102           echo 'symbol ignore . ^__libc_'
0103           echo 'symbol ignore . ^_IO_'
0104 
0105           echo 'symbol ignore . ^__ti'
0106           echo 'symbol ignore . ^__tft?\d'
0107           echo 'symbol ignore . ^__vt_'
0108 
0109           echo 'symbol ignore . ^_\._9bad_alloc$'
0110           ;;
0111         3.* )
0112           echo 'symbol ignore . ^__pure_virtual' # FIXME: Temporary to disambiguate 2.95 CLHEP/GEANT4
0113           echo 'symbol ignore . ^__dso_handle$'
0114 
0115           echo 'symbol ignore . ^_ZTI'
0116           echo 'symbol ignore . ^_ZTV'
0117           echo 'symbol ignore . ^_ZTT'
0118 
0119           echo 'symbol ignore . ^_ZNSs4_Rep11_S_terminalE$'
0120           echo 'symbol ignore . ^_ZNSs4_Rep11_S_max_sizeE$'
0121           echo 'symbol ignore . ^_ZNSt24__default_alloc_templateILb1ELi0EE22_S_node_allocator_lockE$'
0122           ;;
0123       esac
0124       ;;
0125       
0126     */SunCC )
0127       cxx=`cd $DIST; scram tool tag $name CXX`
0128       root=`echo $cxx | sed 's|/bin/[^/]*$||'`
0129       v=WS6U1; [ -d $root/$v ] || v=WS6U2
0130       echo "scan libs $root/lib"
0131       echo "search include .*:(.*):\"$root/$v/include/CC/Cstd/\$1\""
0132       echo "search include .*:(.*):\"$root/$v/include/CC/std/\$1\""
0133       echo "search include .*:(.*):\"$root/$v/include/CC/\$1\""
0134       echo "search include .*:(.*):\"$root/$v/include/cc/\$1\""
0135 
0136       echo "match $root/lib/:'<Compiler>'"
0137       echo "match $root/$v/include/CC/:'<Compiler>'"
0138       echo "match $root/$v/include/cc/:'<Compiler>'"
0139 
0140       echo "# ignore compiler builtins that may have been pulled into shared libs"
0141       echo "# or just may be missing for a random reason (e.g. compiler generated),"
0142       echo "# or may be duplicated safely (e.g. virtual function tables, template"
0143       echo "# instantiations)"
0144       echo "symbol ignore . __vtbl\$"
0145       echo "symbol ignore . ^__0[FO]"
0146       echo "symbol ignore . ^__0[fo].(vector|allocator|basic_string|os_[a-z_]+)"
0147       echo "symbol ignore . ^__0[fo].(opiVArray|[HT]_([A-Z]|2D_)[A-Za-z_]+)"
0148       echo "symbol ignore . ^__0[fo].((Even|Uneven)_Partition)"
0149       echo "symbol ignore . ^__rtbany\$"
0150       echo "symbol ignore . ^__rtu__"
0151       echo "symbol ignore . ^\.[a-z]"
0152       echo "symbol ignore . ^__copyright\$"
0153       ;;
0154   esac
0155 
0156   for incdir in `cd $DIST; scram tool info $name | grep '^INCLUDE=' | sed 's/^INCLUDE=//;'`; do
0157     case $tooltype/$toolname in
0158       LHC++/T_HTL ) ;;
0159       */Sockets ) ;;
0160 
0161       */OSCAR | */COBRA | */IGUANA )
0162         echo "search include .*:(.*):\"$incdir/\$1\""
0163         echo "match ^$incdir/([^/]+)/([^/]+)/:\"$toolname/\$1/\$2\""
0164         # Don't trust `Version', it may not be right in pre-releases
0165         base=`cd $DIST; scram tool info $name | grep '_BASE=' | sed 's/.*=//;'`
0166         v=`echo $base | sed 's|.*/||; s/^[^_]*_//;'`
0167         if [ -f $base/doc/deps/$1/log.gz ]; then
0168           echo "scan libs $libdir"
0169           gzip -d -c < $base/doc/deps/$1/log.gz | \
0170             grep "match.*$toolname.*/lib" | \
0171             grep -v 'UNKNOWN' | sed "s|:'|:'$toolname/|"
0172           grep "match /lib/.*cmodule\.so\$:.*" < $base/doc/deps/$1/path-auto.conf
0173         fi
0174         ;;
0175 
0176       */X11 )
0177         echo "match ^/usr/openwin/:'System/X11'"
0178         echo "match ^/usr/X11R6/:'System/X11'"
0179         echo "match ^/usr/local/lib/libXpm\.:'System/X11'" ;;
0180 
0181       CERNLIB/* | */cmsim | */Python | */zlib | \
0182       LHC++/Nag_C | */OpenGL | */OpenInventor | */Qt | \
0183       */Xerces | */CenterPoint-XML | */TGSInventor | */Coin3D | \
0184       */Boost* )
0185         # echo "search include .*:(.*):\"$incdir/\$1\""
0186         # echo "match ^$incdir/:'$mapfullname'" ;;
0187         echo "search include .*:(.*):\"$incdir/\$1\""
0188         echo "match ^$incdir/:\"$mapfullname\"" ;;
0189 
0190       LHC++/Objectivity )
0191         # Avoid searching Objectivity, its `limits.h' confuses the
0192         # analysis.  The search directive below will not affect
0193         # compiled packages, they will still know if they included
0194         # something from Objectivity (via make dependency info).  The
0195         # directive is used only for LHC++ packages where we scan only
0196         # the source.
0197         echo "search include (HepODBMS|HTL):(.*):\"$incdir/\$1\""
0198         echo "search include .*:^(oo.*\.h)$:\"$incdir/\$1\""
0199         echo "match ^$incdir/:'$mapfullname'" ;;
0200 
0201       LHC++/ObjectSpace )
0202         echo "search include .*:(ospace/.*):\"$incdir/\$1\""
0203         echo "search include LHC\+\+:(.*):\"$incdir/\$1\""
0204         echo "match ^$incdir/:'$mapfullname'" ;;
0205 
0206       LHC++/FML_* )
0207         echo "scan src /afs/cern.ch/sw/lhcxx/share/$mapname/$version"
0208         echo "match ^/afs/cern.ch/sw/lhcxx/share/$mapname/:'$mapfullname'"
0209         echo "search include .*:(.*):\"$incdir/\$1\""
0210         case $incdir in */$mapname | */$mapname/* )
0211           echo "match ^$incdir/:'$mapfullname'" ;;
0212         esac
0213         echo "match ^$incdir/$mapname/:'$mapfullname'" ;;
0214 
0215       LHC++/GEANT4 )
0216         src=`cd $DIST; scram tool info $name | grep 'G4SRC=' | sed 's/.*=//;'`
0217         # echo "scan src $src"
0218         echo "search include .*:(.*):\"$incdir/\$1\""
0219         echo "match ^$incdir/:'$mapfullname'" ;;
0220 
0221       LHC++/* )
0222         # FIXME: Lizard needs this but COBRA doesn't use it?
0223         echo "match /include/VectorOfPoints/:'LHC++/VectorOfPoints'"
0224         echo "scan src /afs/cern.ch/sw/lhcxx/share/$toolname/$version"
0225         echo "match ^/afs/cern.ch/sw/lhcxx/share/$toolname/:'$mapfullname'"
0226         echo "search include .*:(.*):\"$incdir/\$1\""
0227         case $incdir in */$toolname | */$toolname/* )
0228           echo "match ^$incdir/:'$mapfullname'" ;;
0229         esac
0230         echo "match ^$incdir/$toolname/:'$mapfullname'" ;;
0231     esac
0232   done
0233 done
0234 
0235 echo "# Python modules"
0236 find $DIST/src -name \*_wrap.c | \
0237 while read file; do
0238   pkg=`echo $file | sed "s%^$DIST/src/%%; s%/python/.*%%"`
0239   mod=`echo $file | sed 's%.*/%%; s%_wrap.c%cmodule.so%'`
0240   echo "match /lib/[^/]+/$mod\$:'$pkg'"
0241 done
0242 
0243 echo "# Programs"
0244 find $DIST/src -name BuildFile | \
0245 while read file; do
0246   if grep -i '<bin.*name=' $file >/dev/null; then
0247     bins="`grep -i '<bin' $file | sed 's/.*<bin //; s/.*name=//; s/ .*//;'`"
0248   else
0249     bins="`grep -i '<bin' $file | sed 's/.*<bin //; s/.*file=//; s/\.c.*//;'`"
0250   fi
0251   for bin in $bins; do
0252     pkg=`echo $file | sed "s%^$DIST/src/%%; s%/\(test\|applications\)/.*%%; s%/BuildFile\$%%"`
0253     echo "match /bin/[^/]+(/[^/]+)?/$bin\$:'$pkg'"
0254   done
0255 done
0256 
0257 echo "# SCRAM defaults"
0258 echo 'option define package            -d "$dir/$file/.admin"'
0259 echo 'option define package-type       grep(m|^\Q$path/|, keys %packages) ? "subsystem" : "leaf"'
0260 echo 'option define package-match-rule "^(\Q$root/\E)?((\\.)?\\/)?\Q@{[&concat_path($src_root, $fullname)]}/\E"'
0261 echo 'option define package-match-rule "^\Q@{[&concat_path($incdir, $src_root, $fullname)]}/\E"'
0262 echo 'option define package-match-rule "^\Q@{[&concat_path($root, $build_root, $fullname)]}/\E"'
0263 echo 'option define package-match-rule "^\Q@{[&concat_path($bindir, $name)]}\E\$"'
0264 echo 'option define package-match-rule "^\Q$bindir/\E(example|test)_\Q$name\E(_[^/]+)?\$"'
0265 echo 'option define package-match-rule "^\Q@{[&concat_path($libdir, '\''lib'\''.$name)]}\E(_[a-z_]+)?\.(so|a)"'
0266 echo 'option define package-build-dir  &concat_path($root, $build_root, $name, $relative)'
0267 
0268 echo 'search include .*:(.*):"$incdir/src/$1"'
0269 echo 'search include .*:(.*):"$root/src/$name/interface/$1"'
0270 echo 'search include .*:(.*):"$root/src/$name/include/$1"'
0271 echo 'search include .*:(.*):"$root/src/$1"'
0272 echo 'search include .*:(.*):"/usr/include/$1"'
0273 echo 'search include .*:(.*):"/usr/local/include/$1"'
0274 echo 'search include .*:^(/.*):"$1"' >> $sconf
0275 
0276 echo '# don'\''t allow standard headers from object space to confuse search'
0277 echo 'reject include ^(algorithm|bitset|deque|exception|[a-z]*stream[a-z]*|functional)$'
0278 echo 'reject include ^(io[a-z]+|iterator|limits|list|map|memory|new|numeric|queue|set|stack)$'
0279 echo 'reject include ^(stdexcept|string|typeinfo|utility|vector)$'
0280 echo 'reject include ^c[a-z]+$'
0281 
0282 echo 'match /include/Xm/:"System/Motif"'
0283 echo 'match /lib/libXm\.:"System/Motif"'
0284 echo 'match ^/usr/local/(lib|include)/([^/]+):"ASIS/$2"'
0285 echo 'match ^/usr/(lib|include)/:"<OS>"'
0286 echo 'match ^/lib/:"<OS>"'
0287 
0288 echo 'output ignore package ^<Compiler>$'
0289 echo 'output ignore package ^<OS>$'
0290 echo 'output ignore binary ^/usr/'