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 | |
---|
19 | |
---|
20 | extract=$1 |
---|
21 | shift |
---|
22 | |
---|
23 | tag=$1 |
---|
24 | shift |
---|
25 | |
---|
26 | lib=$1 |
---|
27 | shift |
---|
28 | |
---|
29 | extra=$* |
---|
30 | |
---|
31 | here=`pwd` |
---|
32 | |
---|
33 | ld=`${CMTROOT}/mgr/cmt show macro_value shlibbuilder -tag=${tag}` |
---|
34 | ldflags=`${CMTROOT}/mgr/cmt show macro_value shlibflags -tag=${tag}` |
---|
35 | suffix=`${CMTROOT}/mgr/cmt show macro_value shlibsuffix -tag=${tag}` |
---|
36 | |
---|
37 | if test "${ld}" = "" ; then |
---|
38 | exit 1 |
---|
39 | fi |
---|
40 | |
---|
41 | /bin/rm -f lib${lib}.${suffix} |
---|
42 | |
---|
43 | result=0 |
---|
44 | |
---|
45 | temp_shlib=${lib}temp_shlib |
---|
46 | |
---|
47 | if test ${extract} = "extract"; then |
---|
48 | trap 'cd ${here}; /bin/rm -rf ${temp_shlib}; exit ${result}' 0 1 2 15 |
---|
49 | |
---|
50 | mkdir -p ${temp_shlib} |
---|
51 | /bin/rm -f ${temp_shlib}/* |
---|
52 | |
---|
53 | (cd ${temp_shlib}; ar x ../lib${lib}.a) |
---|
54 | |
---|
55 | eval ${ld} ${ldflags} -o lib${lib}.${suffix} `ls -1 ${temp_shlib} | sed -e 's#^'${lib}'temp_shlib/##'` ${extra} |
---|
56 | result=$? |
---|
57 | |
---|
58 | /bin/rm -rf ${temp_shlib} |
---|
59 | else |
---|
60 | eval ${ld} ${ldflags} -all lib${lib}.a -o lib${lib}.${suffix} ${extra} -rpath `pwd` |
---|
61 | result=$? |
---|
62 | fi |
---|
63 | |
---|
64 | |
---|
65 | |
---|
66 | |
---|
Note: See
TracBrowser
for help on using the repository browser.