With `__structuredAttrs = true`, `qtWrapperArgs` is provided as an
array; without it, it is provided as a string.
Use stdenv's `concatTo` helper to normalize `qtWrapperArgs` to a bash
array, regardless of its representation.
Adjust the hook's tests to cover both __structuredAttrs true and false.
the `wrapQtAppsHook` function is called for each output, with prefix set
to the path of the output. As a result, with the previous code it would
only wrap the first output. Instead, ensure the code is called only once
on each output.
Those would be problematic with __structuredAttrs turned on, because
they'd turn those nice bash arrays back into strings - and potentially
lose some of the values on the way.
Always specify the postPhases attribute as a list instead of a string.
Append elements to the postPhases Bash variable using appendToVar
instead of string or Bash array concatenation.
Always specify the prePhases attribute as a list instead of a string.
Append elements to the prePhases Bash variable using appendToVar
instead of string or Bash array concatenation.
Qt is smart enough to figure out the target Qt version for native plugins.
However, Qt is _not_ smart enough to figure out the target Qt version for
QML imports, which causes all kinds of funny breakage when you start running
Qt 5 applications from Qt 6 ones and vice versa.
So, do some minimally invasive surgery to make different Qt versions pick up
different QML import path variables, so they don't mess with each other.
This is kind of very cursed, but what can you do.
This commit fixes builds of `pkgsCross.*.qt5.qtbase` by:
- Adding the buildPlatform compiler to depsBuildBuild in qtbase.nix
and qtModule.nix. The `qtbase` build machinery expects to find it
in the $PATH in unprefixed form.
- Setting the `PKG_CONFIG_SYSROOT_DIR` and `PKG_CONFIG_LIBDIR`
environment variables when compiling a cross-targeted `qmake`.
This is required; if these environment variables are unset,
`qmake` won't even try to use `pkg-config`.
- Adding the `-device` and `-device-option` flags necessary for
cross compilation to `configureFlags`.
- Adding the (one-entry at the moment) Rosetta Stone for QT-5 as a
`let`-defined `qtPlatform` function which takes a nixpkgs platform
and returns a QT-5 `mkspecs`-string.
Co-authored-by: Christoph Neidahl <christoph.neidahl@gmail.com>
The fix-qt-builtin-paths.sh script replaces several strings in *.pr*
files with output names; for example
```
$$[QT_HOST_BINS] is replaced by $dev
```
This causes problems when cross-compiling: the `mkspecs/qconfig.pri`
in the `$dev` output of `qtbase` will have output names *of qtbase*
hardwired into it. Since `qmake` is part of the `qtbase` package,
it will pick up these hardcoded paths when compiling the other
modules.
As a result, the `installPhase` of `qtdeclarative` (and other
modules) will attempt to copy their results into the
already-registered store path for `qtbase`. This will fail, because
Nix prevents writes to a storepath after it has been registered.
Fortunately the `.pri` files understand environment variable
substitution: you can write `$$NIX_OUTPUT_DEV` to tell `qmake` that
it should use the value of the `NIX_OUTPUT_DEV` environment variable
*at `qmake`-run-time* (rather than at `qmake`-build-time).
The primary motivating example is openssl:
Before the change full package build took 1m54s minutes.
After the change full package build takes 59s.
About a 2x speedup.
The difference is visible because openssl builds hundreds of manpages
spawning a perl process per manual in `install` phase. Such a workload
is very easy to parallelize.
Another example would be `autotools`+`libtool` based build system where
install step requires relinking. The more binaries there are to relink
the more gain it will be to do it in parallel.
The change enables parallel installs by default only for buiilds that
already have parallel builds enabled. There is a high chance those build
systems already handle parallelism well but some packages will fail.
Consistently propagated the enableParallelBuilding to:
- cmake (enabled by default, similar to builds)
- ninja (set parallelism explicitly, don't rely on default)
- bmake (enable when requested)
- scons (enable when requested)
- meson (set parallelism explicitly, don't rely on default)
- waf (set parallelism explicitly, don't rely on default)
- qmake-4/5/6 (enable by default, similar to builds)
- xorg (always enable, similar to builds)
The qmake hook sets its own `CONFIG+=debug` or `CONFIG+=release` depending on
how `qtbase` was built. We no longer rely on using the custom deriver for this
feature.
This fix moves linker flags of the form `-framework foo` from dependency_libs to
inherited_linker_flags, since libtool doesn't understand them. See #96977 for
details.
Fixes#96977
Go beyond the obvious setup hooks now, with a bit of sed, with a skipped case:
- cc-wrapper's `dontlink`, because it already is handled.
Also, in nix files escaping was manually added.
EMP
Some executables are built as PIEs (e.g. keepassxc) and are technically
isELFDyn, not isELFExec. Without this change those executables will not
be wrapped.
First, closure size is reduced by including the static libraries in $out instead
of trying to move them to $dev. The Qt build system cannot handle libraries
being split between different prefixes. Previously, the static libraries were
moved into $dev and the shared libraries were symlinked from $out to $dev to
fool the build system. However, this causes $dev to be retained at
runtime. Instead, we now keep the static libraries in $out. Fortunately, the
static libraries are not very large anyway.
Second, we build with QT_NO_DEBUG defined unless debugging is enabled. This
causes some assertions to be removed; when assertions are included, they pull
paths from $dev into the runtime closure by using the __FILE__ macro. We also
now patch qtbase to remove even more assertions when QT_NO_DEBUG is defined.
This continues #23374, which always kept around both attributes, by
always including both propagated files: `propgated-native-build-inputs`
and `propagated-build-inputs`. `nativePkgs` and `crossPkgs` are still
defined as before, however, so this change should only barely
observable.
This is an incremental step to fully keeping the dependencies separate
in all cases.