pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk Add back a facility to rebuild the run-time library...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/5ce8aafff404
branches:  trunk
changeset: 531047:5ce8aafff404
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Wed Jul 18 18:01:02 2007 +0000

description:
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:

 mk/bsd.pkg.mk                   |  17 ++++++++++---
 mk/pkginstall/bsd.pkginstall.mk |  32 ++++++++++++++++++++++++-
 mk/pkginstall/deinstall         |   7 ++++-
 mk/pkginstall/install           |   7 ++++-
 mk/pkginstall/shlibs            |  49 +++++++++++++++++++++++++++++++++++++++
 mk/plist/plist.mk               |   9 +------
 mk/plist/shlib-type             |  51 -----------------------------------------
 mk/scripts/shlib-type           |  51 +++++++++++++++++++++++++++++++++++++++++
 8 files changed, 157 insertions(+), 66 deletions(-)

diffs (truncated from 312 to 300 lines):

diff -r 789d7e36383b -r 5ce8aafff404 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Wed Jul 18 14:12:30 2007 +0000
+++ b/mk/bsd.pkg.mk     Wed Jul 18 18:01:02 2007 +0000
@@ -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 @@
 #
 .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 @@
 # 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 -r 789d7e36383b -r 5ce8aafff404 mk/pkginstall/bsd.pkginstall.mk
--- a/mk/pkginstall/bsd.pkginstall.mk   Wed Jul 18 14:12:30 2007 +0000
+++ b/mk/pkginstall/bsd.pkginstall.mk   Wed Jul 18 18:01:02 2007 +0000
@@ -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 @@
                ${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 -r 789d7e36383b -r 5ce8aafff404 mk/pkginstall/deinstall
--- a/mk/pkginstall/deinstall   Wed Jul 18 14:12:30 2007 +0000
+++ b/mk/pkginstall/deinstall   Wed Jul 18 18:01:02 2007 +0000
@@ -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 @@
        ${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 -r 789d7e36383b -r 5ce8aafff404 mk/pkginstall/install
--- a/mk/pkginstall/install     Wed Jul 18 14:12:30 2007 +0000
+++ b/mk/pkginstall/install     Wed Jul 18 18:01:02 2007 +0000
@@ -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 @@
 
 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 -r 789d7e36383b -r 5ce8aafff404 mk/pkginstall/shlibs
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/pkginstall/shlibs      Wed Jul 18 18:01:02 2007 +0000
@@ -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 -r 789d7e36383b -r 5ce8aafff404 mk/plist/plist.mk
--- a/mk/plist/plist.mk Wed Jul 18 14:12:30 2007 +0000
+++ b/mk/plist/plist.mk Wed Jul 18 18:01:02 2007 +0000
@@ -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.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 -r 789d7e36383b -r 5ce8aafff404 mk/plist/shlib-type
--- a/mk/plist/shlib-type       Wed Jul 18 14:12:30 2007 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-# /bin/sh
-#
-# $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 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
diff -r 789d7e36383b -r 5ce8aafff404 mk/scripts/shlib-type
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/scripts/shlib-type     Wed Jul 18 18:01:02 2007 +0000
@@ -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



Home | Main Index | Thread Index | Old Index