Commit graph

95 commits

Author SHA1 Message Date
riastradh
d237f71fea mk/pkgformat/pkg: Fix deinstall of cross-built package. 2022-04-04 11:40:20 +00:00
riastradh
a1abd9761c mk: Cross-eyed hacks to support cross-libtool.
For a long time, when cross-building, say from native=amd64 to
target=powerpc, it was necessary to:

1. cross-build a _powerpc_ package called cross-libtool-base-powerpc,
   and then

2. install the powerpc package _natively_ with `pkg_add -m x86_64' to
   override the architecture check that normally forbids this kind of
   shenanigans,

in order to cross-build anything that uses libtool as a tool.

This is partly because libtool doesn't follow the normal GNU
convention of `./configure --build=<native platform> --host=<platform
package will run on> --target=<platform package is configured to
operate on>' -- in this example, build=amd64, host=amd64,
target=powerpc.

Instead, libtool expects to be cross-built itself, even if it's going
to run as a tool.  It's not as bonkers as it sounds at first: libtool
is just a shell script, and it caches various information about the
(cross-building!) toolchain it is built with so it can use that
information later when it is run as a tool itself to cross-compile
other software.

To make this work, we need to create the toolchain wrappers for
libtool _as if_ we were cross-building even if we are building a
native package.  So mk/tools uses a new flag TOOLS_USE_CROSS_COMPILE
instead of USE_CROSS_COMPILE, and libtool internally sets
MACHINE_ARCH=${TARGET_ARCH} (in the example above, powerpc) to make
it look like we're cross-building.  The new TOOLS_CROSS_DESTDIR is an
alias for the (defaulted) CROSS_DESTDIR, which must now be set
unconditionally in mk.conf in order for libtool to know where the
cross-destdir will be; _CROSS_DESTDIR remains empty when building any
native packages (including the native cross-libtool package).

