Commit graph

722 commits

Author SHA1 Message Date
markd
0ec066acdf tools: re-add (accidentally?) dropped realpath 2022-07-05 20:35:45 +00:00
nia
28450fe530 mk: Use OPSYS_VERSION 2022-05-24 13:08:26 +00:00
schmonz
84417be6a2 tools.Linux.mk: set TOOLS_PLATFORM.date. 2022-05-09 16:44:40 +00:00
nia
2d18181c91 mk: Initial support for NixOS (Linux variant)
A particular challenge for pkgsrc on NixOS is that it usurps all
Unix conventions and stores its system binaries and libraries in
a crazy system of hashed sub-directories:

$ which ls
/run/current-system/sw/bin/ls
$ ls -l /run/current-system/sw/bin/ls
Lrwxrwxrwx 1 root root 65 Jan  1  1970 /run/current-system/sw/bin/ls -> /nix/store/xs02fpnpkq
frhqqfsxx3lpj48wrapd00-coreutils-8.32/bin/ls

We can make a "best effort" attempt to accomodate this by invoking
the compiler to figure out where libc is.  In general, it's required to
adjust the Linux files to make fewer assumptions about the layout of the
filesystem.

However, since using a compiler and libc from NixOS results in /nix/store
paths being embedded in binaries, running the NixOS "garbage collector"
can result in binaries installed from pkgsrc becoming unusable.  Use with
care:

$ readelf -a ~/pkg/bin/perl | grep nix
      [Requesting program interpreter: /nix/store/p5sam91qwz995pi0160rfr7dkh6pibil-glibc-2.32
-39/lib/ld-linux-aarch64.so.1]
 0x000000000000001d (RUNPATH)            Library runpath: [/home/nia/pkg/lib:/home/nia/pkg/li
b/perl5/5.32.0/aarch64-linux/CORE:/nix/store/p5sam91qwz995pi0160rfr7dkh6pibil-glibc-2.32-39/l
ib:/nix/store/vv9nz0bwv1pfl70w14k7dgz6yx7hjwxk-gcc-9.3.0-lib/lib]

Apparently, the "stdenv.cc" package must be installed prior to
bootstrapping pkgsrc.

I worked on this patch last year for a friend who wanted to test
something on pkgsrc but had no other system available.
2022-05-01 08:03:40 +00:00
riastradh
6781c1eb22 tools: Expose NATIVE_AR and NATIVE_RANLIB for cross-builds. 2022-04-16 08:58:19 +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
riastradh
de4c5ea882 mk/tools: Fix readelf for cross-compilation on NetBSD.
This is needed by check-pie.
2022-04-03 10:33:44 +00:00
tnn
2ad23be483 SunOS: add native tool paths for xz & xzcat
Spotted on OpenIndiana, provided by compress/xz pkg
2022-01-09 17:36:52 +00:00
schmonz
7a1c735319 Extract .zst distfiles using archivers/zstd. 2022-01-06 10:19:11 +00:00
jperkin
a8263cd3d6 mk: Use OPSYS_VERSION where appropriate.
Should improve readability and in some cases avoid potential failure due to
string comparisons being used.  No other functional change intended.
2021-11-29 16:14:23 +00:00
nia
df42b88253 mk: Bump DIGEST_RQED. Needed for blake2s. Pointed out by agc, thanks 2021-10-26 18:46:49 +00:00
jperkin
6223292fae mk: Use native bsdtar on NetBSD 9.0 onwards.
Relying on native variables like MKBSDTAR only works when using the native
make, and should be avoided as they are not set when using a bootstrap.

Should fix build of lang/go117 with bootstrapped NetBSD, as bsdtar from
pkgsrc is unable to handle the distfile due to locale errors.
2021-10-22 19:00:06 +00:00
triaxx
2e971fb41f mk: Fix PR pkg/56299
Add a test to check that an xbase set is installed when a tool depends on
X11 and X11_TYPE=native.
Thanks to Greg and Edgar for their comments and suggestions!
2021-07-19 09:55:04 +00:00
ryoon
2cfbc4d2bb mk/tools: gdbus-codegen is in devel category 2021-05-02 14:11:40 +00:00
nia
ab8a1fb4af *: Use the tools framework for gdbus-codegen 2021-05-02 11:06:12 +00:00
nia
773cde7da8 *: Use the tools framework for itstool
Now it should be more obvious when a package needs it as a dependency,
as it will fail loudly if it isn't declared as a tool.

