Up to [cvs.NetBSD.org] / pkgsrc / mk
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
mk: Add support for stricter USE_INDIRECT_DEPENDS. The current and historical behaviour is that the BUILDLINK_DEPMETHOD for a package defaults to "full", regardless of what any parent package that included it has set for its BUILDLINK_DEPMETHOD. In addition, only direct dependencies and indirect "build" dependencies are logged as dependencies in the files that are used for check-shlibs verification and package dependency metadata for pkg_install. Any indirect "full" dependency is ignored. This combination of factors can lead to a broken package being produced. A package may end up linking against a pkgsrc library, but because it is an indirect dependency, and because indirect "full" dependencies are not registered, check-shlibs will have no knowledge of it and has to assume that it is correct. This situation will occur if any packages that are a parent dependency of the required library have set BUILDLINK_DEPMETHOD to "build". To mitigate this problem, a more accurate algorithm is implemented to calculate BUILDLINK_DEFAULT_DEPMETHOD for each package based on the setting of its parent(s), rather than simply defaulting to "full". If USE_INDIRECT_DEPENDS is enabled, then the output of this algorithm is used, and both "build" and "full" indirect dependencies are calculated and added to the dependency metadata files. check-shlibs can then use this extra information to issue an error if a library is found to belong to an indirect build dependency. Unfortunately due to buildlink3.mk inclusion guards, we cannot currently guarantee that the BUILDLINK_DEFAULT_DEPMETHOD setting for each package is 100% accurate, and so there may be the occasional false positive when USE_INDIRECT_DEPENDS is enabled. For this reason it is currently not enabled by default, but it is strongly recommended that developers, and especially anyone producing public binary packages, enable it.
mk: rename show-depends-all to show-depends-recursive This avoids confusing the target with the similarly named show-all-depends, which lists makefile variables related to the depends phase. Suggested by J. Lewis Muir on pkgsrc-users. https://mail-index.netbsd.org/pkgsrc-users/2022/04/13/msg035470.html
mk: add show-depends-all Previously, there was no easy way to list all dependencies of a package. The target show-depends only lists the direct missing dependencies, the target show-depends-dirs lists all direct dependencies, but neither lists the indirect dependencies as well. The newly added target show-depends-all includes the indirect dependencies. While here, document the existing targets since they differ subtly. https://mail-index.netbsd.org/pkgsrc-users/2022/04/07/msg035444.html
Fix spelling, it is PKGSRC_RUN_TEST.
Introduce TEST_DEPENDS. Place them in ALL_DEPENDS iff PKGSRC_RUN_TESTS is set, so that bulk builds will pick them up.
Split BUILD_DEPENDS into TOOL_DEPENDS and BUILD_DEPENDS in mk/. Build depends are target packages that are needed at build-time for, e.g., static libraries to link against, header files to include, &c. Tool depends are native packages that are needed at build-time for, e.g., compilers/linkers/&c. to run. ok agc
Introduce PKGSRC_SETENV, defaulting to SETENV. Can be set to ${SETENV} -i
to santise environment
Remove all uses of the following targets from pkgsrc: show-all-depends-dirs show-all-depends-dirs-excl Replace them with calls to pkgsrc/mk/scripts/depends-depth-first.awk which does the same thing but without the extra overhead of invoking a recursive make.
* Add a new stage "bootstrap-depends" that happens before all other
stages, and that installs dependencies listed in BOOTSTRAP_DEPENDS.
The bootstrap-depends step works just like the normal depends step
and honors the value of DEPENDS_TARGET. It's now possible to add
dependencies solely to facilitate fetching the distfiles, e.g.
BOOTSTRAP_DEPENDS+= curl-[0-9]*:../../www/curl
* Teach the tools framework about ":bootstrap" as a tools modifier
which indicates the tool should be added as a dependency via
BOOTSTRAP_DEPENDS.
* Add "digest" to the tools framework.
* Use USE_TOOLS+=digest:bootstrap to force pkgsrc to install digest
before anything else. Get rid of unused "uptodate-digest" target
and related digest version-checking code.
* Finish the refactoring work: split checksum-related code out of
bsd.pkg.mk and into pkgsrc/mk/checksum and replace the "checksum"
target command list with a script that does all the real work.
* Make DIGEST_ALGORITHMS and PATCH_DIGEST_ALGORITHM into private
variables by prepending them with an underscore. Also, rename
_PATCH_DIGEST_ALGORITHM to _PATCH_DIGEST_ALGORITHMS and adjust the
makepatchsum target to allow that variable to contain a list of
algorithms, all of which are used when creating the patch checksums
for ${DISTINFO_FILE}.
Instead of accumulating _ALL_DEPENDS_PKGSRCDIRS, accumulate _ALL_DEPENDS instead -- this keeps more information around.
Remove some unnecessary parens... we don't need to invoke a new shell just to run the depends-walk command.
Move the following targets from bsd.pkg.mk to bsd.utils.mk:
show-depends-dirs
show-all-depends-dirs
show-all-depends-dirs-excl
While we're here, reimplement them using the new pkg_paths and
depends-depth-first.awk scripts. As a side effect, this speeds up
the execution of these targets by around 5-15% depending on the
complexity of the dependency graph.
NOTE: This *does* change the behavior of these targets slightly because
the output is now newline-separated instead of space-separated,
and the order of the output lines doesn't match the original
targets because the dependency graph is now walked depth-first
instead of breadth first.
Modify the show-depends-pkgpaths implementation so that we don't assume
package directories specified in DEPENDS lines begin with "../..". The
new standalone script pkgsrc/mk/scripts/pkg_path will canonicalize them
into package paths relative to ${PKGSRCDIR}.
Pass MAKEFLAGs to the depends-depth-first.awk script, which will be used by the "make show-depends-pkgpaths" process to short-circuit some of the rather lengthy computations that are spread throughout bsd.pkg.mk and files included by bsd.pkg.mk. This causes the script to speed up noticeably. Also, rename the _DEPENDS_DEPTH_FIRST_CMD variable to _DEPENDS_WALK_CMD for brevity and to allow for other implementations in the future.
Create a standalone awk script, depends-depth-first.awk, that encapsulates the code that performs the dependency graph traversal (in depth-first fashion). This script has a hook that allows executing a shell command line upon visiting a dependency's package directory in either prefix or postfix order, and may be used to simplify the code in bsd.pkg.mk that iterates over dependencies. This awk script requires the target "show-depends-pkgpaths", which is defined in a new Makefile pkgsrc/mk/bsd.utils.mk. This file should accumulate "utility" targets that current exist in bsd.pkg.mk, i.e., "helper" targets for various actions.