From 433c3f529476e9c94c4e8560ad94cdfe83cc1642 Mon Sep 17 00:00:00 2001 From: Alex Hornby Date: Thu, 5 Dec 2024 14:41:06 -0800 Subject: [PATCH] jom (parallel nmake) build for openssl windows Summary: X-link: https://github.com/facebookincubator/zstrong/pull/1084 openssl build on windows is slow due to nmake being single threaded fortunately the Qt developers had the same problem and produced jom - a nmake compatible make that adds the /j flag add a jom manifest and use it for the openssl build on windows Reviewed By: bigfootjon Differential Revision: D66818562 fbshipit-source-id: 88938dbc862da18ae7f75df51aa99bb669aae71a --- build/fbcode_builder/getdeps/builder.py | 14 +++++++++++--- build/fbcode_builder/manifests/jom | 15 +++++++++++++++ build/fbcode_builder/manifests/openssl | 1 + 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 build/fbcode_builder/manifests/jom diff --git a/build/fbcode_builder/getdeps/builder.py b/build/fbcode_builder/getdeps/builder.py index 10bd2a62a62..6bd5f526e7f 100644 --- a/build/fbcode_builder/getdeps/builder.py +++ b/build/fbcode_builder/getdeps/builder.py @@ -1165,9 +1165,14 @@ def _build(self, reconfigure) -> None: perl = typing.cast(str, path_search(env, "perl", "perl")) make_j_args = [] + extra_args = [] if self.build_opts.is_windows(): - make = "nmake.exe" + # jom is compatible with nmake, adds the /j argument for parallel build + make = "jom.exe" + make_j_args = ["/j%s" % self.num_jobs] args = ["VC-WIN64A-masm", "-utf-8"] + # fixes "if multiple CL.EXE write to the same .PDB file, please use /FS" + extra_args = ["/FS"] elif self.build_opts.is_darwin(): make = "make" make_j_args = ["-j%s" % self.num_jobs] @@ -1200,11 +1205,14 @@ def _build(self, reconfigure) -> None: "no-unit-test", "no-tests", ] + + extra_args ) + # show the config produced + self._run_cmd([perl, "configdata.pm", "--dump"], env=env) make_build = [make] + make_j_args - self._run_cmd(make_build) + self._run_cmd(make_build, env=env) make_install = [make, "install_sw", "install_ssldirs"] - self._run_cmd(make_install) + self._run_cmd(make_install, env=env) class Boost(BuilderBase): diff --git a/build/fbcode_builder/manifests/jom b/build/fbcode_builder/manifests/jom new file mode 100644 index 00000000000..effecab67a1 --- /dev/null +++ b/build/fbcode_builder/manifests/jom @@ -0,0 +1,15 @@ +# jom is compatible with MSVC nmake, but adds the /j argment which +# speeds up openssl build a lot +[manifest] +name = jom + +# see https://download.qt.io/official_releases/jom/changelog.txt for latest version +[download.os=windows] +url = https://download.qt.io/official_releases/jom/jom_1_1_4.zip +sha256 = d533c1ef49214229681e90196ed2094691e8c4a0a0bef0b2c901debcb562682b + +[build.os=windows] +builder = nop + +[install.files.os=windows] +. = bin diff --git a/build/fbcode_builder/manifests/openssl b/build/fbcode_builder/manifests/openssl index 7dd40727cc2..ebd680e7e1e 100644 --- a/build/fbcode_builder/manifests/openssl +++ b/build/fbcode_builder/manifests/openssl @@ -31,4 +31,5 @@ builder = openssl subdir = openssl-3.0.15 [dependencies.os=windows] +jom perl