While here, some duplicate dependencies on itstool were removed from the
MATE packages
2021-05-02 10:24:47 +00:00
ryoon
483412fe32 mk: Add preliminary support for MidnightBSD
It is almost as same as FreeBSD.
2021-03-15 16:21:02 +00:00
jperkin
978ec6c985 mk/tools: Avoid native GNU make/m4 on all Darwin systems.
Previously this was only done on Big Sur to work around the issue where XCode
does not support running these programs via a symlink, breaking .tools/bin.

However, with the update to autoconf 2.70, the native GNU m4 from 2006 on all
Darwin systems is too old and breaks the build on Catalina and older, causing
massive dependency failures.

Avoiding them both completely at this time is the simplest way forward.
2021-01-19 11:42:18 +00:00
gutteridge
03278bccfb Reflect GNU grep locations on some SunOS variants 2020-12-09 01:24:24 +00:00
js
3a435e0e01 tools.Linux.mk: Consider /bin/find as well 2020-12-05 13:15:58 +00:00
jperkin
381af86204 mk: Stop using XCode binaries on Big Sur.
These no longer support being executed via a symlink, failing with errors
such as:

  xcode-select: Failed to locate 'gmake', and no install could be requested

This breaks the entire .tools/bin directory, so we just have to avoid them
and use tools from pkgsrc instead.

It's likely a lot more will need to be added to this list, but this is
enough to get devel/cmake building at least.
2020-10-10 09:31:50 +00:00
rillig
c44518e90f mk: fix undefined variables for current make running in -dL mode
In lint mode, NetBSD's make is stricter about undefined variables.  In
conditions, the function arguments must be fully defined.
2020-10-06 17:36:50 +00:00
nia
bee9205d2d mk/tools: not all linuxes have bash (e.g. alpine) 2020-05-28 14:47:36 +00:00
rillig
b634189104 mk/tools/bsd.tools.mk: list _USE_TOOLS in show-all-tools
This variable is used in quite a few places, which makes it interesting
enough, even though it is an implementation detail.
2020-05-13 04:24:17 +00:00
rillig
7f4b055291 mk/tools: don't create empty symlink for wrong tool definition
This case can only happen in the following special case:

TOOLS_CREATE+=		asdf
TOOLS_PATH.asdf=	# empty

If there is a lonely TOOLS_CREATE without a corresponding TOOLS_PATH, it
defaults to ${FALSE} and thus doesn't trigger this code.
2020-05-10 14:36:18 +00:00
rillig
10f1774814 mk/tools/perl.mk: allow to silence the USE_TOOLS+=perl warning
Packages that don't declare USE_TOOLS+=perl and whose configure script
invokes perl produce a warning.

Usually warnings are ignored, but they can also be configured as errors,
for example during a strict bulk build.  In this situation it is
necessary to override the default behavior of the perl tool to fail
silently.  Up to now, defining both TOOLS_BROKEN+=perl and
TOOLS_FAIL+=perl produced a duplicate make target.

To handle this situation, let TOOLS_BROKEN+=perl take precedence over
TOOLS_FAIL+=perl.  This is much easier than finding out in each case how
to disable the perl check in the configure script, which is most often
done by adding any of the following to CONFIGURE_ENV: PERL=#none,
ac_cv_prog_PERL=#none, ac_cv_path_PERL=#none.
2020-05-10 06:05:35 +00:00
rillig
3ab427f38a mk/tools/create.mk: make tool wrappers smaller
There is no need to include the comments from the shquote function.
2020-05-09 21:08:05 +00:00
rillig
959e1dbe9a mk/tools/bsd.tools.mk: include _TOOLS_VARNAME in show-all-tools
This information is useful for getting the variable name that corresponds
to a tool.  In most cases this is just the uppercase name of the tool,
but there are exceptions like ${SETENV} for env, ${HOSTNAME_CMD} for
hostname.
2020-05-09 21:04:14 +00:00
rillig
a17e4f77d6 mk/tools/create.mk: add new variable TOOLS_ALWAYS_WRAP for debugging 2020-05-09 20:50:20 +00:00
rillig
c166122011 mk/tools: in show-all-tools, sort tool variables by relevance
Before, these variables were sorted alphabetically, which made the output
more difficult to read.
2020-03-13 17:33:02 +00:00
tnn
78df98ea63 put back bsdtar as host tool, conditional on MKBSDTAR
http://mail-index.netbsd.org/source-changes/2020/01/17/msg112935.html
2020-02-25 11:20:28 +00:00
kamil
0e2f37cee8 tools/tools.NetBSD.mk: Register TOOLS_PLATFORM.realpath 2020-02-13 00:40:35 +00:00
tnn
672bc47484 remove bsdtar as tool because it was reverted in src for some reason ... 2019-11-21 21:11:22 +00:00
ryoon
914dc9f9ab NetBSD 9 or later has bsdtar as /bin/tar 2019-09-06 03:52:55 +00:00
jperkin
6a956a0ad2 mk/tools: Ensure GNU grep is used when requested.
Previously a "grep" tool was created, but GREP still pointed at the platform
grep, breaking any package that used the environment variables rather than
PATH when the native platform grep does not have GNU features.
2019-06-06 11:54:33 +00:00
rillig
122d791da2 mk/tools: in the wrapper log, quote arguments containing = naturally 2019-05-22 20:47:05 +00:00
leot
f127cb7934 mk/tools: Add support for autoconf*:test and automake*:test
Thanks to <martin> for catching the unintended autoconf tool dependency!
2019-05-15 10:49:28 +00:00
rillig
b88d952e81 mk: allow "bmake clean depends" as shortcut
When "bmake clean depends" was called for a package where the various
cookie files already existed, these would enable different rules than a
clean package directory.

