Skip to content

Commit dfb68b2

Browse files
authored
Make the installed pkg-config files relocatable (astral-sh/uv#11028) (#507)
This ensures that e.g. `PKG_CONFIG_PATH=/wherever/python/lib/pkgconfig pkg-config --cflags` gets you existent paths in /wherever/python instead of nonexistent paths in /install.
1 parent cb32f8d commit dfb68b2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

cpython-unix/build-cpython.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,5 +1116,10 @@ else
11161116
cp -av Tools/scripts/run_tests.py ${ROOT}/out/python/build/
11171117
fi
11181118

1119+
# Don't hard-code the build-time prefix into the pkg-config files. See
1120+
# the description of `pcfiledir` in `man pkg-config`.
1121+
find ${ROOT}/out/python/install/lib/pkgconfig -name \*.pc -type f -exec \
1122+
sed ${sed_args} 's|^prefix=/install|prefix=${pcfiledir}/../..|' {} +
1123+
11191124
mkdir ${ROOT}/out/python/licenses
11201125
cp ${ROOT}/LICENSE.*.txt ${ROOT}/out/python/licenses/

docs/quirks.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ build-time configuration in a handful of files:
305305
``lib/python3.10/_sysconfigdata__linux_x86_64-linux-gnu.py``.
306306
* In a ``Makefile`` under a ``config-*`` directory in the standard library.
307307
e.g. ``lib/python3.10/config-3.10-x86_64-linux-gnu/Makefile``.
308-
* In ``pkgconfig`` files. e.g. ``lib/pkgconfig/python3.pc``.
309308
* In ``python*-config`` files. e.g. ``bin/python3.10-config``.
310309
* In ``PYTHON.json`` (mostly reflected values from ``_sysconfigdata_*.py``.
311310

0 commit comments

Comments
 (0)