summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2007-07-18 18:01:02 +0000
committerjlam <jlam@pkgsrc.org>2007-07-18 18:01:02 +0000
commit2d76049e1e2da22281921e8af8ad641535872781 (patch)
treed694e70403073f0ddd81b4ae67afbd219db4a5b4
parent12d6ee2282d1db38c2a4160286df836df7e695f0 (diff)
downloadpkgsrc-2d76049e1e2da22281921e8af8ad641535872781.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.
-rw-r--r--mk/bsd.pkg.mk17
-rw-r--r--mk/pkginstall/bsd.pkginstall.mk32
-rw-r--r--mk/pkginstall/deinstall7
-rw-r--r--mk/pkginstall/install7
-rw-r--r--mk/pkginstall/shlibs49
-rw-r--r--mk/plist/plist.mk9
-rwxr-xr-xmk/scripts/shlib-type (renamed from mk/plist/shlib-type)2
7 files changed, 107 insertions, 16 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index b39d9c57558..76f2491c3ea 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1912 2007/07/16 20:51:07 joerg Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1913 2007/07/18 18:01:02 jlam Exp $
#
# This file is in the public domain.
#
@@ -354,9 +354,6 @@ OVERRIDE_DIRDEPTH?= 2
#
.include "${.PARSEDIR}/alternatives.mk"
-# INSTALL/DEINSTALL script framework
-.include "${.PARSEDIR}/pkginstall/bsd.pkginstall.mk"
-
# Define SMART_MESSAGES in /etc/mk.conf for messages giving the tree
# of dependencies for building, and the current target.
_PKGSRC_IN?= ===${SMART_MESSAGES:D> ${.TARGET} [${PKGNAME}${_PKGSRC_DEPS}] ===}
@@ -441,6 +438,18 @@ USE_TOOLS+= tee tsort
# Tools
.include "${.PARSEDIR}/tools/bsd.tools.mk"
+# SHLIB_TYPE
+# The type of shared library supported by the platform.
+#
+SHLIB_TYPE= ${_SHLIB_TYPE_cmd:sh}
+_SHLIB_TYPE_cmd= \
+ ${SETENV} ECHO=${TOOLS_ECHO:Q} FILE_CMD=${TOOLS_FILE_CMD:Q} \
+ TEST=${TOOLS_TEST:Q} PKG_INFO_CMD=${PKG_INFO_CMD:Q} \
+ ${SH} ${PKGSRCDIR}/mk/scripts/shlib-type ${_OPSYS_SHLIB_TYPE:Q}
+
+# INSTALL/DEINSTALL script framework
+.include "${.PARSEDIR}/pkginstall/bsd.pkginstall.mk"
+
# Barrier
.include "${.PARSEDIR}/bsd.pkg.barrier.mk"
diff --git a/mk/pkginstall/bsd.pkginstall.mk b/mk/pkginstall/bsd.pkginstall.mk
index c4272d9aef4..04a590c12e3 100644
--- a/mk/pkginstall/bsd.pkginstall.mk
+++ b/mk/pkginstall/bsd.pkginstall.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkginstall.mk,v 1.26 2007/07/12 19:41:46 jlam Exp $
+# $NetBSD: bsd.pkginstall.mk,v 1.27 2007/07/18 18:01:02 jlam Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and implements the
# common INSTALL/DEINSTALL scripts framework. To use the pkginstall
@@ -686,6 +686,36 @@ ${_INSTALL_SHELL_FILE}: ../../mk/pkginstall/shell
${TOUCH} ${TOUCH_ARGS} ${.TARGET}; \
fi
+# LDCONFIG_ADD_CMD
+# LDCONFIG_REMOVE_CMD
+# Command-line to be invoked to update the system run-time library
+# search paths database when adding and removing a package.
+#
+# Default value: ${LDCONFIG}
+#
+LDCONFIG_ADD_CMD?= ${_LDCONFIG_ADD_CMD.${OPSYS}}
+LDCONFIG_REMOVE_CMD?= ${_LDCONFIG_REMOVE_CMD.${OPSYS}}
+_LDCONFIG_ADD_CMD.${OPSYS}?= ${LDCONFIG}
+_LDCONFIG_REMOVE_CMD.${OPSYS}?= ${LDCONFIG}
+FILES_SUBST+= LDCONFIG_ADD_CMD=${LDCONFIG_ADD_CMD:Q}
+FILES_SUBST+= LDCONFIG_REMOVE_CMD=${LDCONFIG_REMOVE_CMD:Q}
+
+.if ${SHLIB_TYPE} == "a.out"
+RUN_LDCONFIG?= yes
+.else
+RUN_LDCONFIG?= no
+.endif
+
+_INSTALL_SHLIBS_FILE= ${_PKGINSTALL_DIR}/shlibs
+.if !empty(RUN_LDCONFIG:M[Yy][Ee][Ss])
+_INSTALL_UNPACK_TMPL+= ${_INSTALL_SHLIBS_FILE}
+.endif
+
+${_INSTALL_SHLIBS_FILE}: ../../mk/pkginstall/shlibs
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${SED} ${FILES_SUBST_SED} ../../mk/pkginstall/shlibs > ${.TARGET}
+
# FONTS_DIRS.<type> are lists of directories in which the font databases
# are updated. If this is non-empty, then the appropriate tools is
# used to update the fonts database for the font type. The supported
diff --git a/mk/pkginstall/deinstall b/mk/pkginstall/deinstall
index cb31eb8584a..28d7ef2e744 100644
--- a/mk/pkginstall/deinstall
+++ b/mk/pkginstall/deinstall
@@ -1,4 +1,4 @@
-# $NetBSD: deinstall,v 1.1 2006/05/21 23:50:15 jlam Exp $
+# $NetBSD: deinstall,v 1.2 2007/07/18 18:01:03 jlam Exp $
case ${STAGE} in
VIEW-DEINSTALL)
@@ -53,6 +53,11 @@ POST-DEINSTALL)
${TEST} ! -x ./+FONTS ||
./+FONTS ${PKG_METADATA_DIR}
#
+ # Rebuild the system run-time library search path database.
+ #
+ ${TEST} ! -x ./+SHLIBS ||
+ ./+SHLIBS REMOVE ${PKG_METADATA_DIR}
+ #
# Remove empty directories and unused users/groups.
#
${TEST} ! -x ./+DIRS ||
diff --git a/mk/pkginstall/install b/mk/pkginstall/install
index a060d9f7b07..45c79319db4 100644
--- a/mk/pkginstall/install
+++ b/mk/pkginstall/install
@@ -1,4 +1,4 @@
-# $NetBSD: install,v 1.1 2006/05/21 23:50:15 jlam Exp $
+# $NetBSD: install,v 1.2 2007/07/18 18:01:03 jlam Exp $
case ${STAGE} in
PRE-INSTALL)
@@ -42,6 +42,11 @@ PRE-INSTALL)
POST-INSTALL)
#
+ # Rebuild the system run-time library search path database.
+ #
+ ${TEST} ! -x ./+SHLIBS ||
+ ./+SHLIBS ADD ${PKG_METADATA_DIR}
+ #
# Copy configuration/support files into place.
#
${TEST} ! -x ./+FILES ||
diff --git a/mk/pkginstall/shlibs b/mk/pkginstall/shlibs
new file mode 100644
index 00000000000..5733a4c2cb2
--- /dev/null
+++ b/mk/pkginstall/shlibs
@@ -0,0 +1,49 @@
+# $NetBSD: shlibs,v 1.1 2007/07/18 18:01:03 jlam Exp $
+#
+# Generate a +SHLIBS script that updates the system run-time library
+# search paths database for the package.
+#
+case "${STAGE},$1" in
+UNPACK,|UNPACK,+SHLIBS)
+ ${CAT} > ./+SHLIBS << 'EOF'
+#!@SH@
+#
+# +SHLIBS - system run-time library search paths database management script
+#
+# Usage: ./+SHLIBS ADD|REMOVE [metadatadir]
+#
+# This scripts rebuilds the system database of run-time library search
+# paths so that the system can find the shared libraries of the package
+# associated with <metadatadir>.
+#
+
+ECHO="@ECHO@"
+PWD_CMD="@PWD_CMD@"
+
+SELF=$0
+
+CURDIR=`${PWD_CMD}`
+PKG_METADATA_DIR="${1-${CURDIR}}"
+: ${PKGNAME=${PKG_METADATA_DIR##*/}}
+: ${PKG_PREFIX=@PREFIX@}
+
+exitcode=0
+case $ACTION in
+ADD)
+ ${ECHO} "${PKGNAME}: rebuilding run-time library search paths database"
+ @LDCONFIG_ADD_CMD@
+ ;;
+
+REMOVE)
+ ${ECHO} "${PKGNAME}: rebuilding run-time library search paths database"
+ @LDCONFIG_REMOVE_CMD@
+ ;;
+esac
+exit $exitcode
+
+EOF
+ ${SED} -n "/^\# SHLIBS: /p" ${SELF} >> ./+SHLIBS
+ ${CHMOD} +x ./+SHLIBS
+ ;;
+esac
+
diff --git a/mk/plist/plist.mk b/mk/plist/plist.mk
index 5ba1e8fdf1f..88cef677edc 100644
--- a/mk/plist/plist.mk
+++ b/mk/plist/plist.mk
@@ -1,4 +1,4 @@
-# $NetBSD: plist.mk,v 1.26 2007/07/18 14:12:30 jlam Exp $
+# $NetBSD: plist.mk,v 1.27 2007/07/18 18:01:03 jlam Exp $
#
# This Makefile fragment handles the creation of PLISTs for use by
# pkg_create(8).
@@ -157,13 +157,6 @@ _SHLIB_AWKFILE.a.out= ${.CURDIR}/../../mk/plist/shlib-aout.awk
_SHLIB_AWKFILE.dylib= ${.CURDIR}/../../mk/plist/shlib-dylib.awk
_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} 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}
-
######################################################################
# GENERATE_PLIST is a sequence of commands, terminating in a semicolon,
diff --git a/mk/plist/shlib-type b/mk/scripts/shlib-type
index 56ebb365a0f..5a42b58f94e 100755
--- a/mk/plist/shlib-type
+++ b/mk/scripts/shlib-type
@@ -1,6 +1,6 @@
# /bin/sh
#
-# $NetBSD: shlib-type,v 1.3 2006/07/21 13:40:27 jlam Exp $
+# $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.