source: CMT/v1r19/mgr/cmt_make_shlib_common.sh @ 1

Last change on this file since 1 was 1, checked in by arnault, 19 years ago

Import all tags

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