[1] | 1 | #!/bin/sh -f |
---|
| 2 | |
---|
| 3 | #------------------------------------------------- |
---|
| 4 | help () |
---|
| 5 | #------------------------------------------------- |
---|
| 6 | { |
---|
| 7 | echo "$1 [make | update] <package> <version> [<root>]" |
---|
| 8 | echo "" |
---|
| 9 | echo " make : rebuild the package" |
---|
| 10 | echo " update : cvs-update the package" |
---|
| 11 | } |
---|
| 12 | |
---|
| 13 | #-------------------------------------------------- |
---|
| 14 | configure_which () |
---|
| 15 | #-------------------------------------------------- |
---|
| 16 | { |
---|
| 17 | if test ! "${CMT_WHICH}" = "" ; then |
---|
| 18 | which_cmd=${CMT_WHICH}; export which_cmd |
---|
| 19 | else |
---|
| 20 | which_cmd=`${CMTROOT}/mgr/cmt_which.sh; export which_cmd` |
---|
| 21 | CMT_WHICH=${which_cmd}; export CMT_WHICH |
---|
| 22 | fi |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | #-------------------------------------------------- |
---|
| 26 | which_file () |
---|
| 27 | #-------------------------------------------------- |
---|
| 28 | { |
---|
| 29 | ${which_cmd} $1 1>/dev/null 2>/dev/null |
---|
| 30 | return $? |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | #------------------------------------------------- |
---|
| 34 | # main () |
---|
| 35 | #------------------------------------------------- |
---|
| 36 | |
---|
| 37 | p=`dirname $0` |
---|
| 38 | p=`dirname $p` |
---|
| 39 | |
---|
| 40 | if test "${p}" = "." ; then # When $0 does not work |
---|
| 41 | p=`find_file cmt` |
---|
| 42 | p=`dirname $p` |
---|
| 43 | p=`dirname $p` |
---|
| 44 | fi |
---|
| 45 | |
---|
| 46 | if test "${p}" = "." ; then # When we are inside cmt |
---|
| 47 | p=`pwd` |
---|
| 48 | p=`dirname $p` |
---|
| 49 | fi |
---|
| 50 | |
---|
| 51 | CMTROOT=${p}; export CMTROOT |
---|
| 52 | |
---|
| 53 | configure_which |
---|
| 54 | |
---|
| 55 | test $# -lt 1 |
---|
| 56 | if test "$?" = 0 ; then |
---|
| 57 | help $0 |
---|
| 58 | exit 1 |
---|
| 59 | fi |
---|
| 60 | |
---|
| 61 | command=$1 |
---|
| 62 | shift |
---|
| 63 | |
---|
| 64 | root=`dirname $0` |
---|
| 65 | root=`dirname $root` |
---|
| 66 | cmtroot=$root |
---|
| 67 | |
---|
| 68 | if test ${cmtroot} = "." ; then |
---|
| 69 | root=`pwd | sed 's#/tmp_mnt/lal_prod/common#/lal#'` |
---|
| 70 | root=`dirname $root` |
---|
| 71 | cmtroot=$root |
---|
| 72 | fi |
---|
| 73 | |
---|
| 74 | root=`dirname $root` |
---|
| 75 | root=`dirname $root` |
---|
| 76 | |
---|
| 77 | if test -d "/virgoApp" ; then |
---|
| 78 | root=/virgoApp |
---|
| 79 | fi |
---|
| 80 | |
---|
| 81 | PATH=${PATH}:/usr/local1/bin |
---|
| 82 | |
---|
| 83 | package=$1 |
---|
| 84 | version=$2 |
---|
| 85 | ppath=$3 |
---|
| 86 | |
---|
| 87 | if test "$ppath" = "" ; then |
---|
| 88 | p=${root}/${package}/${version}/mgr |
---|
| 89 | else |
---|
| 90 | c=`echo ${ppath} | sed 's#^[/].*#/#'` |
---|
| 91 | if test "$c" = "/" ; then |
---|
| 92 | p=${ppath}/${package}/${version}/mgr |
---|
| 93 | else |
---|
| 94 | p=${root}/${ppath}/${package}/${version}/mgr |
---|
| 95 | fi |
---|
| 96 | fi |
---|
| 97 | |
---|
| 98 | cd $p |
---|
| 99 | |
---|
| 100 | if test "$?" = 1 ; then |
---|
| 101 | echo "Bad path specification $p" |
---|
| 102 | exit 1 |
---|
| 103 | fi |
---|
| 104 | |
---|
| 105 | if test ! -f setup.csh ; then |
---|
| 106 | ${cmtroot}/mgr/cmt config |
---|
| 107 | fi |
---|
| 108 | |
---|
| 109 | |
---|
| 110 | if test ${command} = "make" ; then |
---|
| 111 | |
---|
| 112 | extra= |
---|
| 113 | if test ${package} = "cmt" ; then |
---|
| 114 | which_file gcc |
---|
| 115 | if test "$?" = 1 ; then |
---|
| 116 | extra="cc=cc" |
---|
| 117 | fi |
---|
| 118 | fi |
---|
| 119 | |
---|
| 120 | csh -c "(source setup.csh; make ${extra})" |
---|
| 121 | |
---|
| 122 | else |
---|
| 123 | |
---|
| 124 | if test ${command} = "update" ; then |
---|
| 125 | |
---|
| 126 | cd ../ |
---|
| 127 | cvs update |
---|
| 128 | |
---|
| 129 | else |
---|
| 130 | |
---|
| 131 | help $0 |
---|
| 132 | |
---|
| 133 | fi |
---|
| 134 | |
---|
| 135 | fi |
---|
| 136 | |
---|
| 137 | |
---|
| 138 | |
---|