Files
Build-System/include/Void/Build/Install/Installer.hpp
T
faumaray 9509c0691e
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 5s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 14s
feat(install): generate ZIP and Debian packages
2026-12-05 05:09:53 +03:00

56 lines
2.3 KiB
C++

#pragma once
#include <Void/Build.hpp>
#include <Void/Build/Graph/Graph.hpp>
#include <Void/Functional/Error.hpp>
#include <Void/Functional/Result.hpp>
#include <filesystem>
#include <optional>
#include <string>
#include <vector>
namespace Void::Build::Install {
struct InstallOptions {
std::string package_name;
std::string package_version{"0.1.0"};
std::filesystem::path prefix;
std::optional<std::string> component; // Empty = install all components
bool export_cmake_config{true};
bool export_native_metadata{true};
// Copies runtime shared libraries of installed targets into <prefix>/lib.
bool bundle_runtime_dependencies{false};
// Optional deterministic archive of the installed prefix (self-contained installer).
std::optional<std::filesystem::path> archive_path;
// Archive format: "tar" (default), "sh" (self-extracting script with tar payload),
// "zip" (stored, no compression) or "deb" (ar container with control.tar + data.tar).
std::string archive_format{"tar"};
std::string package_description; // Used by package metadata (deb).
std::string maintainer; // Used by package metadata (deb).
};
struct InstallReport {
std::filesystem::path prefix;
std::filesystem::path manifest_path;
std::vector<std::filesystem::path> installed_files;
std::optional<std::filesystem::path> cmake_config_file;
std::optional<std::filesystem::path> native_package_file;
std::optional<std::filesystem::path> archive_path;
std::vector<std::filesystem::path> bundled_libraries;
};
// Installs declared targets, files, headers, and relocatable native + CMake export
// metadata into `options.prefix` via managed staging and an ownership manifest (Plan 15).
// Rejects path traversal, destination collisions, and build-tree path leaks.
[[nodiscard]] Void::Result::Result<InstallReport, Void::Result::Error>
install_project(const Graph::ProjectDescription &description, const Graph::BuildGraph &graph,
const InstallOptions &options);
// Safely removes ONLY files owned by VBS in `<prefix>/.vbs-install-manifest.json`,
// preserving all unrelated user files in the prefix!
[[nodiscard]] Void::Result::Result<std::size_t, Void::Result::Error>
uninstall_prefix(const std::filesystem::path &prefix);
} // namespace Void::Build::Install