Commit fbbd7864 authored by Udip Pant's avatar Udip Pant Committed by Facebook Github Bot

add PKG_CONFIG_PATH in the env variable for build cmds

Summary: This enables appending PKG_CONFIG_PATH to env variable

Reviewed By: wez

Differential Revision: D17363236

fbshipit-source-id: 18c6d7a97ba83edf085278bccaafa80821ea8860
parent 0a3b4eb2
...@@ -103,11 +103,19 @@ class MakeBuilder(BuilderBase): ...@@ -103,11 +103,19 @@ class MakeBuilder(BuilderBase):
self.args = args or [] self.args = args or []
def _build(self, install_dirs, reconfigure): def _build(self, install_dirs, reconfigure):
cmd = ["make", "-j%s" % self.build_opts.num_jobs] + self.args env = self._compute_env(install_dirs)
self._run_cmd(cmd)
# Need to ensure that PREFIX is set prior to install because
# libbpf uses it when generating its pkg-config file
cmd = (
["make", "-j%s" % self.build_opts.num_jobs]
+ self.args
+ ["PREFIX=" + self.inst_dir]
)
self._run_cmd(cmd, env=env)
install_cmd = ["make", "install", "PREFIX=" + self.inst_dir] install_cmd = ["make", "install", "PREFIX=" + self.inst_dir]
self._run_cmd(install_cmd) self._run_cmd(install_cmd, env=env)
class AutoconfBuilder(BuilderBase): class AutoconfBuilder(BuilderBase):
...@@ -121,11 +129,7 @@ class AutoconfBuilder(BuilderBase): ...@@ -121,11 +129,7 @@ class AutoconfBuilder(BuilderBase):
configure_path = os.path.join(self.src_dir, "configure") configure_path = os.path.join(self.src_dir, "configure")
autogen_path = os.path.join(self.src_dir, "autogen.sh") autogen_path = os.path.join(self.src_dir, "autogen.sh")
env = self.env.copy() env = self._compute_env(install_dirs)
for d in install_dirs:
add_path_entry(env, "PKG_CONFIG_PATH", "%s/lib/pkgconfig" % d)
bindir = os.path.join(d, "bin")
add_path_entry(env, "PATH", bindir, append=False)
if not os.path.exists(configure_path): if not os.path.exists(configure_path):
print("%s doesn't exist, so reconfiguring" % configure_path) print("%s doesn't exist, so reconfiguring" % configure_path)
......
...@@ -172,6 +172,10 @@ class BuildOptions(object): ...@@ -172,6 +172,10 @@ class BuildOptions(object):
if os.path.exists(pkgconfig): if os.path.exists(pkgconfig):
add_path_entry(env, "PKG_CONFIG_PATH", pkgconfig) add_path_entry(env, "PKG_CONFIG_PATH", pkgconfig)
pkgconfig = os.path.join(d, "lib64/pkgconfig")
if os.path.exists(pkgconfig):
add_path_entry(env, "PKG_CONFIG_PATH", pkgconfig)
# Allow resolving shared objects built earlier (eg: zstd # Allow resolving shared objects built earlier (eg: zstd
# doesn't include the full path to the dylib in its linkage # doesn't include the full path to the dylib in its linkage
# so we need to give it an assist) # so we need to give it an assist)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment