Commit Graph

50 Commits

Author SHA1 Message Date
Matt Sturgeon
cd5e77db80 wrapQtAppsHook: support structuredAttrs
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.
2026-06-04 01:43:31 +01:00
Guillaume Girol
09d904640a wrapQtAppsHook: wrap once per output instead of only the first output
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.
2026-01-21 11:40:53 +01:00
Lin Jian
7712700b18 wrapQtAppsHook: actually use makeQtWrapper for symlinks
Since -f implies -h, -h needs to be checked first.
2025-02-18 19:19:46 +08:00
Wolfgang Walther
9d243b6e7b treewide: handle *Phases variables __structuredAttrs-agnostically (round 2) (#352709) 2024-12-16 22:36:44 +01:00
Yueh-Shun Li
3e7009dee3 qt5.wrapQtAppsHook: append *Phases with appendToVar 2024-12-17 01:46:04 +08:00
Wolfgang Walther
d86588d230 treewide: improve prepending and appending derivation arguments in bash code
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.
2024-11-25 09:09:23 +01:00
Yueh-Shun Li
758056dac7 treewide: handle postPhases __structuredAttrs-agnostically
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.
2024-09-03 05:56:17 +08:00
Yueh-Shun Li
21c0129841 treewide: handle prePhases __structuredAttrs-agnostically
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.
2024-09-03 05:33:59 +08:00
Wolfgang Walther
1bcca7d66b qt: support structuredAttrs in qmake hook
Tested qbs with and without __structuredAttrs.
2024-08-24 12:23:38 +02:00
K900
ee70129510 qt5, qt6: use versioned QML import paths in wrappers
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.
2024-01-17 11:32:40 +03:00
Samuel Dionne-Riel
6e8985702c Revert "qt5.qtbase: fix cross" 2023-08-26 19:08:53 -04:00
Adam Joseph
1430b56362 qt5.qtbase: fix cross compilation
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>
2023-08-20 21:41:19 -07:00
Vladimír Čunát
3ffdc0b033 Merge #220311: qt-5/hooks: do not hardcode output paths
...into staging
2023-03-25 17:35:13 +01:00
Vladimír Čunát
a53bfc01dc Merge #219427: qt5: make overrriding with separate debug info useful
...into staging
2023-03-25 13:27:33 +01:00
Guillaume Girol
b237f5b637 qt5: make overriding separatedebuginfo useful
qmake strips before we separate the debuginfo
2023-03-19 12:00:00 +00:00
Adam Joseph
fa9659e0de qt-5/hooks/fix-qt-builtin-paths.sh: do not hardcode output paths
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).
2023-03-09 03:37:08 -08:00
Sergei Trofimovich
69cf5181c3 stdenv/generic/setup.sh: enable parallel installs by default
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)
2023-02-26 22:02:09 +00:00
Nick Cao
67751b2737 qt5.wrapQtAppsHook: fix interaction with strictDeps 2023-02-01 15:10:50 +08:00
Dmitry Kalinkin
60055478c9 wrapQtAppsHook: fix a typo 2021-09-29 14:54:51 -04:00
Dmitry Kalinkin
1327726568 wrapQtAppsHook: add extra paths for macOS applications 2021-09-29 14:51:50 -04:00
Dmitry Kalinkin
ee33a90c56 qt: use isELF and isMachO in wrapQtAppsHook 2021-09-28 10:13:44 -04:00
Thomas Tuegel
5590e365e4 qtbase: Check for wrapQtAppsHook in setupHook 2021-01-25 15:56:15 -06:00
Thomas Tuegel
67b7cffaec wrapQtAppsHook: only run the hook once 2021-01-25 15:56:15 -06:00
Thomas Tuegel
7744998f04 qtbase: Set cmakeFlags and NIX_CFLAGS_COMPILE in setupHook 2021-01-25 15:56:05 -06:00
Thomas Tuegel
b80ce0aeca qmake: Select debug or release build
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.
2021-01-24 09:51:34 -06:00
Graham Bennett
8e4e38cdcd octave: Fix libtool framework link failure on Darwin
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
2020-09-06 20:24:14 +01:00
Bjørn Forsman
9e144d5527 wrap-qt-apps-hook.sh: wrap binaries in ./sbin/
wrap-qt-apps-hook.sh runs before move-sbin.sh, so programs in ./sbin are
currently not wrapped. Fix it.
2019-12-08 20:44:29 +01:00
John Ericson
ef43c5f5d9 wrap-qt-apps-hook: qtWrapperArgs may be undefined 2019-11-17 15:48:39 -05:00
John Ericson
784c3dc0f9 qt5 qmake setup hook: qmakeFlags may be undefined 2019-11-08 13:28:59 -05:00
John Ericson
9b274e2962 qtbase-setup-hook: postPhases may be undefined
My earlier sed missed this because it already had `{..}`.
2019-11-02 19:23:44 -04:00
John Ericson
b7f4bda282 treewide: *Phase(s)? variables are optional
If these aren't defined, the stdenv defaults are used in the `*Phase`
case, or no extra phases are done, in the `*Phases` case.
2019-11-01 14:44:44 -04:00
John Ericson
2811b032d6 treewide: Make still dont* Variables are optional in most cases
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
2019-11-01 14:44:44 -04:00
John Ericson
1290e532ea treewide: Make more dont* variables OK to be undefined in setup hooks 2019-11-01 14:44:44 -04:00
Thomas Tuegel
a2e3bef2e5 Merge pull request #69086 from ttuegel/qt-5.12.4
Qt 5.12.4
2019-09-26 05:24:08 -05:00
worldofpeace
15e99a06a8 wrapQtAppsHook: correct skip directories heuristic 2019-09-20 19:10:02 -04:00
Thomas Tuegel
756b46a449 fix-qmake-libtool.sh 2019-09-19 07:39:11 -05:00
Thomas Tuegel
bddca5a91a qmake-hook.sh: qmakeFlags is an array 2019-09-19 07:39:11 -05:00
Bjørn Forsman
d6e65ec4a0 wrapQtAppsHook: skip directories
Prevents messages like this in the build log:

  grep: <PATH>/bin: Is a directory
