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

Allow systemd libs to be built from source

Summary:
X-link: https://github.com/facebookincubator/zstrong/pull/1066

Changes to enable building systemd libs from source (rather than relying on
system packages i.e. systemd, systemd-devel).

From the FBOSS perspective, this is desirable because statically linking the dependencies into the binaries makes them easier to package without relying on similar state between build and runtime environments.

Reviewed By: somasun

Differential Revision:
D65827936

Privacy Context Container: L1125642

fbshipit-source-id: c0ba2f0690466a969bb4d9a4db664b9a5b3d3d79
This commit is contained in:
Paul Cruz
2024-11-18 10:53:53 -08:00
committed by Facebook GitHub Bot
parent 38bd8eff91
commit 91f6c336c8
3 changed files with 77 additions and 0 deletions

View File

@@ -487,6 +487,61 @@ class Iproute2Builder(BuilderBase):
self._run_cmd(install_cmd, env=env)
class SystemdBuilder(BuilderBase):
# SystemdBuilder assumes that meson build tool has already been installed on
# the machine.
def __init__(
self,
loader,
dep_manifests,
build_opts,
ctx,
manifest,
src_dir,
build_dir,
inst_dir,
) -> None:
super(SystemdBuilder, self).__init__(
loader,
dep_manifests,
build_opts,
ctx,
manifest,
src_dir,
build_dir,
inst_dir,
)
def _build(self, reconfigure) -> None:
env = self._compute_env()
meson = path_search(env, "meson")
if meson is None:
raise Exception("Failed to find Meson")
# Meson builds typically require setup, compile, and install steps.
# During this setup step we ensure that the static library is built and
# the prefix is empty.
self._run_cmd(
[
meson,
"setup",
"-Dstatic-libsystemd=true",
"-Dprefix=/",
self.build_dir,
self.src_dir,
]
)
# Compile step needs to satisfy the build directory that was previously
# prepared during setup.
self._run_cmd([meson, "compile", "-C", self.build_dir])
# Install step
self._run_cmd(
[meson, "install", "-C", self.build_dir, "--destdir", self.inst_dir]
)
class CMakeBuilder(BuilderBase):
MANUAL_BUILD_SCRIPT = """\
#!{sys.executable}