|
| 1 | +# Reproducible Builds |
| 2 | + |
| 3 | +## Building with Docker |
| 4 | + |
| 5 | +To create a Loop release with binaries that are identical to an official |
| 6 | +release, run the following command (available since release `v0.31.3-beta`): |
| 7 | + |
| 8 | +```bash |
| 9 | +make docker-release tag=<tag-of-release> |
| 10 | +``` |
| 11 | + |
| 12 | +This command will create a directory named `loop-<tag-of-release>` containing |
| 13 | +the source archive, vendored dependencies, and the built binaries packaged in |
| 14 | +`.tar.gz` or `.zip` format. It also creates a manifest file with `SHA-256` |
| 15 | +checksums for all release files. |
| 16 | + |
| 17 | +For example: |
| 18 | + |
| 19 | +```bash |
| 20 | +make docker-release tag=v0.31.3-beta |
| 21 | +``` |
| 22 | + |
| 23 | +This will create the release artifacts in the `loop-v0.31.3-beta` directory. |
| 24 | + |
| 25 | +If you want to build from an untagged commit, first check it out, then use the |
| 26 | +output of `git describe --abbrev=10` as the tag: |
| 27 | + |
| 28 | +```bash |
| 29 | +git describe --abbrev=10 |
| 30 | +# v0.31.2-beta-135-g35d0fa26ac |
| 31 | + |
| 32 | +make docker-release tag=v0.31.2-beta-135-g35d0fa26ac |
| 33 | +``` |
| 34 | + |
| 35 | +You can filter the target platforms to speed up the build process. For example, |
| 36 | +to build only for `linux-amd64`: |
| 37 | + |
| 38 | +```bash |
| 39 | +make docker-release buildsys=linux-amd64 tag=v0.31.3-beta |
| 40 | +``` |
| 41 | + |
| 42 | +Or for multiple platforms: |
| 43 | + |
| 44 | +```bash |
| 45 | +make docker-release buildsys='linux-amd64 windows-amd64' tag=v0.31.3-beta |
| 46 | +``` |
| 47 | + |
| 48 | +Note: inside Docker the current directory is mapped as `/repo` and it might |
| 49 | +mention `/repo` as parts of file paths. |
| 50 | + |
| 51 | +## Building on the Host |
| 52 | + |
| 53 | +You can also build a release on your host system without Docker. You will need |
| 54 | +to install the Go version specified in the `go.mod` file, as well as a few |
| 55 | +other tools: |
| 56 | + |
| 57 | +```bash |
| 58 | +sudo apt-get install build-essential git make zip perl gpg |
| 59 | +``` |
| 60 | + |
| 61 | +You can [download](https://go.dev/dl/) and unpack Go somewhere and set variable |
| 62 | +`GO_CMD=/path/to/go` (path to Go binary of the needed version). |
| 63 | + |
| 64 | +If you already have another Go version, you can install the Go version needed |
| 65 | +for a release using the following commands: |
| 66 | + |
| 67 | +```bash |
| 68 | +$ go version |
| 69 | +go version go1.25.0 linux/amd64 |
| 70 | +$ go install golang.org/dl/go1.24.6@latest |
| 71 | +$ go1.24.6 download |
| 72 | +Unpacking /home/user/sdk/go1.24.6/go1.24.6.linux-amd64.tar.gz ... |
| 73 | +Success. You may now run 'go1.24.6' |
| 74 | +$ go1.24.6 version |
| 75 | +go version go1.24.6 linux/amd64 |
| 76 | + |
| 77 | +$ GO_CMD=/home/user/go/bin/go1.24.6 ./release.sh v0.31.3 |
| 78 | +``` |
| 79 | + |
| 80 | +On MacOS, you will need to install GNU tar and GNU gzip, which can be done with |
| 81 | +`brew`: |
| 82 | + |
| 83 | +```bash |
| 84 | +brew install gnu-tar gzip |
| 85 | +``` |
| 86 | + |
| 87 | +Add GPG key of Alex Bosworth to verify release tag signature: |
| 88 | +```bash |
| 89 | +gpg --keyserver keys.openpgp.org --recv-keys DE23E73BFA8A0AD5587D2FCDE80D2F3F311FD87E |
| 90 | +``` |
| 91 | + |
| 92 | +Then, run the `release.sh` script directly: |
| 93 | + |
| 94 | +```bash |
| 95 | +./release.sh <tag-of-release> |
| 96 | +``` |
| 97 | + |
| 98 | +To filter the target platforms, pass them as a space-separated list in the |
| 99 | +`LOOPBUILDSYS` environment variable: |
| 100 | + |
| 101 | +```bash |
| 102 | +LOOPBUILDSYS='linux-amd64 windows-amd64' ./release.sh v0.31.3-beta |
| 103 | +``` |
| 104 | + |
| 105 | +This will produce the same artifacts in a `loop-<tag-of-release>` directory as |
| 106 | +the `make docker-release` command. The latter simply runs the `release.sh` |
| 107 | +script inside a Docker container. |
0 commit comments