2021-10-11 22:26:28 +02:00
|
|
|
# $NetBSD: check-shlibs.mk,v 1.34 2021/10/11 20:26:28 jperkin Exp $
|
2006-11-12 00:27:51 +01:00
|
|
|
#
|
|
|
|
# This file verifies that all libraries used by the package can be found
|
|
|
|
# at run-time.
|
|
|
|
#
|
|
|
|
# User-settable variables:
|
|
|
|
#
|
2008-02-20 11:43:55 +01:00
|
|
|
# CHECK_SHLIBS
|
2006-11-12 00:27:51 +01:00
|
|
|
# Whether the check should be enabled or not.
|
|
|
|
#
|
|
|
|
# Default value: "yes" for PKG_DEVELOPERs, "no" otherwise.
|
|
|
|
#
|
2021-10-11 22:26:28 +02:00
|
|
|
# CHECK_SHLIBS_TOXIC
|
2017-05-03 15:46:53 +02:00
|
|
|
# A list of regular expressions that will cause the test to fail
|
2021-10-11 22:26:28 +02:00
|
|
|
# if they match any resolved library paths. For example, set
|
|
|
|
# to ^/usr/lib/lib(crypto|ssl) ensures that OpenSSL is not
|
2017-05-03 15:46:53 +02:00
|
|
|
# accidentally picked up from the OS.
|
|
|
|
#
|
|
|
|
# Default value: empty.
|
|
|
|
#
|
2006-11-12 00:27:51 +01:00
|
|
|
# Package-settable variables:
|
|
|
|
#
|
2014-03-02 06:43:16 +01:00
|
|
|
# CHECK_SHLIBS_SKIP
|
|
|
|
# A list of shell patterns (like man/*) that should be excluded
|
|
|
|
# from the check. Note that a * in a pattern also matches a slash
|
|
|
|
# in a pathname.
|
|
|
|
#
|
|
|
|
# Default value: empty.
|
|
|
|
#
|
2009-06-18 16:51:55 +02:00
|
|
|
# CHECK_SHLIBS_SUPPORTED
|
2006-11-12 00:27:51 +01:00
|
|
|
# Whether the check should be enabled for this package or not.
|
|
|
|
#
|
|
|
|
# Default value: yes
|
|
|
|
#
|
First pass at implementing support for package system flavors other
than pkgsrc's current one. This is an important lead-up to any project
that redesigns the pkg_* tools in that it doesn't tie us to past design
(mis)choices. This commit mostly deals with rearranging code, although
there was a considerable amount of rewriting done in cases where I
thought the code was somewhat messy and was difficult to understand.
The design I chose for supporting multiple package system flavors is
that the various depends, install, package, etc. modules would define
default targets and variables that may be overridden in files from
pkgsrc/mk/flavor/${PKG_FLAVOR}. The default targets would do the
sensible thing of doing nothing, and pkgsrc infrastructure would rely
on the appropriate things to be defined in pkgsrc/mk/flavor to do the
real work. The pkgsrc/mk/flavor directory contains subdirectories
corresponding to each package system flavor that we support. Currently,
I only have "pkg" which represents the current pkgsrc-native package
flavor. I've separated out most of the code where we make assumptions
about the package system flavor, mostly either because we directly
use the pkg_* tools, or we make assumptions about the package meta-data
directory, or we directly manipulate the package meta-data files, and
placed it into pkgsrc/mk/flavor/pkg.
There are several new modules that have been refactored out of bsd.pkg.mk
as part of these changes: check, depends, install, package, and update.
Each of these modules has been slimmed down by rewriting them to avoid
some recursive make calls. I've also religiously documented which
targets are "public" and which are "private" so that users won't rely
on reaching into pkgsrc innards to call a private target.
The "depends" module is a complete overhaul of the way that we handle
dependencies. There is now a separate "depends" phase that occurs
before the "extract" phase where dependencies are installed. This
differs from the old way where dependencies were installed just before
extraction occurred. The reduce-depends.mk file is now replaced by
a script that is invoked only once during the depends phase and is
used to generate a cookie file that holds the full set of reduced
dependencies. It is now possible to type "make depends" in a package
directory and all missing dependencies will be installed.
Future work on this project include:
* Resolve the workflow design in anticipation of future work on
staged installations where "package" conceptually happens before
"install".
* Rewrite the buildlink3 framework to not assume the use of the
pkgsrc pkg_* tools.
* Rewrite the pkginstall framework to provide a standard pkg_*
tool to perform the actions, and allowing a purely declarative
file per package to describe what actions need to be taken at
install or deinstall time.
* Implement support for the SVR4 package flavor. This will be
proof that the appropriate abstractions are in place to allow
using a completely different set of package management tools.
2006-06-04 01:11:42 +02:00
|
|
|
|
2007-03-16 11:29:22 +01:00
|
|
|
_VARGROUPS+= check-shlibs
|
|
|
|
_USER_VARS.check-shlibs= CHECK_SHLIBS
|
2007-03-18 20:37:12 +01:00
|
|
|
_PKG_VARS.check-shlibs= CHECK_SHLIBS_SUPPORTED
|
2007-03-16 11:29:22 +01:00
|
|
|
|
2014-10-13 01:39:17 +02:00
|
|
|
.if ${PKG_DEVELOPER:Uno} != "no"
|
2006-11-12 00:27:51 +01:00
|
|
|
CHECK_SHLIBS?= yes
|
2014-10-13 01:39:17 +02:00
|
|
|
.else
|
2006-11-12 00:27:51 +01:00
|
|
|
CHECK_SHLIBS?= no
|
2014-10-13 01:39:17 +02:00
|
|
|
.endif
|
2006-11-12 00:27:51 +01:00
|
|
|
CHECK_SHLIBS_SUPPORTED?= yes
|
2014-03-02 06:43:16 +01:00
|
|
|
CHECK_SHLIBS_SKIP?= # none
|
First pass at implementing support for package system flavors other
than pkgsrc's current one. This is an important lead-up to any project
that redesigns the pkg_* tools in that it doesn't tie us to past design
(mis)choices. This commit mostly deals with rearranging code, although
there was a considerable amount of rewriting done in cases where I
thought the code was somewhat messy and was difficult to understand.
The design I chose for supporting multiple package system flavors is
that the various depends, install, package, etc. modules would define
default targets and variables that may be overridden in files from
pkgsrc/mk/flavor/${PKG_FLAVOR}. The default targets would do the
sensible thing of doing nothing, and pkgsrc infrastructure would rely
on the appropriate things to be defined in pkgsrc/mk/flavor to do the
real work. The pkgsrc/mk/flavor directory contains subdirectories
corresponding to each package system flavor that we support. Currently,
I only have "pkg" which represents the current pkgsrc-native package
flavor. I've separated out most of the code where we make assumptions
about the package system flavor, mostly either because we directly
use the pkg_* tools, or we make assumptions about the package meta-data
directory, or we directly manipulate the package meta-data files, and
placed it into pkgsrc/mk/flavor/pkg.
There are several new modules that have been refactored out of bsd.pkg.mk
as part of these changes: check, depends, install, package, and update.
Each of these modules has been slimmed down by rewriting them to avoid
some recursive make calls. I've also religiously documented which
targets are "public" and which are "private" so that users won't rely
on reaching into pkgsrc innards to call a private target.
The "depends" module is a complete overhaul of the way that we handle
dependencies. There is now a separate "depends" phase that occurs
before the "extract" phase where dependencies are installed. This
differs from the old way where dependencies were installed just before
extraction occurred. The reduce-depends.mk file is now replaced by
a script that is invoked only once during the depends phase and is
used to generate a cookie file that holds the full set of reduced
dependencies. It is now possible to type "make depends" in a package
directory and all missing dependencies will be installed.
Future work on this project include:
* Resolve the workflow design in anticipation of future work on
staged installations where "package" conceptually happens before
"install".
* Rewrite the buildlink3 framework to not assume the use of the
pkgsrc pkg_* tools.
* Rewrite the pkginstall framework to provide a standard pkg_*
tool to perform the actions, and allowing a purely declarative
file per package to describe what actions need to be taken at
install or deinstall time.
* Implement support for the SVR4 package flavor. This will be
proof that the appropriate abstractions are in place to allow
using a completely different set of package management tools.
2006-06-04 01:11:42 +02:00
|
|
|
|
|
|
|
# All binaries and shared libraries.
|
2015-08-17 18:39:13 +02:00
|
|
|
_CHECK_SHLIBS_ERE= (bin/|sbin/|libexec/|\.(dylib|sl|so)$$|lib/lib.*\.(dylib|sl|so))
|
First pass at implementing support for package system flavors other
than pkgsrc's current one. This is an important lead-up to any project
that redesigns the pkg_* tools in that it doesn't tie us to past design
(mis)choices. This commit mostly deals with rearranging code, although
there was a considerable amount of rewriting done in cases where I
thought the code was somewhat messy and was difficult to understand.
The design I chose for supporting multiple package system flavors is
that the various depends, install, package, etc. modules would define
default targets and variables that may be overridden in files from
pkgsrc/mk/flavor/${PKG_FLAVOR}. The default targets would do the
sensible thing of doing nothing, and pkgsrc infrastructure would rely
on the appropriate things to be defined in pkgsrc/mk/flavor to do the
real work. The pkgsrc/mk/flavor directory contains subdirectories
corresponding to each package system flavor that we support. Currently,
I only have "pkg" which represents the current pkgsrc-native package
flavor. I've separated out most of the code where we make assumptions
about the package system flavor, mostly either because we directly
use the pkg_* tools, or we make assumptions about the package meta-data
directory, or we directly manipulate the package meta-data files, and
placed it into pkgsrc/mk/flavor/pkg.
There are several new modules that have been refactored out of bsd.pkg.mk
as part of these changes: check, depends, install, package, and update.
Each of these modules has been slimmed down by rewriting them to avoid
some recursive make calls. I've also religiously documented which
targets are "public" and which are "private" so that users won't rely
on reaching into pkgsrc innards to call a private target.
The "depends" module is a complete overhaul of the way that we handle
dependencies. There is now a separate "depends" phase that occurs
before the "extract" phase where dependencies are installed. This
differs from the old way where dependencies were installed just before
extraction occurred. The reduce-depends.mk file is now replaced by
a script that is invoked only once during the depends phase and is
used to generate a cookie file that holds the full set of reduced
dependencies. It is now possible to type "make depends" in a package
directory and all missing dependencies will be installed.
Future work on this project include:
* Resolve the workflow design in anticipation of future work on
staged installations where "package" conceptually happens before
"install".
* Rewrite the buildlink3 framework to not assume the use of the
pkgsrc pkg_* tools.
* Rewrite the pkginstall framework to provide a standard pkg_*
tool to perform the actions, and allowing a purely declarative
file per package to describe what actions need to be taken at
install or deinstall time.
* Implement support for the SVR4 package flavor. This will be
proof that the appropriate abstractions are in place to allow
using a completely different set of package management tools.
2006-06-04 01:11:42 +02:00
|
|
|
|
2013-02-20 07:00:51 +01:00
|
|
|
_CHECK_SHLIBS_FILELIST_CMD?= ${SED} -e '/^@/d' ${PLIST} | \
|
|
|
|
(while read file; do \
|
|
|
|
${TEST} -h "$$file" || ${ECHO} "$$file"; \
|
|
|
|
done)
|
2006-10-09 14:25:44 +02:00
|
|
|
|
2006-11-12 00:31:38 +01:00
|
|
|
.if !empty(CHECK_SHLIBS:M[Yy][Ee][Ss]) && \
|
2020-03-23 10:24:35 +01:00
|
|
|
!empty(CHECK_SHLIBS_SUPPORTED:M[Yy][Ee][Ss]) && \
|
|
|
|
${_USE_CHECK_SHLIBS_NATIVE} == "yes"
|
2015-08-17 19:35:23 +02:00
|
|
|
CHECK_SHLIBS_NATIVE_ENV=
|
|
|
|
. if ${OBJECT_FMT} == "ELF"
|
|
|
|
USE_TOOLS+= readelf
|
|
|
|
CHECK_SHLIBS_NATIVE= ${PKGSRCDIR}/mk/check/check-shlibs-elf.awk
|
|
|
|
CHECK_SHLIBS_NATIVE_ENV+= PLATFORM_RPATH=${_OPSYS_SYSTEM_RPATH:Q}
|
|
|
|
CHECK_SHLIBS_NATIVE_ENV+= READELF=${TOOLS_PATH.readelf:Q}
|
|
|
|
. elif ${OBJECT_FMT} == "Mach-O"
|
|
|
|
CHECK_SHLIBS_NATIVE= ${PKGSRCDIR}/mk/check/check-shlibs-macho.awk
|
mk: Handle missing system libraries on Big Sur.
The new release of macOS removes system libraries from the file system, only
providing access to them via a linker cache and dlopen(). This obviously
breaks many assumptions about how libraries work on Unix systems, and so we
unfortunately need to cripple various checks when running on those systems.
Introduce DARWIN_NO_SYSTEM_LIBS which, when defined, will trigger alternate
behaviour in the infrastructure. Currently this is in two places:
* In CHECK_SHLIBS, skip any path beginning with /usr/lib.
* In registered package metadata, any path beginning with /usr/lib is
removed from REQUIRES.
The former fixes all package builds, while the second will be necessary for
package managers such as pkgin, as they will no longer be able to verify that
those files are available on the target system.
This is obviously a gross hack, and removes our ability to ensure that the
target system is suitable for the packages we are attempting to install, but
Apple have left us with no alternative, and users will unfortunately be left
to find out at runtime instead.
It's likely this will need to be extended to /System/Library paths too, but
this is required first to actually get packages building before we can start
running bulk builds.
2020-10-09 18:00:16 +02:00
|
|
|
. if defined(DARWIN_NO_SYSTEM_LIBS)
|
|
|
|
CHECK_SHLIBS_NATIVE_ENV+= SKIP_SYSTEM_LIBS=1
|
|
|
|
. endif
|
2015-08-17 19:35:23 +02:00
|
|
|
. endif
|
|
|
|
CHECK_SHLIBS_NATIVE_ENV+= CROSS_DESTDIR=${_CROSS_DESTDIR:Q}
|
|
|
|
CHECK_SHLIBS_NATIVE_ENV+= PKG_INFO_CMD=${PKG_INFO:Q}
|
|
|
|
CHECK_SHLIBS_NATIVE_ENV+= DEPENDS_FILE=${_RRDEPENDS_FILE:Q}
|
|
|
|
CHECK_SHLIBS_NATIVE_ENV+= DESTDIR=${DESTDIR:Q}
|
|
|
|
CHECK_SHLIBS_NATIVE_ENV+= WRKDIR=${WRKDIR:Q}
|
2018-10-01 16:59:49 +02:00
|
|
|
CHECK_SHLIBS_NATIVE_ENV+= LANG=C
|
2015-11-24 10:41:20 +01:00
|
|
|
. if defined(CHECK_WRKREF) && !empty(CHECK_WRKREF:Mextra)
|
2015-11-16 18:53:29 +01:00
|
|
|
CHECK_SHLIBS_NATIVE_ENV+= CHECK_WRKREF_EXTRA_DIRS=${CHECK_WRKREF_EXTRA_DIRS:Q}
|
|
|
|
. endif
|
2021-10-11 22:26:28 +02:00
|
|
|
. if defined(CHECK_SHLIBS_TOXIC)
|
|
|
|
CHECK_SHLIBS_NATIVE_ENV+= CHECK_SHLIBS_TOXIC=${CHECK_SHLIBS_TOXIC:Q}
|
|
|
|
. elif defined(CHECK_SHLIBS_BLACKLIST)
|
|
|
|
CHECK_SHLIBS_NATIVE_ENV+= CHECK_SHLIBS_TOXIC=${CHECK_SHLIBS_BLACKLIST:Q}
|
2017-05-03 15:46:53 +02:00
|
|
|
. endif
|
2007-08-20 13:04:02 +02:00
|
|
|
|
2020-03-23 10:24:35 +01:00
|
|
|
privileged-install-hook: _check-shlibs
|
2007-08-20 13:04:02 +02:00
|
|
|
_check-shlibs: error-check .PHONY
|
|
|
|
@${STEP_MSG} "Checking for missing run-time search paths in ${PKGNAME}"
|
|
|
|
${RUN} rm -f ${ERROR_DIR}/${.TARGET}
|
2008-02-07 22:36:13 +01:00
|
|
|
${RUN} \
|
2007-08-20 13:04:02 +02:00
|
|
|
cd ${DESTDIR:Q}${PREFIX:Q}; \
|
|
|
|
${_CHECK_SHLIBS_FILELIST_CMD} | \
|
|
|
|
${EGREP} -h ${_CHECK_SHLIBS_ERE:Q} | \
|
2014-03-02 06:43:16 +01:00
|
|
|
while read file; do \
|
|
|
|
case "$$file" in \
|
|
|
|
${CHECK_SHLIBS_SKIP:@p@${p}) continue ;;@} \
|
|
|
|
*) ;; \
|
|
|
|
esac; \
|
|
|
|
${ECHO} $$file; \
|
|
|
|
done | \
|
2015-08-17 19:35:23 +02:00
|
|
|
${PKGSRC_SETENV} ${CHECK_SHLIBS_NATIVE_ENV} ${AWK} -f ${CHECK_SHLIBS_NATIVE} > ${ERROR_DIR}/${.TARGET}
|
2007-08-20 13:04:02 +02:00
|
|
|
.endif
|