github.com/mutagen-io/mutagen@v0.18.0-rc1/BUILDING.md (about)

     1  # Building
     2  
     3  Mutagen's build is slightly unique because it needs to cross-compile agent
     4  binaries for remote platforms (with cgo support in the case of macOS) and then
     5  generate a bundle of these binaries to ship alongside the Mutagen CLI. As such,
     6  using `go get` or `go install` to acquire Mutagen will result in an incomplete
     7  installation, and users should instead download the release builds from the
     8  [releases page](https://github.com/mutagen-io/mutagen/releases/latest) or
     9  [install Mutagen](https://mutagen.io/documentation/introduction/installation)
    10  via [Homebrew](https://brew.sh/).
    11  
    12  However, Mutagen can be built locally for testing and development. Mutagen
    13  relies on the Go toolchain's module support, so make sure that you have Go
    14  module support enabled.
    15  
    16  Individual Mutagen executables can be built normally using the Go toolchain, but
    17  a script is provided to ensure a normalized build, manage cross-compiled builds
    18  and agent bundle creation, and perform code signing on macOS. To see information
    19  about the build script, run:
    20  
    21      go run scripts/build.go --help
    22  
    23  The build script can do four different types of builds: `local` (with support
    24  for the local system only), `slim` (the default - with support for a selection
    25  of common platforms used in testing), `release` (used for generating complete
    26  release artifacts), and `release-slim` (used for generating complete release
    27  artifacts for a selection of common platforms used in testing). macOS is
    28  currently the only platform that supports doing `release` builds, because the
    29  macOS binaries require cgo support for filesystem monitoring.
    30  
    31  All artifacts from the build are placed in a `build` directory at the root of
    32  the Mutagen source tree. As a convenience, artifacts built for the current
    33  platform are placed in the root of the build directory for easy testing, e.g.:
    34  
    35      go run scripts/build.go
    36      build/mutagen --help
    37  
    38  
    39  ## Protocol Buffers code generation
    40  
    41  Mutagen uses Protocol Buffers extensively, and as such needs to generate Go code
    42  from `.proto` files. To avoid the need for developers (and CI systems) to have
    43  the Protocol Buffers compiler installed, generated code is checked into the
    44  repository. If a `.proto` file is modified, code can be regenerated by running
    45  
    46      go generate ./pkg/...
    47  
    48  in the root of the Mutagen source tree.
    49  
    50  The `go generate` commands used by Mutagen rely on Go module support being
    51  enabled. You will also need to have the `protoc` compiler (with support for
    52  Protocol Buffers 3) available in your path, but not the Go generator, which will
    53  be built as part of the `go generate` command.