Instead of using file(1) to check for ELF files, just read bytes
directly from the file and check if they are the ELF magic bytes.
Should probably be factored out into a common function that can be used
in other places, if necessary.
Also use awk instead of "grep|awk" for some minor speedup.
Currently fails with a hard to understand error message:
2021-04-16T11:51:36.1074291Z => ERROR: rust-std-1.51.0_1: post-install_06-strip-and-debug-pkgs: '$STRIPCMD --strip-unneeded "$f"' exited with 1
This saves us one sed execution per file in the destdir, resulting
in a major speedup.
Grep will only consider text files and only look at the first line.
The libdir changes to use /usr/lib{32,64} instead of /usr/lib broke
cross builds for some packages that use gir, due to issues with copying
over symlinks. Since we haven't managed to track down the root cause for
the installation path, a symlink is a clean enough temporary fix. This
follows the style of the 00-libdir hooks.
Since pre-install runs for the main package and then each subpackage, it
should use PKGDESTDIR (not DESTDIR), which also enables a subpackage
that installs files during pkg_install to work cleanly.
As far as I can see, the previous hook was quite flawed. Since it was a
pre-install hook, the check for a directory would happen *before*
package installation (so nothing would happen). The only reason it did
anything was because it also ran as a step before a subpackage's
pkg_install (most GIR packages have a -devel subpackage), but used
DESTDIR instead of PKGDESTDIR, so it checked and affected the contents
of the main package. Then when the subpackage's pkg_install ran, the
files would have already been copied to the correct folders.
Closes#27437
Due to constant change in vala, some projects includes some old and
pre-generated vapi in their source tree and uses that version
instead of system one.
Pass system vapidir after real arguments in order to prefer its bundled
vapi.
* $XBPS_CROSS_TRIPLET-pkg-config is our wrapper not a real executable
* In a build that have both freetype-config and pkg-config,
$XBPS_CROSS_BASE will be prepended twice with current system,
let's fix it.
this makes sure we don't have to worry about packages installing
stuff in lib32/lib64, it will be automagically symlinked
if something is still left over for whatever reason, or if the
opposite wordsize directory exists, that will be caught by pkglint
As discussing in [1], on template with "subpackages" as multilines will
report false positive on some packages will never be built.
There're multiple problems here:
- expanded "subpackages" will have an empty line if it has a newline
inside template
- "sed" expression couldn't work with multilines "subpackages"
Let's not quote "$subpkgs" and "$subpackages" in "printf" to let the
shell do expansion and trim the empty lines for us. And rewrite the
"sed" expression to work with multilines "subpackages"
[1]: https://github.com/void-linux/void-packages/pull/26939#issuecomment-739098547
Current wrappers hard-coded them at 0.42 which is very long ago.
Hence, those wrappers insert a versioned vapidir that no longer exists.
The build still work because valac will look into host's versioned vapidir
instead.
Let's check the version we're having and wrap that instead of changing
the hard-coded number from time to time.
Right now they got executed every iteration, but weren't dependent
on the loop. Which resulted in getting the output x times more often
than neccessary