Finally, we need to make the resulting package be a native package,
with MACHINE_ARCH set to the one that it will be installed on (in the
example above, amd64), so I added an indirection _BUILD_DEFS.${var}
to replace var on its own in the build definitions that get baked
into the package, shown by `pkg_info -B'.  Setting
_BUILD_DEFS.MACHINE_ARCH=${NATIVE_MACHINE_ARCH} ensures that this
mutant hybrid cross-built libtool still produces a native package.

All of this logic is gated on setting USE_CROSS_COMPILE in mk.conf or
LIBTOOL_CROSS_COMPILE in the package makefile, so it should be safe
for non-cross-builds -- when USE_CROSS_COMPILE=no and you're not
building cross-libtool, everything is as before.
2022-04-04 11:23:06 +00:00
tnn
c66e9db28b mk: revert local change 2022-03-28 10:49:12 +00:00
tnn
536ce33d1f m*/*: revbump(1) for libsndfile 2022-03-28 10:45:17 +00:00
schmonz
356253d0e0 I export pkgsrc over NFS from a macOS host to a variety of VMs, each of
which sets ${PACKAGES} to a subdir of ${PKGSRCDIR}/packages (on the same
NFS mount) so that the generated packages all land in one place.

From my Debian, Devuan, Ubuntu, and CentOS 8 (but not 7) VMs,
copying ${STAGE_PKGFILE} to ${PKGFILE} fails to preserve permissions,
which fails the copy and the "package" target with it. The error
looks like so:

===> Building binary package for foo-4.2
=> Creating binary package /home/schmonz/trees/pkgsrc-cvs/packages/Debian/All/foo-4.2.tgz
/bin/cp: preserving permissions for ‘/home/schmonz/trees/pkgsrc-cvs/packages/Debian/All/foo-4.2.tgz’: Operation not permitted

Assuming permissions on built packages are merely a nice-to-have, avoid
failing if we couldn't preserve them. Patch from sjmulder@, for whom
this fixes a similar problem with FreeBSD with ZFS.
2021-12-11 09:01:23 +00:00
khorben
0e67d2c6e9 Also substitute SYSCONFBASE in MESSAGE files 2021-11-07 18:49:28 +00:00
joerg
e58a801ede Preserve stdin for the bootstrap and dependency handling like done for
normal dependencies.
2021-04-06 18:46:06 +00:00
rhialto
702896ca95 Remove "mismatch" flag also in the other place.
Also, remove check for empty +INSTALLED_INFO which seems no longer needed.
2021-01-17 20:18:42 +00:00
rhialto
51c58acbfc make replace' now also unsets the mismatch' variable.
This is for the benefit of pkg_rolling-replace 0.24.9.
ok gdt@.
2021-01-09 19:10:05 +00:00
gdt
c37dbc0d7f 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.
2020-12-24 01:31:19 +00:00
maya
c7638cd9c1 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.
2020-12-18 17:14:58 +00:00
wiz
02e6ee5666 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.
2020-12-03 10:04:48 +00:00
wiz
c85d83c09c *: move default database directory from /var/db/pkg to ${PREFIX}/pkgdb
As discussed in August 2020 and previously on pkgsrcCon 2019.

Ok pkgsrc-pmc@
2020-12-02 10:22:39 +00:00
jperkin
7fca306169 mk: Exclude /System/Library on Big Sur too.
As expected this is necessary, as early as requring the CoreFoundation
framework for devel/gettext-lib.
2020-10-09 20:18:30 +00:00
jperkin
4d7409c2ae 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 16:00:16 +00:00
maya
a53780f17e revert metadata.mk:1.24, keep passing useless flag -U.
It wasn't useless in older pkg_create, as used by netbsd-7.
Reported by sborrill.
2020-07-06 18:29:11 +00:00
rillig
c7940cfb7f mk/.../metadata.mk: properly clean up loops after removing ""
There is no evidence that any shell needs the empty string literal in
'for i in "" $var' to loop over a simple variable.  This would only be
necessary if the shell code were generated by a preprocessor such as
bmake or autoconf, and the list of items might end up empty.  In such a
case, the empty string literal prevents to generate 'for i in ; do',
which would produce a syntax error.
2020-06-07 04:41:58 +00:00
rillig
cd76433a09 mk/.../metadata.mk: fix reference to undefined shell variable
When RUN includes the -u shell option (see the pkgsrc guide, section
bulk.var.shvar), there is a stray "requires: parameter not set" error.

This error doesn't make the build fail immediately since it is on the
left-hand side of a pipe, where the exit status is ignored.  It would
fail if the shell for bmake were set to bash and its option "pipefail"
were enabled.
2020-06-06 09:33:56 +00:00
maya
f1308fb6bd Flip the switch on ALLOW_VULNERABLE_PACKAGES to allow them by default.
Right now, users who install the pkg-vulnerabilities database find that
the vast majority of packages fail to build, penalizing them too severely.
Package auditing can still be done via "pkg_admin audit".

Alternatively, the previous behaviour can be restored with
ALLOW_VULNERABLE_PACKAGES=no in mk.conf.

Additionally, bmake-ify the check.mk logic. It was easier to do this,
as the package relied on a single long ${RUN} command.

Proposed on tech-pkg, with no objections to the idea of changing the
default, just the method of doing so.
2020-05-28 16:22:58 +00:00
joerg
84342eb5e0 Add a missing redirect to ensure that all files are picked up for
hashing.
2020-05-22 01:24:05 +00:00
rillig
e45d2e3458 mk/pkgformat/metadata.mk: fix relative paths in PATCHDIR and FILESDIR
Before, relative paths had been stored as-is.  This affected those
packages that defined PATCHDIR or FILESDIR as relative directory instead
of prefixing it with ${.CURDIR}.

Since there are already several other paths that are interpreted relative
to the package directory (CONFLICTS, DEPENDS), allow PATCHDIR and
FILESDIR to be specified as relative paths, too.  This makes the package
Makefiles a bit shorter.
2020-05-21 18:48:43 +00:00
maya
309a5cc299 pkg_create -U doesn't do anything, don't pass the flag. 2020-05-15 22:13:39 +00:00
joerg
495466824a Suppress unnecessary output when not debugging 2020-04-30 23:50:28 +00:00
rillig
7f191db6be mk/pkgformat: include only relevant ident strings in +BUILD_VERSION
Before, not only files containing an RCS Id were recorded in the
+BUILD_VERSION file but also files containing text that looked similar to
an RCS Id were recorded, even though these didn't contain any valuable
version information.

The effect was that before this change, pkgtools/pkglint was built over
and over again by the bulk builds since pbulk uses a different regular
expression for detecting modified files.

The regular expression for unexpanded RCS Ids is added to record files
that have never been checked in to CVS, just to have them recorded and to
distinguish them from the final committed version.

See https://mail-index.netbsd.org/tech-pkg/2020/01/11/msg022489.html.
2020-01-15 20:11:11 +00:00
rillig
8b2c7d624a mk/pkgformat: include only relevant ident strings in +BUILD_VERSION
Before, not only files containing an RCS Id were recorded in the
+BUILD_VERSION file but also files containing text that looked similar to
an RCS Id were recorded, even though these didn't contain any valuable
version information.

The effect was that before this change, pkgtools/pkglint was built over
and over again by the bulk builds since pbulk uses a different regular
expression for detecting modified files.

The regular expression for unexpanded RCS Ids is added to record files
that have never been checked in to CVS, just to have them recorded and to
distinguish them from the final committed version.

See https://mail-index.netbsd.org/tech-pkg/2020/01/11/msg022489.html.
2020-01-15 20:03:10 +00:00
rillig
1498fcf3dd mk/pkgformat: fix documentation 2020-01-14 22:22:34 +00:00
rillig
1f7df547ed mk/pkgformat: fix documentation 2020-01-14 22:21:19 +00:00
rillig
48d051044f mk/pkgformat: update documentation in list-dependencies 2020-01-13 07:31:53 +00:00
taca
ca4fe2672a mk/pkgformat/pkg/metadata.mk: Fix awk syntax
Fix awk syntax.
2020-01-13 06:52:57 +00:00
ryoon
bf792e6f39 mk: Add missing line continuation, fix post-install 2020-01-13 03:38:01 +00:00
joerg
43c574a4a9 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.
2020-01-12 23:38:42 +00:00
jperkin
41c29c5abd mk: Ensure only the first NetBSD rcsid is used.
There are a couple of places in pkgsrc where rcsid's are generated, and
these were leaking into "pkg_info -b" output.  This had the side effect of
causing those packages and all their dependencies to be rebuilt for every
bulk build as the output and the respective files always mis-matched.
2019-10-01 13:01:02 +00:00
jperkin
3f3dc70553 mk: Support MESSAGE.rcd and MESSAGE.smf.
Previously packages configured these manually based on INIT_SYSTEM, this
centralises support for them so they only need to exist to be pulled in
accordingly.
2019-05-28 13:32:06 +00:00
rillig
3378b74ea0 mk/pkgformat: add show-all-depends target 2019-04-03 18:38:16 +00:00
roy
92284935f7 Call replace-names before SU
This allows the replace target to work with OBJ on NFS where root
isn't allowed.
2019-01-22 14:29:44 +00:00
joerg
6abe02f428 Don't include TEST_DEPENDS in the normal dependency reduction run. 2018-01-25 00:34:27 +00:00
joerg
dbaa510884 Add missing empty TEST_DEPENDS for the bootstrap case. 2018-01-14 10:47:43 +00:00
joerg
e97fae9138 Introduce TEST_DEPENDS.
Place them in ALL_DEPENDS iff PKGSRC_RUN_TESTS is set, so that bulk
builds will pick them up.
2018-01-13 12:48:56 +00:00
wiz
8444b9a444 Comment out debug printf. 2017-10-06 14:46:21 +00:00
jlam
2c5ffee9f0 reduce-depends.awk: Also reduce "exact match" and "any version".
Also reduce patterns of the form:

	pkg-version	(exact match)
	pkg-[0-9]*	(fnmatch pattern matching any version)
2017-10-04 04:13:12 +00:00
jlam
c47bf45c32 reduce-depends.awk: Match version strings containing tilde (~). 2017-10-04 04:13:00 +00:00
jlam
6b7428c49d reduce-depends.awk: Avoid "delete array" statement for portability.
POSIX awk doesn't allow "delete array" to delete an entire array.
For portability, one must delete each element of the array.
2017-10-01 22:58:19 +00:00
jlam
aca4516d1d reduce-depends.awk: Avoid gensub() for portability. 2017-10-01 17:57:18 +00:00
jlam
5cd938212b reduce-depends.awk: Reduce "pkg>1" and "pkg<2" into "pkg>1<2".
Enhance the reduce-depends.awk script to reduce a larger set of
dependencies into a single dependency.  The patterns representing
intervals of version numbers (can be open-ended) are of the form:

	pkg>lower
	pkg>=lower
	pkg<upper
	pkg<=upper
	pkg>lower<upper
	pkg>lower<=upper
	pkg>=lower<upper
	pkg>=lower<=upper

These patterns are now condensed into a single dependency of the
same form.  For example, given the following patterns:

	pkg>=1.0
	pkg>2.0
	pkg<3.0
	pkg<=4.0
	pkg>=2.5<3.5

the reduced pattern becomes:

	pkg>=2.5<3.0

Add the test script used to help with refactoring and adding the
new feature to the script.

This is a mostly complete rewrite of the script; change the
license to the standard 2-clause BSD license used by TNF.
2017-10-01 04:00:40 +00:00
jlam
ed5291d835 mk/pkgformat: Only pass "-C" option to pkg_create(1) if it's valid.
Only pass "-C ${CONFLICTS}" to pkg_create(1) if ${CONFLICTS} is
non-empty; otherwise, a fatal error occurs.  This allows CONFLICTS
to be defined, but empty.
2017-08-23 17:52:30 +00:00
jlam
efa81dcfaa mk/pkgformat: Support INSTALL scripts that rely on UNPACK.
The pkginstall framework had an UNPACK action invoked early
in the PRE-INSTALL stage to unpack scriplets that were invoked
in later stages to perform extra work for installation, removal,
or both.

Add an UNPACK action that is a no-op for any scripts that don't
support the action.
2017-08-21 12:48:25 +00:00
jlam
98e1e541d0 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.
2017-08-19 00:30:19 +00:00
jlam
1d3dfdfebc Substitute the correct string for GTK3_UPDATE_ICON_CACHE. 2017-08-19 00:29:45 +00:00
jlam
ad2d4d8890 mk/pkgtasks: Failures in POST- stages of the scripts are non-fatal.
The return values of the postinstall and postremove meta-tasks are
ignored unless the user-settable variable ${PKG_FATAL_ERRORS} is
"yes".  ${PKG_FATAL_ERRORS} defaults to "no" to preserve the
existing behavior of install scripts by mk/pkginstall.
2017-08-10 05:41:52 +00:00
jlam
a8a45f8487 mk/pkgtasks: Add infrastructure to use "icon_themes" package task.
Add definitions for the gtk-update-icon-cache(1) command to the
script header template, and a makefile fragment that creates the
data file for the "icon_themes" package task if ${ICON_THEMES} is
"yes" in the package Makefile.

Also bump pkgtasks dependency to version 1.12 for the "icon_themes"
package task and compatibility with pkgsrc/mk/pkginstall.
2017-08-10 05:41:07 +00:00