summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2006-07-21 13:40:27 +0000
committerjlam <jlam@pkgsrc.org>2006-07-21 13:40:27 +0000
commit80369fb5c80688141530f04aa82e74bfe60819c4 (patch)
tree6f1170c156653d278bad91beb268353531631e89 /mk
parent60e1b70303a29ff9a30e7c0dd76cd3611d8522f6 (diff)
downloadpkgsrc-80369fb5c80688141530f04aa82e74bfe60819c4.tar.gz
Modify the shlib-type script so that it doesn't need to compile anything
-- instead, we just check "pkg_info", which should exist on all pkgsrc platforms. XXX Note that this may need to change when we later support other package XXX system flavors. Back out revision 1.79 of pkgtools/x11-links/Makefile which was only to work around needing a C compiler for shlib-type to work.
Diffstat (limited to 'mk')
-rw-r--r--mk/plist/plist.mk7
-rwxr-xr-xmk/plist/shlib-type41
2 files changed, 22 insertions, 26 deletions
diff --git a/mk/plist/plist.mk b/mk/plist/plist.mk
index 131e57a6d5b..3b0e3101140 100644
--- a/mk/plist/plist.mk
+++ b/mk/plist/plist.mk
@@ -1,4 +1,4 @@
-# $NetBSD: plist.mk,v 1.14 2006/07/15 23:58:52 rillig Exp $
+# $NetBSD: plist.mk,v 1.15 2006/07/21 13:40:27 jlam Exp $
#
# This Makefile fragment handles the creation of PLISTs for use by
# pkg_create(8).
@@ -163,9 +163,8 @@ _SHLIB_AWKFILE.none= ${.CURDIR}/../../mk/plist/shlib-none.awk
# SHLIB_TYPE is the type of shared library supported by the platform.
SHLIB_TYPE= ${_SHLIB_TYPE_cmd:sh}
_SHLIB_TYPE_cmd= \
- ${SETENV} CC=${CC:Q} ECHO=${TOOLS_ECHO:Q} \
- FILE_CMD=${TOOLS_FILE_CMD:Q} MKDIR=${TOOLS_MKDIR:Q} \
- RM=${TOOLS_RM:Q} TEST=${TOOLS_TEST:Q} \
+ ${SETENV} ECHO=${TOOLS_ECHO:Q} FILE_CMD=${TOOLS_FILE_CMD:Q} \
+ TEST=${TOOLS_TEST:Q} PKG_INFO_CMD=${PKG_INFO_CMD:Q} \
${SH} ${.CURDIR}/../../mk/plist/shlib-type ${_OPSYS_SHLIB_TYPE:Q}
######################################################################
diff --git a/mk/plist/shlib-type b/mk/plist/shlib-type
index a657d4e05f0..56ebb365a0f 100755
--- a/mk/plist/shlib-type
+++ b/mk/plist/shlib-type
@@ -1,22 +1,20 @@
# /bin/sh
#
-# $NetBSD: shlib-type,v 1.2 2006/01/19 17:24:44 jlam Exp $
+# $NetBSD: shlib-type,v 1.3 2006/07/21 13:40:27 jlam Exp $
#
# This code is derived from software contributed to The NetBSD Foundation
# by Alistair Crooks.
#
-# This script returns the the library format for the platform. If the
-# library format is "ELF/a.out", then a small program is compiled to
-# determine the correct object format (either ELF or a.out).
+# This script returns the the library format for the platform. If
+# the library format is "ELF/a.out", then we inspect "pkg_info" (which
+# should exist on a pkgsrc system) to determine the correct object
+# format (either ELF or a.out).
#
-: ${CC=cc}
: ${ECHO=echo}
: ${FILE_CMD=file}
-: ${RM=rm}
-: ${MKDIR=mkdir}
: ${TEST=test}
-: ${TMPDIR=/tmp}
+: ${PKG_INFO_CMD=/usr/sbin/pkg_info}
self="${0##*/}"
@@ -29,20 +27,19 @@ ${TEST} $# -gt 0 || { usage; exit 1; }
sotype=none
case "$1" in
ELF/a.out)
- tmpdir="${TMPDIR}/shlib-type.$$"
- umask 077 && ${MKDIR} "$tmpdir"
- if ${TEST} -d "$tmpdir"; then
- cd $tmpdir
- ${ECHO} "int main() { return(0); }" > a.c
- ${CC} ${CFLAGS} a.c -o a.out >/dev/null 2>&1
- if ${TEST} -f "a.out"; then
- case `${FILE_CMD} a.out` in
- *ELF*dynamically*) sotype="ELF" ;;
- *shared*library*) sotype="a.out" ;;
- *dynamically*) sotype="a.out" ;;
- esac
- fi
- ${RM} -fr "$tmpdir"
+ 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
+ else
+ # "pkg_info" is missing so just guess "ELF.
+ sotype="ELF"
fi
;;
*)