~ubuntu-branches/ubuntu/saucy/di/saucy

« back to all changes in this revision

Viewing changes to mkconfig/mkstaticlib.sh

  • Committer: Bazaar Package Importer
  • Author(s): Michael Ablassmeier
  • Date: 2010-08-08 22:40:18 UTC
  • mto: (3.1.5 sid) (1.1.11 upstream)
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20100808224018-g3c2h2nlwtcd37ve
ImportĀ upstreamĀ versionĀ 4.26

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# $Id: mkstaticlib.sh,v 1.3 2010-07-23 15:57:51-07 bll Exp $
 
4
#
 
5
# Copyright 2010 Brad Lanam Walnut Creek, CA USA
 
6
#
 
7
 
 
8
# this is a workaround for ksh93 on solaris
 
9
if [ "$1" = "-d" ]; then
 
10
  cd $2
 
11
  shift
 
12
  shift
 
13
fi
 
14
mypath=`echo $0 | sed -e 's,/[^/]*$,,'`
 
15
_MKCONFIG_DIR=`(cd $mypath;pwd)`
 
16
export _MKCONFIG_DIR
 
17
. ${_MKCONFIG_DIR}/shellfuncs.sh
 
18
 
 
19
doshelltest $0 $@
 
20
setechovars
 
21
 
 
22
libnm=""
 
23
objects=""
 
24
grc=0
 
25
doecho=F
 
26
 
 
27
for f in $@; do
 
28
  case $f in
 
29
    "-e")
 
30
      doecho=T
 
31
      ;;
 
32
    *${OBJ_EXT})
 
33
      if [ ! -f "$f" ]; then
 
34
        echo "## unable to locate $f"
 
35
        grc=1
 
36
      else
 
37
        doappend objects " $f"
 
38
      fi
 
39
      ;;
 
40
    *)
 
41
      if [ "$libnm" = "" ]; then
 
42
        libnm=$f
 
43
        continue
 
44
      fi
 
45
      ;;
 
46
  esac
 
47
done
 
48
 
 
49
locatecmd ranlibcmd ranlib
 
50
locatecmd arcmd ar
 
51
locatecmd lordercmd lorder
 
52
locatecmd tsortcmd tsort
 
53
 
 
54
if [ "$arcmd" = "" ]; then
 
55
  echo "## Unable to locate 'ar' command"
 
56
  grc=1
 
57
fi
 
58
 
 
59
if [ $grc -eq 0 ]; then
 
60
  dosubst libnm '${SHLIB_EXT}$' '' '^lib' ''
 
61
  libfnm=lib${libnm}.a
 
62
  # for really old systems...
 
63
  if [ "$ranlibcmd" = "" -a "$lordercmd" != "" -a "$tsortcmd" != "" ]; then
 
64
    objects=`$lordercmd ${objects} | $tsortcmd`
 
65
  fi
 
66
  test -f $libfnm && rm -f $libfnm
 
67
  cmd="$arcmd cq $libfnm ${objects}"
 
68
  if [ $doecho = "T" ]; then
 
69
    echo $cmd
 
70
  fi
 
71
  eval $cmd
 
72
  rc=$?
 
73
  if [ $rc -ne 0 ]; then grc=$rc; fi
 
74
  if [ "$ranlibcmd" != "" ]; then
 
75
    cmd="$ranlibcmd $libfnm"
 
76
    echo $cmd
 
77
    eval $cmd
 
78
    rc=$?
 
79
    if [ $rc -ne 0 ]; then grc=$rc; fi
 
80
  fi
 
81
fi
 
82
 
 
83
exit $grc