Skip to content

Create "make install" equivalent #308

@nacl

Description

@nacl

Open source projects are typically built in three phases:

  1. Configuration (./configure), where the project build is customized to target specific featuresets
  2. Building (make), where the project is actually built
  3. Installation (make install), where the project is installed to the filesystem, or staged for future packaging using the DESTDIR convention.

Bazel combines 1) and 2) (configuring is done with build flags), and 3) doesn't really exist. Currently, the closest bazel equivalent to have bazel create a package representing the installable outputs, most often a .zip or a .tar. While effective, it is wasteful when packages become quite large.

Since Bazel builds have no way to interact directly with the filesystem outside of the buildroot, we need to be a little more creative. Let's create a pkg_install rule that creates a (python?) script that knows how to install artifacts outside of the bazel buildroot, for example:

load("@rules_pkg//:install.bzl", "pkg_install")

# pkg_files, pkg_filegroups, etc

pkg_install(
    name = "install",
    srcs = [
        # pkg_filegroups here
   ],
)

And then you install using:

bazel run //:install -- DESTDIR=your/destination/directory

Acceptance criteria:

  • pkg_install (or its equivalent) is created with tests
  • pkg_install supports staging to an arbitrary destination (DESTDIR)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2An issue that should be worked on when time is available

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions