source: CMT/v1r21/mgr/cmt_make_shlib_common.sh

Last change on this file was 469, checked in by rybkin, 16 years ago

See C.L. 370

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 2.0 KB
Line 
1#!/bin/sh
2
3#set -x
4
5#------------------------------------------------------
6#
7#  Syntax :
8#
9#  cmt_make_shlib_common.sh extract-arg tag library extra-args
10#
11#   with :
12#
13#      extract-arg  : either "extract" or "no_extract"
14#      tag          : the current tag(s)
15#      library      : the name of the library
16#      extra-args   : extra link options
17#
18#------------------------------------------------------
19
20extract=$1
21shift
22
23tag=$1
24shift
25
26lib=$1
27shift
28
29extra=$*
30
31ld=`${CMTROOT}/mgr/cmt show macro_value shlibbuilder -tag=${tag}`
32ldflags=`${CMTROOT}/mgr/cmt show macro_value shlibflags -tag=${tag}`
33suffix=`${CMTROOT}/mgr/cmt show macro_value shlibsuffix -tag=${tag}`
34libprefix=`${CMTROOT}/mgr/cmt show macro_value library_prefix -tag=${tag}`
35libsuffix=`${CMTROOT}/mgr/cmt show macro_value library_suffix -tag=${tag}`
36
37libname=${libprefix}${lib}${libsuffix}
38
39if test "${ld}" = "" ; then
40  exit 1
41fi
42
43if test "${bin}" = "" ; then
44  bin=`${CMTROOT}/mgr/cmt show macro_value bin -tag=${tag}`
45fi
46
47here=`/bin/pwd`
48cd ${bin}
49
50/bin/rm -f ${libname}.${suffix}
51
52result=0
53
54temp_shlib=${lib}temp_shlib
55
56if test ${extract} = "extract"; then
57  trap '/bin/rm -rf ${temp_shlib}; cd ${here}; exit ${result}' 1 2 15
58
59  mkdir -p ${temp_shlib}
60  /bin/rm -f ${temp_shlib}/*
61
62  (cd ${temp_shlib}; ar x ../${libname}.a)
63
64  #
65  # Build a protected list of modules just extracted from
66  # the static library
67  #  Files containing space characters are accepted
68  #
69  test -z "$GREP_OPTIONS" || GREP_OPTIONS=
70  modules=`ls -1 ${temp_shlib} | \
71           grep '[.]o$' | \
72           sed -e 's#^#'${temp_shlib}'/#' \
73               -e 's#^#"#g' \
74               -e 's#$#"#'`
75
76  if test "${QUIET}" = ""; then set -v; fi
77
78  eval ${ld} ${ldflags} -o ${libname}.${suffix} ${modules} ${extra}
79  result=$?
80
81  if test "${QUIET}" = ""; then set +v; fi
82
83  /bin/rm -rf ${temp_shlib}
84
85else
86
87  if test "${QUIET}" = ""; then set -v; fi
88
89  eval ${ld} ${ldflags} -all ${libname}.a -o ${libname}.${suffix} ${extra} -rpath `/bin/pwd`
90  result=$?
91
92  if test "${QUIET}" = ""; then set +v; fi
93
94fi
95
96cd ${here}
97exit ${result}
Note: See TracBrowser for help on using the repository browser.