Skip to content

Commit eb62238

Browse files
committed
Revert "Fix postgresql-musl: merge dev into out to eliminate dev↔lib cycle"
This reverts commit bbb7fa7.
1 parent bbb7fa7 commit eb62238

1 file changed

Lines changed: 23 additions & 6 deletions

File tree

flake.nix

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,32 @@
170170
NIX_CFLAGS_COMPILE = (old.env.NIX_CFLAGS_COMPILE or "") + " -fno-lto";
171171
};
172172
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" ]);
179173
outputChecks = {};
180174
separateDebugInfo = false;
181175
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+
'';
182199
});
183200
});
184201
};

0 commit comments

Comments
 (0)