Up to [cvs.NetBSD.org] / pkgsrc / mk / pkgformat / pkg
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
mk/pkgformat/pkg: Make default cross-built PKG_DBDIR nicer. `bootstrap --prefix /home/user/pkg' will create an mk.conf with PKG_DBDIR=/home/user/pkg/pkgdb, but if you are using that installation to cross-build packages, you likely want the default cross-built PKG_DBDIR to be /usr/pkg/pkgdb just like the default cross-built LOCALBASE is /usr/pkg. This change implements that. You can still override the cross-built PKG_DBDIR by setting CROSS_PKG_DBDIr in mk.conf. No change to native builds because the new logic is conditional on USE_CROSS_COMPILE = yes.
pkg_install: Fix mistake in previous: this is strchr, not strchrnul. Either if ((q = strchr(p, '/')) == NULL) or if (*(q = strchrnul(p, '/')) == '\0') will work, but not if (*(q = strchr(p, '/')) == '\0') which will crash with a null pointer dereference. Let's get the right version of this committed, not the wrong one! Oops. While here, reset PKGREVISION like I meant to do yesterday.
mk/pkgformat/pkg: Use extended `-m "OS/ARCH VER"' syntax. Requires pkg_install>=20240125. No change to native builds, not even the pkg_install requirement, because this is conditional on cross builds. Proposed on tech-pkg: https://mail-index.netbsd.org/tech-pkg/2024/01/13/msg028825.html
mk: Provide default NATIVE_PKG_TOOLS_BIN on non-NetBSD platforms. I only defined it in platform/NetBSD.mk. Other platforms that support cross-building could take advantage of this too, but let's not just break platforms that don't support it yet!
Split native and cross LOCALBASE for cross-compilation.
This way, you can use an unprivileged prefix of ~/cross/pkg to
cross-compile packages that, when installed, will go in /usr/pkg.
In mk.conf:
- Set CROSS_LOCALBASE to determine the installation prefix of
packages that you cross-compile.
- Set LOCALBASE to determine the installation prefix of native
packages needed for cross compilation.
Both default to /usr/pkg. Note: CROSS_LOCALBASE defaults to /usr/pkg
even if you set LOCALBASE. Of course, if you're not cross-compiling,
this has no effect.
When cross-compiling a package:
- LOCALBASE is where cross-compiled packages will be installed.
(`make install' will put it in ${CROSS_DESTDIR}${LOCALBASE}, of
course, but when you later use pkg_add to install the binary
package on the system you're compiling it for, it will go in
${LOCALBASE}. And you can still set PREFIX for an individual
package, but LOCALBASE refers to where cross-compiled packages are
generally installed, other than the specific ones that override
PREFIX.)
- TOOLBASE is where tool dependencies are installed and available to
be executed at build-time.
For example, if you have TOOL_DEPENDS on a program that is
installed in (say) foo/bin/xyz which is not in PATH so you have to
refer ot its full pathname, you can execute ${TOOLBASE}/foo/bin/xyz
instead of ${LOCALBASE}/foo/bin/xyz.
I chose this split, rather than the other way around, because I
expect that references that are baked into installed packages to be
more common than references that are executed at build-time, but I
didn't do an extensive study of the matter. I chose the name
TOOLBASE because it's where TOOL_DEPENDS go.
pkgformat-vars.mk: Revert requirement for new PKGTOOLS As part of the pkgdb migration (NetBSD only), PGKTOOLS_REQD was set to a recent value (20200828). However, that results in a cyclic dependency of pkg_install on cwrappers on pkg_install. Once people set PKG_DBDIR in pkg_install.conf and mk.conf to match their setup, there is no need -- because of the migration -- to force newer tools. Testing on TNF's pkgbuild machine indicates this revert works well, and I received two positive comments and none against.
Move the pkgdb compatibility error to a NetBSD-specific file to avoid breakage for users who have other package managers that use /var/db/pkg (Reported by Frederic Cambus on FreeBSD, OpenBSD) Adjust warning: specifying PKGDB_DIR in mk.conf should be sufficient for building packages for the compatibility pkgdb location. This is still an error message, because: - While we can handle the existing references of PKGDB_DIR, new ones might be created. - It is a minor inconvenience to people building packages from source.
mk: use LOCALBASE instead of PREFIX I don't understand why this fixes problems, but it does fix the build of mail/neomutt for me. From ryoon.
*: move default database directory from /var/db/pkg to ${PREFIX}/pkgdb
As discussed in August 2020 and previously on pkgsrcCon 2019.
Ok pkgsrc-pmc@
Add USE_PKG_ADMIN_DIGEST flag for switching between $NetBSD$ and SHA256 digests to identify file versions. Defaults to no for now. For digest mode, recursive into FILESDIR, so that e.g. the majority of pkg_install itself is recorded as well SMF manifests.
Run pkg_add(1) and pkg_delete(1) using ${SETENV} ${PKGTOOLS_ENV}.
PKGTOOLS_ENV allows for passing environment variables to the
package install and deinstall scripts.
Always require the 2010 version of pkg_install to simplify things a bit.
Remove pkg_views support, second part: infrastructure.
Fix a typo. No functional change.
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
Be a bit less aggressive in the required version of pkg_install encoded into binary packages.
Rename "flavor" to "pkgformat". This is from Anton Panev's GSoC 2011 project to add RPM and DPKG support to pkgsrc. (I am not adding that further support in this commit.) This is just a rename of the existing functionality. Now it will be easy to test the GSoC work by simply putting in a single directory (such as "rpm" or "deb"). See http://addpackageforma.sourceforge.net/ for some details. This is from Anton's CVS, but I made some minor changes: - changed plural pkgformats to singular pkgformat (to be consistent) - fixed a few places (in comments) that were missed - catch up on some additions to flavor not in the pkgforma cvs: PKGSRC_SETENV and _flavor-destdir-undo-replace and undo-destdir-replace-install.