2022-08-29 16:58:05 +00:00
# Reproducible builds
2021-09-09 12:07:45 +00:00
2022-08-29 16:58:05 +00:00
Reproducibility is a goal of the Sparrow Wallet project.
2021-09-09 12:07:45 +00:00
As of v1.5.0 and later, it is possible to recreate the exact binaries in the Github releases (specifically, the contents of the `.tar.gz` and `.zip` files).
Due to minor variances, it is not yet possible to reproduce the installer packages (`.deb`, `.rpm` and `.exe` ).
2022-08-29 16:58:05 +00:00
In addition, the OSX binary is code signed and thus can't be directly reproduced yet.
2021-09-09 12:07:45 +00:00
Work on resolving both of these issues is ongoing.
2022-08-29 16:58:05 +00:00
## Reproducing a release
2021-09-09 12:07:45 +00:00
2022-08-29 16:58:05 +00:00
### Install Java
2021-09-09 12:07:45 +00:00
Because Sparrow bundles a Java runtime in the release binaries, it is essential to have the same version of Java installed when creating the release.
2022-08-29 16:58:05 +00:00
For v1.6.6 and later, this is Eclipse Temurin 18.0.1+10.
#### Java from Adoptium github repo
2022-08-04 12:35:59 +00:00
It is available for all supported platforms from [Eclipse Temurin 18.0.1+10 ](https://github.com/adoptium/temurin18-binaries/releases/tag/jdk-18.0.1%2B10 ).
2021-09-09 12:07:45 +00:00
For reference, the downloads are as follows:
2022-08-04 12:35:59 +00:00
- [Linux x64 ](https://github.com/adoptium/temurin18-binaries/releases/download/jdk-18.0.1%2B10/OpenJDK18U-jdk_x64_linux_hotspot_18.0.1_10.tar.gz )
- [MacOS x64 ](https://github.com/adoptium/temurin18-binaries/releases/download/jdk-18.0.1%2B10/OpenJDK18U-jdk_x64_mac_hotspot_18.0.1_10.tar.gz )
- [MacOS aarch64 ](https://github.com/adoptium/temurin18-binaries/releases/download/jdk-18.0.1%2B10/OpenJDK18U-jdk_aarch64_mac_hotspot_18.0.1_10.tar.gz )
- [Windows x64 ](https://github.com/adoptium/temurin18-binaries/releases/download/jdk-18.0.1%2B10/OpenJDK18U-jdk_x64_windows_hotspot_18.0.1_10.zip )
2021-09-09 12:07:45 +00:00
2022-08-29 16:58:05 +00:00
#### Java from Adoptium deb repo
2021-09-09 12:07:45 +00:00
It is also possible to install via a package manager on *nix systems. For example, on Debian/Ubuntu systems:
2022-08-29 16:58:05 +00:00
- Install dependencies:
```sh
sudo apt-get install -y wget curl apt-transport-https gnupg
```
Download Adoptium public PGP key:
```sh
curl --tlsv1.2 --proto =https --location -o adoptium.asc https://packages.adoptium.net/artifactory/api/gpg/key/public
```
Check if key fingerprint matches: `3B04D753C9050D9A5D343F39843C48A565F8F04B` :
```
gpg --import --import-options show-only adoptium.asc
```
2024-02-02 21:11:36 +00:00
If key doesn't match, do not proceed.
2022-08-29 16:58:05 +00:00
Add Adoptium PGP key to a the keyring shared folder:
```sh
sudo cp adoptium.asc /usr/share/keyrings/
```
Add Adoptium debian repository:
```sh
echo "deb [signed-by=/usr/share/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | sudo tee /etc/apt/sources.list.d/adoptium.list
```
Update cache, install the desired temurin version and configure java to be linked to this same version:
```
2021-09-09 12:07:45 +00:00
sudo apt update -y
2022-08-29 06:51:19 +00:00
sudo apt-get install -y temurin-18-jdk=18.0.1+10
2022-05-23 06:55:13 +00:00
sudo update-alternatives --config java
2021-09-09 12:07:45 +00:00
```
2022-08-29 16:58:05 +00:00
#### Java from SDK
2021-09-09 16:16:54 +00:00
A alternative option for all platforms is to use the [sdkman.io ](https://sdkman.io/ ) package manager ([Git Bash for Windows](https://git-scm.com/download/win) is a good choice on that platform).
2021-09-09 12:07:45 +00:00
See the installation [instructions here ](https://sdkman.io/install ).
Once installed, run
```shell
2022-08-04 12:35:59 +00:00
sdk install java 18.0.1-tem
2021-09-09 12:07:45 +00:00
```
2022-08-29 16:58:05 +00:00
### Other requirements
2021-09-09 12:07:45 +00:00
Other packages may also be necessary to build depending on the platform. On Debian/Ubuntu systems:
```shell
2021-09-10 11:58:18 +00:00
sudo apt install -y rpm fakeroot binutils
2021-09-09 12:07:45 +00:00
```
2022-08-29 16:58:05 +00:00
### Building the binaries
2021-09-09 12:07:45 +00:00
2022-11-02 06:41:50 +00:00
First, assign a temporary variable in your shell for the specific release you want to build. For the current one specify:
2022-11-01 13:04:22 +00:00
2021-09-09 12:07:45 +00:00
```shell
2024-04-26 07:07:37 +00:00
GIT_TAG="1.9.0"
2022-11-01 13:04:22 +00:00
```
The project can then be initially cloned as follows:
```shell
2022-08-29 16:58:05 +00:00
git clone --recursive --branch "${GIT_TAG}" https://github.com/sparrowwallet/sparrow.git
2021-09-09 12:07:45 +00:00
```
2022-11-01 13:04:22 +00:00
If you already have the sparrow repo cloned, fetch all new updates and checkout the release. For this, change into your local sparrow folder and execute:
```shell
2022-11-01 16:42:17 +00:00
cd {yourPathToSparrow}/sparrow
2022-11-01 13:04:22 +00:00
git pull --recurse-submodules
git checkout "${GIT_TAG}"
```
2022-11-02 06:41:50 +00:00
Note - there is an additional step if you updated rather than initially cloned your repo at `GIT_TAG` .
This is due to the [drongo submodule ](https://github.com/sparrowwallet/drongo/tree/master ) which needs to be checked out to the commit state it had at the time of the release.
Only then your build will be comparable to the provided one in the release section of Github.
To checkout the submodule to the correct commit for `GIT_TAG` , additionally run:
2022-11-01 13:04:22 +00:00
```shell
git submodule update --checkout
```
Thereafter, building should be straightforward. If not already done, change into the sparrow folder and run:
2021-09-09 12:07:45 +00:00
```shell
2022-11-01 16:42:17 +00:00
cd {yourPathToSparrow}/sparrow # if you aren't already in the sparrow folder
2021-09-09 12:07:45 +00:00
./gradlew jpackage
```
The binaries (and installers) will be placed in the `build/jpackage` folder.
2022-08-29 16:58:05 +00:00
### Verifying the binaries are identical
Verify the built binaries against the released binaries on https://github.com/sparrowwallet/sparrow/releases.
2021-09-09 12:07:45 +00:00
Note that you will be verifying the files in the `build/jpackage/Sparrow` folder against either the `.tar.gz` or `.zip` releases.
Download either of these depending on your platform and extract the contents to a folder (in the following example, `/tmp` ).
Then compare all of the folders and files recursively:
```shell
diff -r build/jpackage/Sparrow /tmp/Sparrow
```
This command should have no output indicating that the two folders (and all their contents) are identical.
2022-08-29 16:58:05 +00:00
If there is output, please open an issue with detailed instructions to reproduce, including build system platform.