summaryrefslogtreecommitdiff
path: root/mk/scripts
diff options
context:
space:
mode:
authorjlam <jlam>2007-07-18 18:01:02 +0000
committerjlam <jlam>2007-07-18 18:01:02 +0000
commitb1e323a4623608b46511d1b5b7af2b869bad3275 (patch)
treed694e70403073f0ddd81b4ae67afbd219db4a5b4 /mk/scripts
parent8cd45cbaa84d07afd7e533df3e896ed8a656a14e (diff)
downloadpkgsrc-b1e323a4623608b46511d1b5b7af2b869bad3275.tar.gz
Add back a facility to rebuild the run-time library search paths database
on platforms that need it. XXX Right now, if the platform needs it, then it runs for every package. XXX This needs to be fixed to only run for packages that install shared XXX libraries. * Move mk/plist/shlib-type to mk/scripts. * Move definition of SHLIB_TYPE from mk/plist/plist.mk to bsd.pkg.mk. * Move inclusion of bsd.pkginstall.mk below bsd.tools.mk so that it can use SHLIB_TYPE. This is necessary because SHLIB_TYPE's value is the result of evaluating a command, and the command needs "TOOL" definitions provided by bsd.tools.mk.
Diffstat (limited to 'mk/scripts')
-rwxr-xr-xmk/scripts/shlib-type51
1 files changed, 51 insertions, 0 deletions
diff --git a/mk/scripts/shlib-type b/mk/scripts/shlib-type
new file mode 100755
index 00000000000..5a42b58f94e
--- /dev/null
+++ b/mk/scripts/shlib-type
@@ -0,0 +1,51 @@
+# /bin/sh
+#
+# $NetBSD: shlib-type,v 1.1 2007/07/18 18:01:03 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 we inspect "pkg_info" (which
+# should exist on a pkgsrc system) to determine the correct object
+# format (either ELF or a.out).
+#
+
+: ${ECHO=echo}
+: ${FILE_CMD=file}
+: ${TEST=test}
+: ${PKG_INFO_CMD=/usr/sbin/pkg_info}
+
+self="${0##*/}"
+
+usage() {
+ ${ECHO} 1>&2 "usage: $self libformat"
+}
+
+${TEST} $# -gt 0 || { usage; exit 1; }
+
+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
+ else
+ # "pkg_info" is missing so just guess "ELF.
+ sotype="ELF"
+ fi
+ ;;
+*)
+ sotype="$1"
+ ;;
+esac
+${ECHO} $sotype
+
+exit 0