Skip to content

Commit

Permalink
Respect the PKG_CONFIG environment variable when building
Browse files Browse the repository at this point in the history
This variable is commonly used by other build systems and using it can
help with cross-compiling. Falls back to "pkg-config" as before.
  • Loading branch information
chewi committed Jun 30, 2019
1 parent 290cd17 commit 15cd8ed
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions setup.py
Expand Up @@ -242,8 +242,9 @@ def get_version():

def _pkg_config(name):
try:
command_libs = ["pkg-config", "--libs-only-L", name]
command_cflags = ["pkg-config", "--cflags-only-I", name]
command = os.environ.get("PKG_CONFIG", "pkg-config")
command_libs = [command, "--libs-only-L", name]
command_cflags = [command, "--cflags-only-I", name]
if not DEBUG:
command_libs.append("--silence-errors")
command_cflags.append("--silence-errors")
Expand Down Expand Up @@ -347,7 +348,7 @@ def build_extensions(self):
_add_directory(include_dirs, "src/libImaging")

pkg_config = None
if _cmd_exists("pkg-config"):
if _cmd_exists(os.environ.get("PKG_CONFIG", "pkg-config")):
pkg_config = _pkg_config

#
Expand Down

0 comments on commit 15cd8ed

Please sign in to comment.