Skip to content

Commit

Permalink
Set EM_PKG_CONFIG_PATH to correctly configure pkg-config
Browse files Browse the repository at this point in the history
  • Loading branch information
swnf committed Nov 7, 2024
1 parent 4805d73 commit 0489b50
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pyodide_build/buildpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,11 @@ def _get_helper_vars(self) -> dict[str, str]:
"DISTDIR": str(self.src_dist_dir),
# TODO: rename this to something more compatible with Makefile or CMake conventions
"WASM_LIBRARY_DIR": str(self.library_install_prefix),
# Using PKG_CONFIG_LIBDIR instead of PKG_CONFIG_PATH,
# Emscripten will use this variable to configure pkg-config in emconfigure
"EM_PKG_CONFIG_PATH": str(self.library_install_prefix / "lib/pkgconfig"),
# This variable is usually overwritten by emconfigure
# The value below will only be used if pkg-config is called without emconfigure
# We use PKG_CONFIG_LIBDIR instead of PKG_CONFIG_PATH,
# so pkg-config will not look in the default system directories
"PKG_CONFIG_LIBDIR": str(self.library_install_prefix / "lib/pkgconfig"),
}
Expand Down
3 changes: 3 additions & 0 deletions pyodide_build/tests/test_buildpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ def test_get_helper_vars(tmp_path):
tmp_path / "pkg_1" / "build" / "pkg_1-1.0.0" / "dist"
)
assert helper_vars["WASM_LIBRARY_DIR"] == str(tmp_path / ".libs")
assert helper_vars["EM_PKG_CONFIG_PATH"] == str(
tmp_path / ".libs" / "lib" / "pkgconfig"
)
assert helper_vars["PKG_CONFIG_LIBDIR"] == str(
tmp_path / ".libs" / "lib" / "pkgconfig"
)
Expand Down

0 comments on commit 0489b50

Please sign in to comment.