summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjlam <jlam>2007-08-02 15:46:33 +0000
committerjlam <jlam>2007-08-02 15:46:33 +0000
commit0cf4dd7b5a122adcb358bbda2a6a036d10604cab (patch)
treeba806b5724bd22d3c208a74c2d95d6a4538b8f6c /mk
parent967c5311f53a249abd1f7d6d0c5537fa41e26d30 (diff)
downloadpkgsrc-0cf4dd7b5a122adcb358bbda2a6a036d10604cab.tar.gz
Rewrite in a more portable way (basically cripple ourselves to Solaris
/bin/sh).
Diffstat (limited to 'mk')
-rwxr-xr-xmk/scripts/shlib-type46
1 files changed, 21 insertions, 25 deletions
diff --git a/mk/scripts/shlib-type b/mk/scripts/shlib-type
index 5a42b58f94e..f6626a85843 100755
--- a/mk/scripts/shlib-type
+++ b/mk/scripts/shlib-type
@@ -1,6 +1,6 @@
# /bin/sh
#
-# $NetBSD: shlib-type,v 1.1 2007/07/18 18:01:03 jlam Exp $
+# $NetBSD: shlib-type,v 1.2 2007/08/02 15:46:33 jlam Exp $
#
# This code is derived from software contributed to The NetBSD Foundation
# by Alistair Crooks.
@@ -11,41 +11,37 @@
# format (either ELF or a.out).
#
-: ${ECHO=echo}
-: ${FILE_CMD=file}
-: ${TEST=test}
-: ${PKG_INFO_CMD=/usr/sbin/pkg_info}
+if [ -z "${FILE_CMD}" ]; then
+ FILE_CMD=file
+fi
+if [ -z "${PKG_INFO_CMD}" ]; then
+ PKG_INFO_CMD=/usr/sbin/pkg_info
+fi
-self="${0##*/}"
-
-usage() {
- ${ECHO} 1>&2 "usage: $self libformat"
-}
-
-${TEST} $# -gt 0 || { usage; exit 1; }
+if [ $# -eq 0 ]; then
+ echo 1>&2 "usage: shlib-type libformat"
+ exit 1
+fi
sotype=none
case "$1" in
ELF/a.out)
- case "${PKG_INFO_CMD}" in
- /*) ;;
- *) PKG_INFO_CMD="/usr/sbin/pkg_info"
- esac
- if ${TEST} -f ${PKG_INFO_CMD}; then
- case `${FILE_CMD} ${PKG_INFO_CMD}` in
- *ELF*dynamically*) sotype="ELF" ;;
- *shared*library*) sotype="a.out" ;;
- *dynamically*) sotype="a.out" ;;
- esac
+ if [ -f "${PKG_INFO_CMD}" ]; then
+ output=`${FILE_CMD} ${PKG_INFO_CMD} 2>/dev/null`
else
- # "pkg_info" is missing so just guess "ELF.
- sotype="ELF"
+ output=
fi
+ case "$output" in
+ *ELF*dynamically*) sotype="ELF" ;;
+ *shared*library*) sotype="a.out" ;;
+ *dynamically*) sotype="a.out" ;;
+ *) sotype="ELF" ;; # guess "ELF"
+ esac
;;
*)
sotype="$1"
;;
esac
-${ECHO} $sotype
+echo $sotype
exit 0