2019-09-13 16:53:11 +02:00
Bjørn Forsman
c6d516dfc4 wrapQtAppsHook: use patchelf --print-interpreter instead of isELFExec
Some executables are built as PIEs (e.g. keepassxc) and are technically
isELFDyn, not isELFExec. Without this change those executables will not
be wrapped.
2019-09-13 16:53:11 +02:00
Florian Klink
88146a095f wrapQtAppsHook: use isELFExec
This ensures we only wrap executables, not shared libraries
2019-08-17 16:45:57 +02:00
worldofpeace
7d6ab0ad7a wrapQtAppsHook: use isELF
We should still prevent things like
scripts from being wrapped.
2019-07-17 15:53:15 -04:00
worldofpeace
4908d382ae wrapQtAppsHook: remove isQtApp
This was preventing dolphin from being wrapped.
2019-07-16 20:37:43 -04:00
worldofpeace
6c057aea5c wrapQtAppsHook: wrap binaries in libexec 2019-07-16 17:26:17 -04:00
Thomas Tuegel
f79fd2e826 wrapQtAppsHook: wrap Qt applications for runtime dependencies 2019-07-05 10:41:41 -05:00
Thomas Tuegel
04239641b5 Merge branch 'bugfix/qt-5/closure-size-static-libs' into merge/qt-5.10.0 2018-01-15 18:49:27 -06:00
Thomas Tuegel
75d2a7dc4d qt5: reduce closure size
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.
2018-01-15 18:48:37 -06:00
John Ericson
046f091e0d treewide: Don't use envHook anymore
This commits needs a MAJOR audit as I oftentimes just guessed which of
`$hostOffset`, `$targetOffset`, or a fixed offset should be used.
2017-12-30 22:04:22 -05:00
Orivej Desh
f568450637 qmake: enable parallel building of qmake projects by default 2017-12-07 08:52:42 +00:00
John Ericson
da19c34d0f stdenv setup: Always use both propagated files
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.
2017-11-21 10:44:44 -05:00
Thomas Tuegel
fe0ab944db qt5: factor out common definitions and remove symlink farm
The module definitions are factored out and shared between qt56 and qt59. The
symlink farm which was created during builds is no longer needed.
2017-11-07 07:18:46 -06:00