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 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
|
#! /bin/sh
args=`getopt d:f:v $*`
set -- $args
LF=
V=": "
for i
do
case "$i" in
-d) sdir="$2" ; shift 2 ;;
-f) locfile="$2" ; shift 2 ;;
-v) V= ; shift ;;
--) shift ; break ;;
esac
done
case "$sdir" in
'')
sdir=.
esac
case "$locfile" in
*/*)
LF=$locfile
;;
'')
;;
*)
lf=loc/$locfile
if test -f $lf
then
LF=$lf
fi
;;
esac
# If we have a file to use (ie, LF is not empty) then look for one.
case "$LF" in
'')
PATH=$PATH:libevent/build-aux
export PATH
set `scripts/cvo.sh @osname@ @osver@` || exit 1
CVO_OSNAME=$1
CVO_OSVER=$2
x=$CVO_OSVER
while true
do
case "$x" in
'') break ;;
esac
lf=loc/$CVO_OSNAME$x
${V}echo "Looking for <$lf>" >&2
if test -f $lf
then
LF=$lf
break
fi
case "$x" in
*.*) x=`echo $x | sed -e 's/\.[^.]*$//'` ;;
*) x= ;;
esac
done
case "$LF" in
'')
lf=loc/$CVO_OSNAME
${V}echo "Looking for <$lf>" >&2
if test -f $lf
then
LF=$lf
fi
;;
esac
# Handle some "aliases"
case "$LF" in
'')
case "$CVO_OSNAME" in
raspbian*)
lf=loc/debian
${V}echo "Looking for <$lf>" >&2
if test -f $lf
then
LF=$lf
fi
;;
redhat* | fedora*)
lf=loc/redhat
${V}echo "Looking for <$lf>" >&2
if test -f $lf
then
LF=$lf
fi
;;
esac
;;
esac
# This might be a good place to see if uname returns "Linux",
# and if so, use a generic file for that.
case "$LF" in
'')
case "`uname`" in
Linux)
lf=loc/linux
${V}echo "Looking for <$lf>" >&2
if test -f $lf
then
LF=$lf
fi
;;
esac
;;
esac
# Finally, 'legacy'
case "$LF" in
'')
lf=loc/legacy
${V}echo "Looking for <$lf>" >&2
if test -f $lf
then
LF=$lf
fi
;;
esac
case "$LF" in
'')
echo "No loc/XXX file found!" >&2
exit 1
;;
esac
;;
esac
${V}echo "Using <$LF>" >&2
echo "GENLOCINFOFILE=$LF"
###
rm -f $sdir/genLocInfo.rc?
oIFS=$IFS
IFS=","
while true
do
if read c d s x
then
# echo "Got <$c><$d><$s><$x>" >&2
case "$c" in
\#*) continue ;;
esac
case "$x" in
'') ;;
*) echo "Unrecognized input: <$c,$d,$s,$x>" >&2
touch $sdir/genLocInfo.rc1
continue
;;
esac
case "$c,$d,$s" in
[Mm][Aa][Nn],,)
echo "MANTAGFMT=man"
continue
;;
[Mm][Dd][Oo][Cc],,)
echo "MANTAGFMT=mdoc"
continue
;;
esac
case "$c,$d,$s" in
*,bin,*) DB=bin ; DL= ; DS= ; NI= ;;
*,libexec,*) DB= ; DL=libexec ; DS= ; NI= ;;
*,noinst,*) DB= ; DL= ; DS= ; NI=noinst ;;
*,sbin,*) DB= ; DL= ; DS=sbin ; NI= ;;
*) echo "Unrecognized input: <$c,$d,$s>" >&2
touch $sdir/genLocInfo.rc1
continue
;;
esac
case "$c,$d,$s" in
*,*,1) ;;
*,*,1m) ;;
*,*,1M) ;;
*,*,8) ;;
*) echo "Unrecognized input: <$c,$d,$s>" >&2
touch $sdir/genLocInfo.rc1
continue
;;
esac
# Should be OK, mostly...
C=`echo $c | sed -e 'y/abcdefghijklmnopqrstuvwxyz-/ABCDEFGHIJKLMNOPQRSTUVWXYZ_/'`
# echo "c: <$c>, C: <$C>, DB: <$DB>, DL: <$DL>, DS: <$DS>" >&2
case "$d" in
bin)
eval ${C}_DB=$c
eval ${C}_DL=
eval ${C}_DS=
eval ${C}_NI=
;;
libexec)
eval ${C}_DB=
eval ${C}_DL=$c
eval ${C}_DS=
eval ${C}_NI=
;;
noinst)
eval ${C}_DB=
eval ${C}_DL=
eval ${C}_DS=
eval ${C}_NI=$c
;;
sbin)
eval ${C}_DB=
eval ${C}_DL=
eval ${C}_DS=$c
eval ${C}_NI=
;;
*) echo "$0: installdir <$d> must be bin, sbin, libexec, or noinst" >&2
exit 1
;;
esac
eval ${C}_MS=$s
# echo "<$c> gets installed in <$d> with a <$s> manpage suffix" >&2
# echo "${C}_DB is <`eval echo '$'${C}_DB`>" >&2
# echo "${C}_DL is <`eval echo '$'${C}_DL`>" >&2
# echo "${C}_DS is <`eval echo '$'${C}_DS`>" >&2
# echo "${C}_NI is <`eval echo '$'${C}_NI`>" >&2
# echo "${C}_MS is <`eval echo '$'${C}_MS`>" >&2
echo "${C}_DB=`eval echo '$'${C}_DB`"
echo "${C}_DL=`eval echo '$'${C}_DL`"
echo "${C}_DS=`eval echo '$'${C}_DS`"
echo "${C}_NI=`eval echo '$'${C}_NI`"
echo "${C}_MS=`eval echo '$'${C}_MS`"
touch $sdir/genLocInfo.rc0
else
break
fi
done < $LF
IFS=$oIFS
if test -f $sdir/genLocInfo.rc1
then
rm $sdir/genLocInfo.rc?
exit 1
fi
if test -f $sdir/genLocInfo.rc0
then
rm $sdir/genLocInfo.rc?
echo 'GENLOCINFO=OK'
exit 0
fi
exit 1
|