1
0
mirror of https://github.com/facebook/proxygen.git synced 2025-08-08 18:02:05 +03:00

fbcode_builder: getdeps: add Boost builder

Summary:
the boost builder knows how to perform the non-standard
configure and build for boost.

Ideally we'd just build this statically and be happy but there are
some nuances I've observed while building on different platforms:

* One of our projects (thrift or wangle) explicitly requests static
  boost linkage for reasons unspecified
* on darwin the install_name is broken when building dynamic libs

For the sake of expediency in getting getdeps up and running, the
solution for the moment is to build static on posix systems and
build both static and shared on windows systems.

Reviewed By: simpkins

Differential Revision: D14691009

fbshipit-source-id: 634770a6f53c3ada42d1877cc6c3dacc6eed7d18
This commit is contained in:
Wez Furlong
2019-05-03 15:52:39 -07:00
committed by Facebook Github Bot
parent 2ec9f4ae81
commit 4169b0b32a
2 changed files with 54 additions and 0 deletions

View File

@@ -285,3 +285,53 @@ class OpenSSLBuilder(BuilderBase):
] ]
) )
self._run_cmd([make, "install_sw", "install_ssldirs"]) self._run_cmd([make, "install_sw", "install_ssldirs"])
class Boost(BuilderBase):
def __init__(self, build_opts, ctx, manifest, src_dir, build_dir, inst_dir):
children = os.listdir(src_dir)
assert len(children) == 1, "expected a single directory entry: %r" % (children,)
boost_src = children[0]
assert boost_src.startswith("boost")
src_dir = os.path.join(src_dir, children[0])
super(Boost, self).__init__(
build_opts, ctx, manifest, src_dir, build_dir, inst_dir
)
def _build(self, install_dirs, reconfigure):
linkage = ["static"]
if self.build_opts.is_windows():
linkage.append("shared")
for link in linkage:
args = []
if self.build_opts.is_windows():
bootstrap = os.path.join(self.src_dir, "bootstrap.bat")
self._run_cmd([bootstrap], cwd=self.src_dir)
args += ["address-model=64"]
else:
bootstrap = os.path.join(self.src_dir, "bootstrap.sh")
self._run_cmd(
[bootstrap, "--prefix=%s" % self.inst_dir], cwd=self.src_dir
)
b2 = os.path.join(self.src_dir, "b2")
self._run_cmd(
[
b2,
"-j%s" % self.build_opts.num_jobs,
"--prefix=%s" % self.inst_dir,
"--builddir=%s" % self.build_dir,
]
+ args
+ [
"link=%s" % link,
"runtime-link=shared",
"variant=release",
"threading=multi",
"debug-symbols=on",
"visibility=global",
"-d2",
"install",
],
cwd=self.src_dir,
)

View File

@@ -12,6 +12,7 @@ import io
from .builder import ( from .builder import (
AutoconfBuilder, AutoconfBuilder,
Boost,
CMakeBuilder, CMakeBuilder,
MakeBuilder, MakeBuilder,
NinjaBootstrap, NinjaBootstrap,
@@ -318,6 +319,9 @@ class ManifestParser(object):
build_options, ctx, self, src_dir, build_dir, inst_dir, args build_options, ctx, self, src_dir, build_dir, inst_dir, args
) )
if builder == "boost":
return Boost(build_options, ctx, self, src_dir, build_dir, inst_dir)
if builder == "cmake": if builder == "cmake":
defines = self.get_section_as_dict("cmake.defines", ctx) defines = self.get_section_as_dict("cmake.defines", ctx)
return CMakeBuilder( return CMakeBuilder(