pkgsrc/mk/check/check-shlibs.mk
joerg 5b374e445d Main infrastructure for DESTDIR support.
Packages may set PKG_DESTDIR_SUPPORT to either "destdir" or
"user-destdir" to flag support for this, following the same
rules as PKG_INSTALLATION_TYPES (e.g. define before first include
of bsd.prefs.mk).

The user activates it via USE_DESTDIR. When set to "yes",
packages with "user-destdir" are handled as "destdir".
The installation of the package will not go to ${LOCALBASE},
but a subdirectory of ${WRKDIR} instead. pre/post install scripts are
not run and the package is not registered either. A binary package
can be created instead to be installed normally with pkg_add.

For "user-destdir" packages, everything is run as normal user and
ownership is supposed to be correctled by pkg_create later. Since
the current pkg_install code uses pax and it doesn't allow overwriting
owners, this does not work yet.

For "destdir" packages, installation, packaging and cleaning is run as
root.

This commit does not change the handling of DEPENDS_TARGET or
bin-install to allow recursive usage.
2006-10-09 12:25:44 +00:00

51 lines
1.8 KiB
Makefile

# $NetBSD: check-shlibs.mk,v 1.5 2006/10/09 12:25:44 joerg Exp $
# For PKG_DEVELOPERs, cause some checks to be run automatically by default.
.if defined(PKG_DEVELOPER)
CHECK_SHLIBS?= yes
.endif
CHECK_SHLIBS?= no
# All binaries and shared libraries.
_CHECK_SHLIBS_ERE= /(bin/|sbin/|libexec/|lib/lib.*\.so|lib/lib.*\.dylib)
_CHECK_SHLIB_FILELIST_CMD?= ${SED} -e '/^@/d' ${PLIST}
######################################################################
### check-shlibs (PRIVATE)
######################################################################
### check-shlibs verifies that all libraries used by the package can be
### found at run-time.
###
.PHONY: check-shlibs
.if !empty(CHECK_SHLIBS_SUPPORTED:M[nN][oO])
check-shlibs:
@${DO_NADA}
.else
check-shlibs: error-check
@${STEP_MSG} "Checking for missing run-time search paths in ${PKGNAME}"
. if !defined(NO_PKG_REGISTER)
${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${ERROR_DIR}/${.TARGET}
${_PKG_SILENT}${_PKG_DEBUG} \
exec 1>${ERROR_DIR}/${.TARGET}; \
case ${LDD:Q}"" in \
"") ldd=`${TYPE} ldd 2>/dev/null | ${AWK} '{ print $$NF }'` ;; \
*) ldd=${LDD:Q} ;; \
esac; \
${TEST} -x "$$ldd" || exit 0; \
${_CHECK_SHLIB_FILELIST_CMD} | \
${EGREP} -h ${_CHECK_SHLIBS_ERE:Q} | \
while read file; do \
err=`$$ldd $$file 2>&1 | ${GREP} "not found" || ${TRUE}`; \
${TEST} -z "$$err" || ${ECHO} "$$file: $$err"; \
done
${_PKG_SILENT}${_PKG_DEBUG} \
exec 1>>${ERROR_DIR}/${.TARGET}; \
if ${_NONZERO_FILESIZE_P} ${ERROR_DIR}/${.TARGET}; then \
${ECHO} "*** The above programs/libs will not find the listed shared libraries"; \
${ECHO} " at runtime. Please fix the package (add -Wl,-R.../lib in the right"; \
${ECHO} " places)!"; \
${SHCOMMENT} Might not error-out for non-pkg-developers; \
fi
. endif
.endif