pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/buildlink3 Instead of canonicalizing all ${DEPOTBAS...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/9b236a012f29
branches:  trunk
changeset: 460946:9b236a012f29
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Mon Sep 08 09:18:15 2003 +0000

description:
Instead of canonicalizing all ${DEPOTBASE}/* into ${LOCALBASE}, don't
do it for rpath specifications, e.g. -Wl,-R/dir, -Wl,-rpath,/dir, etc.
This lets the depot directory for a package, in addition to the usual
/usr/pkg/lib, to be added to the rpath of a program or shared library
of an "overwrite" package.  Now, if the package instance in the
default view is forcibly removed, then shared library references will
still resolve to the existing shared libraries in the depot directory.

In the following example, I've built jpeg as a pkgviews package, and
tiff as an "overwrite" package:

% ldd /usr/pkg/lib/libtiff.so
/usr/pkg/lib/libtiff.so:
         -ljpeg.62 => /usr/pkg/lib/libjpeg.so.62
         -lz.0 => /usr/lib/libz.so.0
         -lm.0 => /usr/lib/libm387.so.0
         -lm.0 => /usr/lib/libm.so.0
% pkg_delete -f jpeg-6b
pkg_delete: package `jpeg-6b' is required by other packages:
        tiff-3.5.7nb1
% ldd /usr/pkg/lib/libtiff.so
/usr/pkg/lib/libtiff.so:
         -ljpeg.62 => /usr/pkg/packages/jpeg-6b/lib/libjpeg.so.62
         -lz.0 => /usr/lib/libz.so.0
         -lm.0 => /usr/lib/libm387.so.0
         -lm.0 => /usr/lib/libm.so.0

The benefit here is that if the jpeg package is updated and also has
a bump in the major number of the shared lib, e.g. libjpeg.so.63.0,
then you can remove the old jpeg instance from the default view and
add the new jpeg package into the default view, and
/usr/pkg/lib/libtiff.so will _still_ resolve its libjpeg.so.62
reference.

Welcome to the power of Package Views!

diffstat:

 mk/buildlink3/bsd.buildlink3.mk |  72 ++++++++++++++++++++++++----------------
 1 files changed, 43 insertions(+), 29 deletions(-)

diffs (162 lines):

diff -r ea3619f3124c -r 9b236a012f29 mk/buildlink3/bsd.buildlink3.mk
--- a/mk/buildlink3/bsd.buildlink3.mk   Mon Sep 08 07:30:07 2003 +0000
+++ b/mk/buildlink3/bsd.buildlink3.mk   Mon Sep 08 09:18:15 2003 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink3.mk,v 1.6 2003/09/08 07:30:07 jlam Exp $
+# $NetBSD: bsd.buildlink3.mk,v 1.7 2003/09/08 09:18:15 jlam Exp $
 #
 # An example package buildlink3.mk file:
 #
@@ -99,6 +99,9 @@
 # _BLNK_PKG_DBDIR.<pkg>                contains all of the package metadata
 #                              files for <pkg>
 #
+# _BLNK_PKG_INFO.<pkg>         pkg_info(1) with correct dbdir to get
+#                              information for <pkg>
+#
 # BUILDLINK_PKGNAME.<pkg>      the name of the package
 #
 # BUILDLINK_PREFIX.<pkg>       contains all of the installed files
@@ -133,24 +136,35 @@
 #
 .for _pkg_ in ${BUILDLINK_PACKAGES} ${_BLNK_X11_LINKS_PACKAGE}
 .  if !defined(_BLNK_PKG_DBDIR.${_pkg_})
-_BLNK_PKG_DBDIR.${_pkg_}!=                                             \
+_BLNK_PKG_DBDIR.${_pkg_}!=     \
        dir=`cd ${_PKG_DBDIR}; ${PKG_ADMIN} -s "" lsbest "${BUILDLINK_DEPENDS.${_pkg_}}" || ${TRUE}`; \
        case "$$dir" in                                                 \
        "")     dir="not_found" ;;                                      \
+       *)      if [ -f $$dir/+DEPOT ]; then                            \
+                       dir=`${HEAD} -1 $$dir/+DEPOT`;                  \
+               fi ;;                                                   \
        esac;                                                           \
        ${ECHO} $$dir
 .    if empty(_BLNK_PKG_DBDIR.${_pkg_}:Mnot_found)
 MAKEFLAGS+=    _BLNK_PKG_DBDIR.${_pkg_}=${_BLNK_PKG_DBDIR.${_pkg_}}
 .    endif
 .  endif
+_BLNK_PKG_INFO.${_pkg_}=       \
+       ${PKG_INFO_CMD} -K ${_BLNK_PKG_DBDIR.${_pkg_}:H}
+
 BUILDLINK_PKGNAME.${_pkg_}?=   ${_BLNK_PKG_DBDIR.${_pkg_}:T}
+.  if exists(${_BLNK_PKG_DBDIR.${_pkg_}}/+VIEWS)
+BUILDLINK_IS_DEPOT.${_pkg_}?=  yes
+.  else
+BUILDLINK_IS_DEPOT.${_pkg_}?=  no
+.  endif
 .  if !defined(BUILDLINK_PREFIX.${_pkg_})
-.    if ${PKG_INSTALLATION_TYPE} == "pkgviews"
+.    if !empty(BUILDLINK_IS_DEPOT.${_pkg_}:M[yY][eE][sS])
 BUILDLINK_PREFIX.${_pkg_}?=    ${_BLNK_PKG_DBDIR.${_pkg_}}
-.    elif ${PKG_INSTALLATION_TYPE} == "overwrite"
+.    else
 .      if empty(_BLNK_PKG_DBDIR.${_pkg_}:Mnot_found)
 BUILDLINK_PREFIX.${_pkg_}!=    \
-       ${PKG_INFO} -qp ${BUILDLINK_PKGNAME.${_pkg_}} | ${SED}  -e "s,^[^/]*,,"
+       ${_BLNK_PKG_INFO.${_pkg_}} -qp ${BUILDLINK_PKGNAME.${_pkg_}} | ${SED}  -e "s,^[^/]*,,"
 .      else
 BUILDLINK_PREFIX.${_pkg_}?=    not_found
 .      endif
@@ -159,11 +173,6 @@
 MAKEFLAGS+=    BUILDLINK_PREFIX.${_pkg_}=${BUILDLINK_PREFIX.${_pkg_}}
 .    endif
 .  endif
-.  if exists(${_BLNK_PKG_DBDIR.${_pkg_}}/+VIEWS)
-BUILDLINK_IS_DEPOT.${_pkg_}?=  yes
-.  else
-BUILDLINK_IS_DEPOT.${_pkg_}?=  no
-.  endif
 BUILDLINK_IS_BUILTIN.${_pkg_}?=        no
 BUILDLINK_CPPFLAGS.${_pkg_}?=  # empty
 BUILDLINK_LDFLAGS.${_pkg_}?=   # empty
@@ -343,11 +352,12 @@
        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
        ${TOUCH} ${TOUCH_FLAGS} ${_BLNK_COOKIE.${_pkg_}}
 
-.if !empty(BUILDLINK_IS_DEPOT.${_pkg_}:M[yY][eE][sS])
+.if (${PKG_INSTALLATION_TYPE} == "pkgviews") &&                                \
+    !empty(BUILDLINK_IS_DEPOT.${_pkg_}:M[yY][eE][sS])
 BUILDLINK_FILES_CMD.${_pkg_}?= ${TRUE}
 .else
 BUILDLINK_FILES_CMD.${_pkg_}?=                                         \
-       ${PKG_INFO} -f ${BUILDLINK_PKGNAME.${_pkg_}} |                  \
+       ${_BLNK_PKG_INFO.${_pkg_}} -f ${BUILDLINK_PKGNAME.${_pkg_}} |   \
        ${SED} -n '/File:/s/^[  ]*File:[        ]*//p' |                \
        ${GREP} '\(include.*/\|lib.*/lib[^/]*$$\)' |                    \
        ${SED} "s,^,$${pkg_prefix},"
@@ -361,7 +371,7 @@
        esac;                                                           \
        cd ${BUILDLINK_PREFIX.${_pkg_}};                                \
        pkg_prefix=`                                                    \
-               ${PKG_INFO} -qp ${BUILDLINK_PKGNAME.${_pkg_}} |         \
+               ${_BLNK_PKG_INFO.${_pkg_}} -qp ${BUILDLINK_PKGNAME.${_pkg_}} | \
                ${SED}  -e "s,^[^/]*,,"                                 \
                        -e "s,^${BUILDLINK_PREFIX.${_pkg_}},,"          \
                        -e "s,^/,,"                                     \
@@ -561,12 +571,14 @@
 _BLNK_PROTECT_DIRS+=   ${BUILDLINK_DIR}
 _BLNK_PROTECT_DIRS+=   ${BUILDLINK_X11_DIR}
 _BLNK_PROTECT_DIRS+=   ${WRKDIR}
-.for _pkg_ in ${BUILDLINK_PACKAGES}
-.  if !empty(BUILDLINK_IS_DEPOT.${_pkg_}:M[yY][eE][sS])
+.if ${PKG_INSTALLATION_TYPE} == "pkgviews"
+.  for _pkg_ in ${BUILDLINK_PACKAGES}
+.    if !empty(BUILDLINK_IS_DEPOT.${_pkg_}:M[yY][eE][sS])
 _BLNK_PROTECT_DIRS+=   ${BUILDLINK_PREFIX.${_pkg_}}
 _BLNK_UNPROTECT_DIRS+= ${BUILDLINK_PREFIX.${_pkg_}}
-.  endif
-.endfor
+.    endif
+.  endfor
+.endif
 _BLNK_UNPROTECT_DIRS+= ${WRKDIR}
 _BLNK_UNPROTECT_DIRS+= ${BUILDLINK_X11_DIR}
 _BLNK_UNPROTECT_DIRS+= ${BUILDLINK_DIR}
@@ -585,14 +597,6 @@
 _BLNK_TRANSFORM+=      untransform:mangle:${_dir_}:${_BLNK_MANGLE_DIR.${_dir_}}
 .endfor
 #
-# Change references to ${DEPOTBASE}/<pkg> into ${LOCALBASE} so that
-# "overwrite" packages think headers and libraries for "pkgviews" packages
-# are just found in the default view.
-#
-.if ${PKG_INSTALLATION_TYPE} == "overwrite"
-_BLNK_TRANSFORM+=       depot:${DEPOTBASE}:${LOCALBASE}
-.endif
-#
 # Change any buildlink directories in runtime library search paths into
 # the canonical actual installed paths.
 #
@@ -607,6 +611,14 @@
 _BLNK_TRANSFORM+=      rpath:${_dir_}:${_BLNK_MANGLE_DIR.${_dir_}}
 .endfor
 #
+# Change references to ${DEPOTBASE}/<pkg> into ${LOCALBASE} so that
+# "overwrite" packages think headers and libraries for "pkgviews" packages
+# are just found in the default view.
+#
+.if ${PKG_INSTALLATION_TYPE} == "overwrite"
+_BLNK_TRANSFORM+=       depot:${DEPOTBASE}:${LOCALBASE}
+.endif
+#
 # Convert direct paths to shared libraries into "-Ldir -llib" equivalents.
 #
 _BLNK_TRANSFORM+=      p:${_BLNK_MANGLE_SED_PATTERN:Q}
@@ -1199,11 +1211,13 @@
 # Allow the depot directories for packages for which we need to find
 # headers and libraries for both -[IL]<dir>.
 #
-.  for _pkg_ in ${BUILDLINK_PACKAGES}
-.    if !empty(BUILDLINK_IS_DEPOT.${_pkg_}:M[yY][eE][sS])
+.  if ${PKG_INSTALLATION_TYPE} == "pkgviews"
+.    for _pkg_ in ${BUILDLINK_PACKAGES}
+.      if !empty(BUILDLINK_IS_DEPOT.${_pkg_}:M[yY][eE][sS])
 _BLNK_CACHE_PASSTHRU_GLOB+=    -[IL]${BUILDLINK_PREFIX.${_pkg_}}/*
-.    endif
-.  endfor
+.      endif
+.    endfor
+.  endif
 #
 # Allow all subdirs of ${_BLNK_ALLOWED_RPATHDIRS} to be in the runtime
 # library search path.



Home | Main Index | Thread Index | Old Index