version = "0.20.0" revision = 1 description = "Service manager / init system (dinit)" license = "Apache-2.0" url = "https://davmac.org/projects/dinit/" source = tarball( url=f"https://github.com/davmac314/dinit/archive/refs/tags/v{version}.tar.gz", sha256="cd75b572a2eab4a9bd0610a2bb8cc154da7e80074e61cb1059a996dfd977baae", ) host_deps = ["binutils", "gcc", "pkgconf"] deps = [profile["libc"], "libstdc++"] def configure(self): # dinit's hand-written configure expects an in-tree build and reads the # toolchain from the environment; CXX_FOR_BUILD compiles its small build-time # helper with the native compiler. self.run("cp", "-rp", f"{self.source_dir}/.", self.build_dir) self.run( "./configure", "--prefix=/usr", "--sbindir=/usr/bin", "--enable-utmpx", "--enable-shutdown", "--disable-strip", env={ "CXX": f"{self.triple}-g++", "CXX_FOR_BUILD": "g++", # dinit 0.20.0 uses std::allocator::construct(), removed from the # default C++ mode in GCC 16's libstdc++; build it as C++17 where it # still exists. "CXXFLAGS": self.options["cxxflags"] + " -std=gnu++17", "LDFLAGS": self.options["ldflags"], }, ) def build(self): self.run("make", f"-j{self.jobs}") def install(self): self.run("make", "install", f"DESTDIR={self.dest_dir}") # Ship the dinit service set (boot target + udev/seatd/agetty services). self.run("install", "-d", self.dest_dir / "etc/dinit.d") self.run( "sh", "-c", f"cp -rp {self.files}/dinit.d/. {self.dest_dir}/etc/dinit.d/ && " f"chmod +x {self.dest_dir}/etc/dinit.d/scripts/*.sh", )