mirror of
https://github.com/facebook/proxygen.git
synced 2025-08-07 07:02:53 +03:00
getdeps: allow setting per-project install prefix for DESTDIR installs
Summary: We have a global `--install-prefix` argument that can be used to set the prefix for all projects, but that is only suitable if you are running with sufficient privileges to install each of the deps to that location during the build. Cmake dependency resolution won't work from the build directory in that situation; it can only see the final installed location and it will error out if those files are not present, or link against the currently installed version instead of the version we just built; not great! This commit adds a project specific `--project-install-prefix` that can be used on just the leaf project in a set of deps. That sidesteps the dependency concern because only the last stage is built in that mode. This option can technically be applied to an arbitrary set of projects, but in light of the above, in practice it only makes sense to use it for the final cmake project. Only the CMakeBuilder respects this option. In the watchman repo, this commit adjusts the autogen.sh script to allow specifying the installation prefix; it defaults to `/usr/local` as you might expect. refs: https://github.com/facebook/watchman/issues/760 Reviewed By: yfeldblum Differential Revision: D20674439 fbshipit-source-id: 52799dbd47f3c295e2d6469ee2b74cedeaa20138
This commit is contained in:
committed by
Facebook GitHub Bot
parent
d5f671af06
commit
99dd5d7429
@@ -19,7 +19,15 @@ from .runcmd import run_cmd
|
||||
|
||||
class BuilderBase(object):
|
||||
def __init__(
|
||||
self, build_opts, ctx, manifest, src_dir, build_dir, inst_dir, env=None
|
||||
self,
|
||||
build_opts,
|
||||
ctx,
|
||||
manifest,
|
||||
src_dir,
|
||||
build_dir,
|
||||
inst_dir,
|
||||
env=None,
|
||||
final_install_prefix=None,
|
||||
):
|
||||
self.env = Env()
|
||||
if env:
|
||||
@@ -35,6 +43,7 @@ class BuilderBase(object):
|
||||
self.inst_dir = inst_dir
|
||||
self.build_opts = build_opts
|
||||
self.manifest = manifest
|
||||
self.final_install_prefix = final_install_prefix
|
||||
|
||||
def _get_cmd_prefix(self):
|
||||
if self.build_opts.is_windows():
|
||||
@@ -286,10 +295,24 @@ if __name__ == "__main__":
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, build_opts, ctx, manifest, src_dir, build_dir, inst_dir, defines
|
||||
self,
|
||||
build_opts,
|
||||
ctx,
|
||||
manifest,
|
||||
src_dir,
|
||||
build_dir,
|
||||
inst_dir,
|
||||
defines,
|
||||
final_install_prefix=None,
|
||||
):
|
||||
super(CMakeBuilder, self).__init__(
|
||||
build_opts, ctx, manifest, src_dir, build_dir, inst_dir
|
||||
build_opts,
|
||||
ctx,
|
||||
manifest,
|
||||
src_dir,
|
||||
build_dir,
|
||||
inst_dir,
|
||||
final_install_prefix=final_install_prefix,
|
||||
)
|
||||
self.defines = defines or {}
|
||||
|
||||
@@ -337,7 +360,7 @@ if __name__ == "__main__":
|
||||
|
||||
def _compute_cmake_define_args(self, env):
|
||||
defines = {
|
||||
"CMAKE_INSTALL_PREFIX": self.inst_dir,
|
||||
"CMAKE_INSTALL_PREFIX": self.final_install_prefix or self.inst_dir,
|
||||
"BUILD_SHARED_LIBS": "OFF",
|
||||
# Some of the deps (rsocket) default to UBSAN enabled if left
|
||||
# unspecified. Some of the deps fail to compile in release mode
|
||||
@@ -393,6 +416,8 @@ if __name__ == "__main__":
|
||||
reconfigure = reconfigure or self._needs_reconfigure()
|
||||
|
||||
env = self._compute_env(install_dirs)
|
||||
if not self.build_opts.is_windows() and self.final_install_prefix:
|
||||
env["DESTDIR"] = self.inst_dir
|
||||
|
||||
# Resolve the cmake that we installed
|
||||
cmake = path_search(env, "cmake")
|
||||
|
Reference in New Issue
Block a user