Commit graph

6 commits

Author SHA1 Message Date
Martin Kinkelin
15d01829af dub build: Fix cross-compilation
The build of the lexer dub subpackage requires running and building
a little config.d tool as custom pregenerate command.

Forwarding the target architecture via `--arch=$DUB_ARCH` to the
nested dub build of config.d was added in #9275, to fix cross-
compilation, but in reality broke it.

Not specifying the architecture explicitly for the little helper
build lets the compiler pick the default one, the host's native
platform in practice, which is guaranteed to be runnable on that
compiling **host**, independent from the **target** platform for
the main dub build. Suppose one cross-compiles the dmd:lexer
subpackage from x86_64 to AArch64 - an AArch64 config.d executable
will hardly run on the x86_64 host, and won't be able to generate
the `VERSION` and `SYSCONFDIR.imp` string-import files as pre-
requisite of the build.

Side note: using little separately-built .d tools/scripts as build
helpers for autogenerating little VERSION files etc. is IMO bad
practice - when cross-compiling, you require a D compiler that can
a) cross-compile, and b) build successfully for the native platform
too. Not sure this approach will e.g. ever work with GDC, where you
have different toolchains for each host->target combination.
2024-07-28 09:01:09 +08:00
Luís Ferreira
cf63dd8e5a
fix(dub): Make config.d executable to incremental compilation (#13712)
Fix issue 22821.

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2022-02-28 14:08:59 +02:00
Jacob Carlborg
ead88f3eb2 Workaround for incorrect working directory for Dub
When DMD is used as a Dub dependency and generates the DMD version as
a pre generate command. Dub will execute this command in the current
working directory, which usually is the root package working directory,
instead of the DMD package directory. This will result in the wrong
version, that is, it will pick up the git tag of the root package
instead of the DMD package.

This looks related: https://github.com/dlang/dub/pull/659.
2019-03-17 15:30:41 +01:00
Sebastian Wilzbach
08394cbae2 Place Dub config binary into generated 2019-02-03 15:48:25 +01:00
Jacob Carlborg
65bd76713c Fix Dub package when cross-compiling
The pre generate commands were using the native platform instead of
target platform.
2019-01-21 12:37:51 +01:00
Jacob Carlborg
71e2660171 Fix building the Dub frontend package on Windows
The Dub package was unconditionally running the `config.sh` shell
script to generate the `VERSION` file. A Bash shell script will not
work on Windows. Therefore the `config.sh` script has been ported to
D, which will work on both Windows and Posix.
2018-11-03 12:03:33 +01:00