|
170 | 170 | NIX_CFLAGS_COMPILE = (old.env.NIX_CFLAGS_COMPILE or "") + " -fno-lto"; |
171 | 171 | }; |
172 | 172 | doCheck = false; |
173 | | - # Merge dev into out to eliminate the dev↔lib reference cycle. |
174 | | - # When "dev" is removed from outputs, $dev defaults to $out, |
175 | | - # so all headers/pkgconfig files end up in $out. Downstream |
176 | | - # packages using postgresql.dev get postgresql.out (default |
177 | | - # output behavior for missing outputs). |
178 | | - outputs = prev.lib.remove "dev" (old.outputs or [ "out" ]); |
179 | 173 | outputChecks = {}; |
180 | 174 | separateDebugInfo = false; |
181 | 175 | disallowedReferences = []; |
| 176 | + # Break the dev↔lib reference cycle: dev naturally references |
| 177 | + # lib (via .pc -L flags), but lib also picks up dev references |
| 178 | + # through .la files and baked-in paths. Strip dev refs from lib |
| 179 | + # since lib is a runtime output that doesn't need dev at runtime. |
| 180 | + postFixup = (old.postFixup or "") + '' |
| 181 | + echo "=== postFixup: stripping dev refs from lib ===" |
| 182 | + echo "lib=$lib" |
| 183 | + echo "dev=$dev" |
| 184 | + echo "Files in lib:" |
| 185 | + find "$lib" -type f | head -20 |
| 186 | + # Delete .la files from lib — libtool archives embed absolute |
| 187 | + # paths to dev headers/libs and are unnecessary for runtime. |
| 188 | + find "$lib" -name '*.la' -delete |
| 189 | + # Check which files in lib reference dev before stripping. |
| 190 | + echo "Files in lib referencing dev hash:" |
| 191 | + DEV_HASH=$(echo "$dev" | sed 's|/nix/store/||; s|-.*||') |
| 192 | + grep -rl "$DEV_HASH" "$lib" 2>/dev/null || echo " (none found)" |
| 193 | + # Strip any remaining references to $dev from the lib output. |
| 194 | + find "$lib" -type f -exec remove-references-to -t "$dev" {} + |
| 195 | + echo "After stripping, files referencing dev hash:" |
| 196 | + grep -rl "$DEV_HASH" "$lib" 2>/dev/null || echo " (none found)" |
| 197 | + echo "=== postFixup done ===" |
| 198 | + ''; |
182 | 199 | }); |
183 | 200 | }); |
184 | 201 | }; |
|
0 commit comments