Since "bmake clean" deletes all the cookie files before "bmake depends"
starts, in these combined command lines the cookie files must be treated
as absent.
2019-05-07 19:36:43 +00:00
rillig
119b552796 mk/tools/replace.mk: take versions of FLEX_REQD into account
If a package had said FLEX_REQD=1000.0, the actual dependency had still
been flex>=2.5.4. Now all version numbers from FLEX_REQD are taken into
account, too.
2019-04-03 18:37:24 +00:00
rillig
81a41d0b94 mk/tools: correctly quote arguments in the tool wrapper log
Before, the tool arguments were written to the log as plain strings. Now
the arguments are properly quoted, which makes it possible to replay the
commands by copying them from the .work.log file.

This only affects tools that are shell builtins (echo, true, false), get
additional arguments (mkdir -p) or define a custom TOOLS_SCRIPT
(pkg-config, to set an environment variable; or autotools). Tools that
are symlinked to the real tool are not affected.

The calls to the compiler are already properly logged since cwrappers
takes care of that. This commit therefore makes the log entries for the
compilers and the other tools more similar.
2019-03-24 11:29:19 +00:00
rillig
575f219e37 mk/tools: fix quoting when logging tool invocations
When a package or the infrastructure defined a tool with custom
TOOLS_ARGS or TOOLS_SCRIPT containing special characters, these could
lead to unintuitive interactions at the time when that tool invocation
was logged in the tool wrapper log. Some of the logging output ended up
on stdout, while some of the normal output ended up in the log, and parts
of the quoted arguments were even evaluated as shell commands.

The logging of the wrapped tool commands is not perfect yet, but at least
it's much more predictable now.
2019-03-24 08:40:07 +00:00
rillig
23128f791d mk/tools: fix unintended filename expansion in the tool wrapper log file 2019-03-22 22:13:21 +00:00
rillig
016d9a0f3d mk/tools: sort tools by name when calling "make show-all-tools" 2019-03-22 16:17:50 +00:00
rillig
09dc181cca mk/tools: fix BISON_REQD handling for lists of multiple Bison versions 2019-03-21 21:47:29 +00:00
joerg
6537bdc125 ghostscript-esp is long gone. 2019-03-10 19:52:18 +00:00
wiz
0b07edd732 mk/: let fonts/mkfontscale provide mkfontdir 2019-03-04 11:56:05 +00:00
triaxx
43226095e2 tools.FreeBSD.mk: make groff conditional
FreeBSD 12 removes groff: test its existence before using it.
2019-02-12 18:40:16 +00:00
leot
948e68bb1f mk/tools/replace.mk: Update the check to devel/nbpatch
The check to avoid possible dependency loop was not updated to
check devel/nbpatch (instead of devel/patch).

Fix PR pkg/53920 reported by Dean Matzkov.
2019-01-29 22:41:00 +00:00
wiz
0b260f2148 mk/tools/automake.mk: support automake-1.16 2018-12-01 04:58:55 +00:00
rillig
858c6cfd69 mk/misc: make configuration for show-all targets more configurable
Up to now, there was a central list of variable name patterns that
defined whether a variable was printed as a sorted list, as a list or as
a single value.

Now each variable group decides on its own which of the variables are
printed in which way, using the usual glob patterns. This is more
flexible since different files sometimes differ in their naming
conventions.

Two variable groups are added: license (for everything related to
LICENSE) and go (for lang/go).
2018-11-30 18:38:19 +00:00