mirror of
https://github.com/facebook/proxygen.git
synced 2025-08-07 07:02:53 +03:00
Only add direct deps to GETDEPS_CABAL_FLAGS
Summary: X-link: https://github.com/facebookincubator/zstrong/pull/899 You shouldn't be able to depend on a library unless it is in your direct dependencies, also this shortens the massive GETDEPS_CABAL_FLAGS to something more sensible. Reviewed By: chadaustin Differential Revision: D58244928 fbshipit-source-id: 3e93f26ef197252cd723a65c1752dad53b5327b6
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9bc0fc331e
commit
66f3fad54b
@@ -179,7 +179,9 @@ class BuilderBase(object):
|
|||||||
# needs to be updated to include all of the directories containing the runtime
|
# needs to be updated to include all of the directories containing the runtime
|
||||||
# library dependencies in order to run the binaries.
|
# library dependencies in order to run the binaries.
|
||||||
script_path = self.get_dev_run_script_path()
|
script_path = self.get_dev_run_script_path()
|
||||||
dep_munger = create_dyn_dep_munger(self.build_opts, self.install_dirs)
|
dep_munger = create_dyn_dep_munger(
|
||||||
|
self.build_opts, self._compute_env(), self.install_dirs
|
||||||
|
)
|
||||||
dep_dirs = self.get_dev_run_extra_path_dirs(dep_munger)
|
dep_dirs = self.get_dev_run_extra_path_dirs(dep_munger)
|
||||||
# pyre-fixme[16]: Optional type has no attribute `emit_dev_run_script`.
|
# pyre-fixme[16]: Optional type has no attribute `emit_dev_run_script`.
|
||||||
dep_munger.emit_dev_run_script(script_path, dep_dirs)
|
dep_munger.emit_dev_run_script(script_path, dep_dirs)
|
||||||
@@ -227,7 +229,11 @@ class BuilderBase(object):
|
|||||||
# CMAKE_PREFIX_PATH is only respected when passed through the
|
# CMAKE_PREFIX_PATH is only respected when passed through the
|
||||||
# environment, so we construct an appropriate path to pass down
|
# environment, so we construct an appropriate path to pass down
|
||||||
return self.build_opts.compute_env_for_install_dirs(
|
return self.build_opts.compute_env_for_install_dirs(
|
||||||
self.install_dirs, env=self.env, manifest=self.manifest
|
self.loader,
|
||||||
|
self.dep_manifests,
|
||||||
|
self.ctx,
|
||||||
|
env=self.env,
|
||||||
|
manifest=self.manifest,
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_dev_run_script_path(self):
|
def get_dev_run_script_path(self):
|
||||||
@@ -237,7 +243,9 @@ class BuilderBase(object):
|
|||||||
def get_dev_run_extra_path_dirs(self, dep_munger=None):
|
def get_dev_run_extra_path_dirs(self, dep_munger=None):
|
||||||
assert self.build_opts.is_windows()
|
assert self.build_opts.is_windows()
|
||||||
if dep_munger is None:
|
if dep_munger is None:
|
||||||
dep_munger = create_dyn_dep_munger(self.build_opts, self.install_dirs)
|
dep_munger = create_dyn_dep_munger(
|
||||||
|
self.build_opts, self._compute_env(), self.install_dirs
|
||||||
|
)
|
||||||
return dep_munger.compute_dependency_paths(self.build_dir)
|
return dep_munger.compute_dependency_paths(self.build_dir)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -221,7 +221,7 @@ class BuildOptions(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def compute_env_for_install_dirs(
|
def compute_env_for_install_dirs(
|
||||||
self, install_dirs, env=None, manifest=None
|
self, loader, dep_manifests, ctx, env=None, manifest=None
|
||||||
): # noqa: C901
|
): # noqa: C901
|
||||||
if env is not None:
|
if env is not None:
|
||||||
env = env.copy()
|
env = env.copy()
|
||||||
@@ -300,8 +300,16 @@ class BuildOptions(object):
|
|||||||
env["FBSOURCE_DATE"] = hash_data.date
|
env["FBSOURCE_DATE"] = hash_data.date
|
||||||
|
|
||||||
# reverse as we are prepending to the PATHs
|
# reverse as we are prepending to the PATHs
|
||||||
for d in reversed(install_dirs):
|
for m in reversed(dep_manifests):
|
||||||
self.add_prefix_to_env(d, env, append=False)
|
is_direct_dep = (
|
||||||
|
manifest is not None and m.name in manifest.get_dependencies(ctx)
|
||||||
|
)
|
||||||
|
self.add_prefix_to_env(
|
||||||
|
loader.get_project_install_dir(m),
|
||||||
|
env,
|
||||||
|
append=False,
|
||||||
|
is_direct_dep=is_direct_dep,
|
||||||
|
)
|
||||||
|
|
||||||
# Linux is always system openssl
|
# Linux is always system openssl
|
||||||
system_openssl = self.is_linux()
|
system_openssl = self.is_linux()
|
||||||
@@ -336,7 +344,12 @@ class BuildOptions(object):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def add_prefix_to_env(
|
def add_prefix_to_env(
|
||||||
self, d, env, append: bool = True, add_library_path: bool = False
|
self,
|
||||||
|
d,
|
||||||
|
env,
|
||||||
|
append: bool = True,
|
||||||
|
add_library_path: bool = False,
|
||||||
|
is_direct_dep: bool = False,
|
||||||
) -> bool: # noqa: C901
|
) -> bool: # noqa: C901
|
||||||
bindir = os.path.join(d, "bin")
|
bindir = os.path.join(d, "bin")
|
||||||
found = False
|
found = False
|
||||||
@@ -374,7 +387,7 @@ class BuildOptions(object):
|
|||||||
add_flag(env, "CPPFLAGS", f"-I{includedir}", append=append)
|
add_flag(env, "CPPFLAGS", f"-I{includedir}", append=append)
|
||||||
# For non-pkgconfig projects Cabal has no way to find the includes or
|
# For non-pkgconfig projects Cabal has no way to find the includes or
|
||||||
# libraries, so we provide a set of extra Cabal flags in the env
|
# libraries, so we provide a set of extra Cabal flags in the env
|
||||||
if not has_pkgconfig:
|
if not has_pkgconfig and is_direct_dep:
|
||||||
add_flag(
|
add_flag(
|
||||||
env,
|
env,
|
||||||
"GETDEPS_CABAL_FLAGS",
|
"GETDEPS_CABAL_FLAGS",
|
||||||
@@ -419,7 +432,7 @@ class BuildOptions(object):
|
|||||||
add_flag(env, "LDFLAGS", f"-L{libdir}", append=append)
|
add_flag(env, "LDFLAGS", f"-L{libdir}", append=append)
|
||||||
if add_library_path:
|
if add_library_path:
|
||||||
add_path_entry(env, "LIBRARY_PATH", libdir, append=append)
|
add_path_entry(env, "LIBRARY_PATH", libdir, append=append)
|
||||||
if not has_pkgconfig:
|
if not has_pkgconfig and is_direct_dep:
|
||||||
add_flag(
|
add_flag(
|
||||||
env,
|
env,
|
||||||
"GETDEPS_CABAL_FLAGS",
|
"GETDEPS_CABAL_FLAGS",
|
||||||
|
@@ -26,9 +26,9 @@ def copyfile(src, dest) -> None:
|
|||||||
|
|
||||||
|
|
||||||
class DepBase(object):
|
class DepBase(object):
|
||||||
def __init__(self, buildopts, install_dirs, strip) -> None:
|
def __init__(self, buildopts, env, install_dirs, strip) -> None:
|
||||||
self.buildopts = buildopts
|
self.buildopts = buildopts
|
||||||
self.env = buildopts.compute_env_for_install_dirs(install_dirs)
|
self.env = env
|
||||||
self.install_dirs = install_dirs
|
self.install_dirs = install_dirs
|
||||||
self.strip = strip
|
self.strip = strip
|
||||||
|
|
||||||
@@ -168,8 +168,8 @@ class DepBase(object):
|
|||||||
|
|
||||||
|
|
||||||
class WinDeps(DepBase):
|
class WinDeps(DepBase):
|
||||||
def __init__(self, buildopts, install_dirs, strip) -> None:
|
def __init__(self, buildopts, env, install_dirs, strip) -> None:
|
||||||
super(WinDeps, self).__init__(buildopts, install_dirs, strip)
|
super(WinDeps, self).__init__(buildopts, env, install_dirs, strip)
|
||||||
self.dumpbin = self.find_dumpbin()
|
self.dumpbin = self.find_dumpbin()
|
||||||
|
|
||||||
def find_dumpbin(self) -> str:
|
def find_dumpbin(self) -> str:
|
||||||
@@ -334,8 +334,8 @@ try {{
|
|||||||
|
|
||||||
|
|
||||||
class ElfDeps(DepBase):
|
class ElfDeps(DepBase):
|
||||||
def __init__(self, buildopts, install_dirs, strip) -> None:
|
def __init__(self, buildopts, env, install_dirs, strip) -> None:
|
||||||
super(ElfDeps, self).__init__(buildopts, install_dirs, strip)
|
super(ElfDeps, self).__init__(buildopts, env, install_dirs, strip)
|
||||||
|
|
||||||
# We need patchelf to rewrite deps, so ensure that it is built...
|
# We need patchelf to rewrite deps, so ensure that it is built...
|
||||||
args = [sys.executable, sys.argv[0]]
|
args = [sys.executable, sys.argv[0]]
|
||||||
@@ -448,14 +448,14 @@ class MachDeps(DepBase):
|
|||||||
|
|
||||||
|
|
||||||
def create_dyn_dep_munger(
|
def create_dyn_dep_munger(
|
||||||
buildopts, install_dirs, strip: bool = False
|
buildopts, env, install_dirs, strip: bool = False
|
||||||
) -> Optional[DepBase]:
|
) -> Optional[DepBase]:
|
||||||
if buildopts.is_linux():
|
if buildopts.is_linux():
|
||||||
return ElfDeps(buildopts, install_dirs, strip)
|
return ElfDeps(buildopts, env, install_dirs, strip)
|
||||||
if buildopts.is_darwin():
|
if buildopts.is_darwin():
|
||||||
return MachDeps(buildopts, install_dirs, strip)
|
return MachDeps(buildopts, env, install_dirs, strip)
|
||||||
if buildopts.is_windows():
|
if buildopts.is_windows():
|
||||||
return WinDeps(buildopts, install_dirs, strip)
|
return WinDeps(buildopts, env, install_dirs, strip)
|
||||||
if buildopts.is_freebsd():
|
if buildopts.is_freebsd():
|
||||||
return ElfDeps(buildopts, install_dirs, strip)
|
return ElfDeps(buildopts, env, install_dirs, strip)
|
||||||
return None
|
return None
|
||||||
|
@@ -16,6 +16,9 @@ gflags
|
|||||||
glog
|
glog
|
||||||
folly
|
folly
|
||||||
fbthrift
|
fbthrift
|
||||||
|
wangle
|
||||||
|
fizz
|
||||||
|
boost
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
builder = make
|
builder = make
|
||||||
|
Reference in New Issue
Block a user