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

fbcode_builder: getdeps: add OpenSSL builder

Summary:
the openssl builder knows how to perform the non-standard
configuration and build steps to build openssl.

On Linux systems the manifests for our projects don't mention
openssl, causing them to pick up the system openssl.

On Mac, apple don't ship openssl headers so we need to build our own.
On Windows there is no standard openssl installation so we also need
to build our own.

As a result, this builder only works on windows and mac.

Reviewed By: simpkins

Differential Revision: D14691010

fbshipit-source-id: 9f8979f9eaeb5209c290cf4f43c97c0cb43d13a2
This commit is contained in:
Wez Furlong
2019-05-03 15:52:39 -07:00
committed by Facebook Github Bot
parent 933cec195f
commit 2ec9f4ae81
2 changed files with 59 additions and 1 deletions

View File

@@ -238,3 +238,50 @@ class NinjaBootstrap(BuilderBase):
os.makedirs(bin_dir)
shutil.copyfile(src_ninja, dest_ninja)
shutil.copymode(src_ninja, dest_ninja)
class OpenSSLBuilder(BuilderBase):
def __init__(self, build_opts, ctx, manifest, build_dir, src_dir, inst_dir):
super(OpenSSLBuilder, self).__init__(
build_opts, ctx, manifest, src_dir, build_dir, inst_dir
)
def _build(self, install_dirs, reconfigure):
configure = os.path.join(self.src_dir, "Configure")
# prefer to resolve the perl that we installed from
# our manifest on windows, but fall back to the system
# path on eg: darwin
env = self.env.copy()
for d in install_dirs:
bindir = os.path.join(d, "bin")
add_path_entry(env, "PATH", bindir, append=False)
perl = path_search(env, "perl", "perl")
if self.build_opts.is_windows():
make = "nmake.exe"
args = ["VC-WIN64A-masm", "-utf-8"]
elif self.build_opts.is_darwin():
make = "make"
args = ["darwin64-x86_64-cc"]
else:
raise Exception("don't know how to build openssl for %r" % self.ctx)
self._run_cmd(
[
perl,
configure,
"--prefix=%s" % self.inst_dir,
"--openssldir=%s" % self.inst_dir,
]
+ args
+ [
"enable-static-engine",
"enable-capieng",
"no-makedepend",
"no-unit-test",
"no-tests",
]
)
self._run_cmd([make, "install_sw", "install_ssldirs"])

View File

@@ -10,7 +10,13 @@ from __future__ import absolute_import, division, print_function, unicode_litera
import io
from .builder import AutoconfBuilder, CMakeBuilder, MakeBuilder, NinjaBootstrap
from .builder import (
AutoconfBuilder,
CMakeBuilder,
MakeBuilder,
NinjaBootstrap,
OpenSSLBuilder,
)
from .expr import parse_expr
from .fetcher import (
ArchiveFetcher,
@@ -323,4 +329,9 @@ class ManifestParser(object):
build_options, ctx, self, build_dir, src_dir, inst_dir
)
if builder == "openssl":
return OpenSSLBuilder(
build_options, ctx, self, build_dir, src_dir, inst_dir
)
raise KeyError("project %s has no known builder" % (self.name))