[1] | 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 | extract=$1 |
---|
| 20 | shift |
---|
| 21 | |
---|
| 22 | tag=$1 |
---|
| 23 | shift |
---|
| 24 | |
---|
| 25 | lib=$1 |
---|
| 26 | shift |
---|
| 27 | |
---|
| 28 | extra=$* |
---|
| 29 | |
---|
| 30 | here=`pwd` |
---|
| 31 | |
---|
| 32 | ld=`${CMTROOT}/mgr/cmt show macro_value shlibbuilder -tag=${tag}` |
---|
| 33 | ldflags=`${CMTROOT}/mgr/cmt show macro_value shlibflags -tag=${tag}` |
---|
| 34 | suffix=`${CMTROOT}/mgr/cmt show macro_value shlibsuffix -tag=${tag}` |
---|
| 35 | libprefix=`${CMTROOT}/mgr/cmt show macro_value library_prefix -tag=${tag}` |
---|
| 36 | libsuffix=`${CMTROOT}/mgr/cmt show macro_value library_suffix -tag=${tag}` |
---|
| 37 | |
---|
| 38 | if test "${ld}" = "" ; then |
---|
| 39 | exit 1 |
---|
| 40 | fi |
---|
| 41 | |
---|
| 42 | libname=${libprefix}${lib}${libsuffix} |
---|
| 43 | /bin/rm -f ${libname}.${suffix} |
---|
| 44 | |
---|
| 45 | result=0 |
---|
| 46 | |
---|
| 47 | temp_shlib=${lib}temp_shlib |
---|
| 48 | |
---|
| 49 | if 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 | modules=`ls -1 ${temp_shlib} | sed -e 's#^#'${temp_shlib}'/#'` |
---|
| 58 | |
---|
| 59 | if test "${QUIET}" = ""; then set -v; fi |
---|
| 60 | eval ${ld} ${ldflags} -o ${libname}.${suffix} ${modules} ${extra} |
---|
| 61 | result=$? |
---|
| 62 | if test "${QUIET}" = ""; then set +v; fi |
---|
| 63 | |
---|
| 64 | /bin/rm -rf ${temp_shlib} |
---|
| 65 | |
---|
| 66 | else |
---|
| 67 | |
---|
| 68 | if test "${QUIET}" = ""; then set -v; fi |
---|
| 69 | |
---|
| 70 | eval ${ld} ${ldflags} -all ${libname}.a -o ${libname}.${suffix} ${extra} -rpath `pwd` |
---|
| 71 | result=$? |
---|
| 72 | |
---|
| 73 | if test "${QUIET}" = ""; then set +v; fi |
---|
| 74 | |
---|
| 75 | fi |
---|
| 76 | |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | |
---|