Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: the setup hook breaks with __structuredAttrs = true #289037

Closed
fgaz opened this issue Feb 15, 2024 · 1 comment
Closed

cmake: the setup hook breaks with __structuredAttrs = true #289037

fgaz opened this issue Feb 15, 2024 · 1 comment
Assignees
Labels
0.kind: bug Something is broken significant Novel ideas, large API changes, notable refactorings, issues with RFC potential, etc.

Comments

@fgaz
Copy link
Member

fgaz commented Feb 15, 2024

Describe the bug

The cmake setup hook breaks with __structuredAttrs = true.

Steps To Reproduce

Write a derivation that uses cmake with __structuredAttrs = true and set cmakeFlags to a list with >1 element.
The build hook always treats $cmakeFlags as a normal variable, so it uses only the first array element.

Expected behavior

The flags get passed to cmake

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Solution used in the npm hook:

# Based on code from Python's buildPythonPackage wrap.sh script, for
# supporting both the case when makeWrapperArgs is an array and a
# IFS-separated string.
#
# TODO: remove the string branch when __structuredAttrs are used.
if [[ "${makeWrapperArgs+defined}" == "defined" && "$(declare -p makeWrapperArgs)" =~ ^'declare -a makeWrapperArgs=' ]]; then
local -a user_args=("${makeWrapperArgs[@]}")
else
local -a user_args="(${makeWrapperArgs:-})"
fi

Workaround: use cmakeFlagsArray instead.

Notify maintainers

@teto @ttuegel @LnL7 @AndersonTorres

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
output here

Add a 👍 reaction to issues you find important.

@fgaz fgaz added the 0.kind: bug Something is broken label Feb 15, 2024
@fgaz fgaz self-assigned this Feb 15, 2024
fgaz added a commit to fgaz/nixpkgs that referenced this issue Feb 15, 2024
Without this workaround, only the first cmake flag gets picked up, so puc-lua
builds fail.
Revert after NixOS#289037 is fixed.
@fgaz fgaz mentioned this issue Feb 15, 2024
14 tasks
vkleen added a commit to vkleen/machines that referenced this issue Feb 18, 2024
@wolfgangwalther
Copy link
Contributor

wolfgangwalther commented Mar 10, 2024

I just noticed the same happens for the meson setup hook and mesonFlags.

@Qyriad Qyriad added the significant Novel ideas, large API changes, notable refactorings, issues with RFC potential, etc. label Jul 17, 2024
@vcunat vcunat closed this as completed in 34a2b7a Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken significant Novel ideas, large API changes, notable refactorings, issues with RFC potential, etc.
Projects
None yet
Development

No branches or pull requests

3 participants