-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Remove NIX_CFLAGS_COMPILE where possible #79303
Copy link
Copy link
Open
Labels
2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.mdhttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md3.skill: sprintableA larger issue which is split into distinct actionable tasksA larger issue which is split into distinct actionable tasks9.needs: clean-upSomebody please clean up this mess!Somebody please clean up this mess!
Metadata
Metadata
Assignees
Labels
2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.mdhttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md3.skill: sprintableA larger issue which is split into distinct actionable tasksA larger issue which is split into distinct actionable tasks9.needs: clean-upSomebody please clean up this mess!Somebody please clean up this mess!
Fields
Give feedbackNo fields configured for issues without a type.
Problem
NIX_CFLAGS_COMPILEis a low-level hack that sneaks compiler arguments past packages' build systems.It has various drawbacks:
.pcfiles, may lack the necessary entries, making problems for downstream packagesBecause many packages use
NIX_CFLAGS_COMPILE, more packages get it added when people copy this style.Solution
It is better to pass
CFLAGS,CXXFLAGSand so on directly to the build system via the method intended to pass compiler flags, for example (feel free to edit this to add more build systems):CFLAGSbefore the./configureinvocation (e.g. by writingCFLAGS = "...";intomkDerivation)CFLAGSbefore thecmakeinvocation (see also cmake setup hook: Allow passing environment variables to cmake invocation #79302)-Dc_args(see also cinnamon.nemo: init at 4.4.1 #77979 (comment) and Report undeclared gio-unix-2.0 upstream #36468 (comment))Delivery
I think we should run a nixpkgs-wide sprint (like #79064) to do this switch for as many packages as possible.
We should also update the documentation to recommend better alternatives to this hack (like above).