diff options
author | jlam <jlam@pkgsrc.org> | 2007-07-18 18:01:02 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2007-07-18 18:01:02 +0000 |
commit | 2d76049e1e2da22281921e8af8ad641535872781 (patch) | |
tree | d694e70403073f0ddd81b4ae67afbd219db4a5b4 /mk/pkginstall | |
parent | 12d6ee2282d1db38c2a4160286df836df7e695f0 (diff) | |
download | pkgsrc-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.
Diffstat (limited to 'mk/pkginstall')
-rw-r--r-- | mk/pkginstall/bsd.pkginstall.mk | 32 | ||||
-rw-r--r-- | mk/pkginstall/deinstall | 7 | ||||
-rw-r--r-- | mk/pkginstall/install | 7 | ||||
-rw-r--r-- | mk/pkginstall/shlibs | 49 |
4 files changed, 92 insertions, 3 deletions
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 + |