diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index f55d05eea..000000000 --- a/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -* -!Cargo.* -!gui/Cargo.* -!contrib/reproducible/docker/cargo_config.toml diff --git a/contrib/reproducible/docker/README.md b/contrib/reproducible/docker/README.md deleted file mode 100644 index 7d939cbe1..000000000 --- a/contrib/reproducible/docker/README.md +++ /dev/null @@ -1,33 +0,0 @@ -## Reproducible Liana builds - -This repository contains the scripts to [reproducibly build](https://reproducible-builds.org/) Liana -on Windows and MacOS, for which we are missing [bootstrapable Guix builds](../guix/). - -In order to perform the builds you will need [Docker](https://www.docker.com/). - -The [`docker-build.sh`](./docker-build.sh) script will create a Docker image containing the build -environment for both Mac and Windows (see the respective `Dockerfile`s). It will then build the GUI -on Windows (the daemon isn't supported there) and both the daemon and the GUI on MacOS. The output -will be placed in a given `TARGET_DIR` (whose default value is `deter_build_target`). - -### Build instructions - -First of all, get [Docker](https://www.docker.com/). - -Then get the MacOS SDK. It is required to be able to build the MacOS binaries. The `12_2` version is -required (`Xcode_12.2.xip`). You need to download it from Apple's website. An Apple ID and cookies -enabled for the hostname are required. You can create one for free. (Note it is illegal to -distribute the archive.) Once logged in you can use the [direct -link](https://download.developer.apple.com/Developer_Tools/Xcode_12.2/Xcode_12.2.xip) to download -the archive. Alternatively, go to 'Downloads', then 'More' and search for [`Xcode -12.2`](https://developer.apple.com/download/all/?q=Xcode%2012.2). -The `sha256sum` of the downloaded XIP archive should be -`28d352f8c14a43d9b8a082ac6338dc173cb153f964c6e8fb6ba389e5be528bd0`. - -Copy the downloaded `Xcode_12.2.xip` archive at the root of this repository (or provide a custom -path to the script by setting the `XCODE_PATH` env var). - -Finally, run the script from the root of the repository: -``` -./contrib/reproducible/docker/docker-build.sh -``` diff --git a/contrib/reproducible/docker/docker-build.sh b/contrib/reproducible/docker/docker-build.sh deleted file mode 100755 index 55127d886..000000000 --- a/contrib/reproducible/docker/docker-build.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env sh - -set -ex - -TARGET_DIR="${TARGET_DIR:-"$PWD/deter_build_target"}" - -XCODE_PATH="${XCODE_PATH:-"$PWD/Xcode_12.2.xip"}" -XCODE_FILENAME="$(basename $XCODE_PATH)" -XCODE_SHASUM="28d352f8c14a43d9b8a082ac6338dc173cb153f964c6e8fb6ba389e5be528bd0" - -# Build (only) the Liana GUI on Windows. -docker build . -t liana_cross_win -f contrib/reproducible/docker/windows.Dockerfile -docker run --rm -ti \ - -v "$TARGET_DIR":/liana/target \ - -v "$PWD/contrib/reproducible/docker":/liana/docker \ - -v "$PWD/Cargo.toml":/liana/Cargo.toml \ - -v "$PWD/Cargo.lock":/liana/Cargo.lock \ - -v "$PWD/liana/Cargo.toml":/liana/liana/Cargo.toml \ - -v "$PWD/liana/src":/liana/liana/src \ - -v "$PWD/lianad/Cargo.toml":/liana/lianad/Cargo.toml \ - -v "$PWD/lianad/src":/liana/lianad/src \ - -v "$PWD/liana-gui/Cargo.toml":/liana/liana-gui/Cargo.toml \ - -v "$PWD/liana-gui/src":/liana/liana-gui/src \ - -v "$PWD/liana-ui/Cargo.toml":/liana/liana-ui/Cargo.toml \ - -v "$PWD/liana-ui/src":/liana/liana-ui/src \ - -v "$PWD/liana-ui/static":/liana/liana-ui/static \ - -v "$PWD/fuzz/Cargo.toml":/liana/fuzz/Cargo.toml \ - liana_cross_win - - -# Sanity check the given MacOS SDK is the expected one. -if ! $(echo "$XCODE_SHASUM $XCODE_PATH" | sha256sum -c --status); then - echo "No or invalid Xcode SDK found. Need an Xcode_X.Y.xip archive whose hash is $XCODE_SHASUM. You can configure the path using \$XCODE_PATH."; - exit 1; -fi - -# Build both the Liana daemon and GUI on MacOS. -docker build . -t liana_cross_mac -f contrib/reproducible/docker/macos.Dockerfile -docker run -ti \ - -v "$TARGET_DIR":/liana/target \ - -v "$PWD/contrib/reproducible/docker":/liana/docker \ - -v "$PWD/Cargo.toml":/liana/Cargo.toml \ - -v "$PWD/Cargo.lock":/liana/Cargo.lock \ - -v "$PWD/liana/Cargo.toml":/liana/liana/Cargo.toml \ - -v "$PWD/liana/src":/liana/liana/src \ - -v "$PWD/lianad/Cargo.toml":/liana/lianad/Cargo.toml \ - -v "$PWD/lianad/src":/liana/lianad/src \ - -v "$PWD/liana-gui/Cargo.toml":/liana/liana-gui/Cargo.toml \ - -v "$PWD/liana-gui/src":/liana/liana-gui/src \ - -v "$PWD/liana-ui/Cargo.toml":/liana/liana-ui/Cargo.toml \ - -v "$PWD/liana-ui/src":/liana/liana-ui/src \ - -v "$PWD/liana-ui/static":/liana/liana-ui/static \ - -v "$PWD/fuzz/Cargo.toml":/liana/fuzz/Cargo.toml \ - -v "$XCODE_PATH":"/liana/$XCODE_FILENAME" \ - -e XCODE_PATH="/liana/$XCODE_FILENAME" \ - liana_cross_mac - -set +ex diff --git a/contrib/reproducible/docker/macos.Dockerfile b/contrib/reproducible/docker/macos.Dockerfile deleted file mode 100644 index 6296515ed..000000000 --- a/contrib/reproducible/docker/macos.Dockerfile +++ /dev/null @@ -1,50 +0,0 @@ -FROM debian:bullseye - -WORKDIR /liana - -# We try to pin our dependencies to avoid potential sources of non-determinism, but we don't go -# out of our way to pin the whole tree of deps. Instead invest time in getting Guix cross-compilation. -RUN apt update && apt satisfy -y \ - "clang (>=11.0, <=11.0)" \ - "make (<=4.3-*)" \ - "libssl-dev (>=1.1, <=1.1)" \ - "liblzma-dev (>=5.2, <=5.2)" \ - "libxml2 (>=2.9, <= 2.9)" \ - "libxml2-dev (>=2.9, <=2.9)" \ - "cmake (>=3.18, <=3.18)" \ - "git (>=2.30, <=2.30)" \ - "patch (>=2.7, <=2.7)" \ - "python3 (>=3.9, <=3.9)" \ - "llvm-dev (>=11.0, <=11.0)" \ - "cpio (<=2.13+*)" \ - "zlib1g-dev (>=1.2, <=1.2)" \ - "libbz2-dev (>=1.0, <=1.0)" \ - "xz-utils (>=5.2, <=5.2)" \ - "bzip2 (>=1.0, <=1.0)" \ - "curl (>=7.74, <=7.74)" - -# Download the cargo binary and compiled stdlib from the distributed releases to make sure to build with -# the very same toolchain. We use 1.71.1 because it is unfortunately the MSRV of the GUI. -RUN curl -O "https://static.rust-lang.org/dist/rust-1.71.1-x86_64-unknown-linux-gnu.tar.gz" && \ - echo "34778d1cda674990dfc0537bc600066046ae9cb5d65a07809f7e7da31d4689c4 rust-1.71.1-x86_64-unknown-linux-gnu.tar.gz" | sha256sum -c && \ - tar -xzf rust-1.71.1-x86_64-unknown-linux-gnu.tar.gz && \ - curl -O "https://static.rust-lang.org/dist/rust-1.71.1-x86_64-apple-darwin.tar.gz" && \ - echo "916056603da88336aba68bbeab49711cc8fdb9cfb46a49b04850c0c09761f58c rust-1.71.1-x86_64-apple-darwin.tar.gz" | sha256sum -c && \ - tar -xzf rust-1.71.1-x86_64-apple-darwin.tar.gz && \ - rm -r *.tar.gz - -# NOTE: we were previously caching dependencies here (through `cargo vendor`). It's a tradeoff between the image size -# and not needing internet access when running the image to build the software. - -# For some reason, we can't just set the RUSTFLAGS environment variable to add `-L` for compiling dependencies. -# This doesn't work: RUSTFLAGS="-L/liana/rust-1.71.1-x86_64-apple-darwin/rust-std-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/" -# As a workaround, we use a wrapped `rustc` binary that always links against the macOS stdlib we just downloaded. -# Some issues that seem to be related: -# https://github.com/rust-lang/rust/issues/40717 -# https://github.com/rust-lang/rust/issues/48409 -RUN echo "#!/bin/sh" > rustc_wrapper.sh && \ - echo "/liana/rust-1.71.1-x86_64-unknown-linux-gnu/rustc/bin/rustc \"\$@\" -L/liana/rust-1.71.1-x86_64-apple-darwin/rust-std-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/ -L/liana/rust-1.71.1-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/" >> rustc_wrapper.sh && \ - chmod +x rustc_wrapper.sh -ENV RUSTC="/liana/rustc_wrapper.sh" - -CMD ["./docker/macos_cmd.sh"] diff --git a/contrib/reproducible/docker/macos_cmd.sh b/contrib/reproducible/docker/macos_cmd.sh deleted file mode 100755 index 332c70a23..000000000 --- a/contrib/reproducible/docker/macos_cmd.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env sh - -# ========================================================== -# The script ran within the Docker container to build Liana. -# ========================================================== - -set -xe - -test -f "$XCODE_PATH" || exit 1 - -# Build the SDK and the toolchain using osxcross. It is expected to be located at $XCODE_PATH -# It's not part of the image to be able to share the $XCODE_PATH instead of copying it in the Docker context -# and then to the image. -git clone https://github.com/darosior/osxcross -b dependencies_pinning -cd osxcross -git checkout 50e86ebca7d14372febd0af8cd098705049161b9 -DARLING_DMG_REVISION=241238313a47d3cf6427ac5a75b7a0311a3a4cb4 \ - P7ZIP_REVISION=2f60a51ac3aa2507d36df3c4f58f71a3716b1357 \ - PBZX_REVISION=2a4d7c3300c826d918def713a24d25c237c8ed53 \ - XAR_REVISION=c2111a9a9cabc50d2b9c604aff41a481ae3f1989 ./tools/gen_sdk_package_pbzx.sh "$XCODE_PATH" -mv MacOSX* tarballs/ -DARLING_DMG_REVISION=241238313a47d3cf6427ac5a75b7a0311a3a4cb4 \ - P7ZIP_REVISION=2f60a51ac3aa2507d36df3c4f58f71a3716b1357 \ - PBZX_REVISION=2a4d7c3300c826d918def713a24d25c237c8ed53 \ - XAR_REVISION=c2111a9a9cabc50d2b9c604aff41a481ae3f1989 \ - UNATTENDED=1 ./build.sh -cd .. - -# Finally build the projects using the toolchain just created. -alias cargo="/liana/rust-1.71.1-x86_64-unknown-linux-gnu/cargo/bin/cargo" - -for package_name in "lianad" "liana-gui"; do - PATH="$PATH:$PWD/osxcross/target/bin/" \ - CC=o64-clang \ - CXX=o64-clang++ \ - RUSTFLAGS="$RUSTFLAGS -Clinker=o64-clang" \ - cargo rustc \ - -p "$package_name" \ - --target x86_64-apple-darwin \ - --release -done - -# Avoid having to get root on the host to remove the target dir. -chmod -R a+rw target/ - -set +xe diff --git a/contrib/reproducible/docker/windows.Dockerfile b/contrib/reproducible/docker/windows.Dockerfile deleted file mode 100644 index 129451fd4..000000000 --- a/contrib/reproducible/docker/windows.Dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -FROM debian:bullseye - -WORKDIR /liana - -# We try to pin our dependencies to avoid potential sources of non-determinism, but we don't go -# out of our way to pin the whole tree of deps. Instead invest time in getting Guix cross-compilation. -RUN apt update && apt satisfy -y \ - "gcc-mingw-w64-x86-64 (>=10.2, <=10.2)" \ - "curl (>=7.74, <=7.74)" \ - "gcc (>=10.2, <=10.2)" - -# Download the cargo binary and compiled stdlib from the distributed releases to make sure to build with -# the very same toolchain. We use 1.71.1 because it is unfortunately the MSRV of the GUI. -RUN curl -O "https://static.rust-lang.org/dist/rust-1.71.1-x86_64-unknown-linux-gnu.tar.gz" && \ - echo "34778d1cda674990dfc0537bc600066046ae9cb5d65a07809f7e7da31d4689c4 rust-1.71.1-x86_64-unknown-linux-gnu.tar.gz" | sha256sum -c && \ - tar -xzf rust-1.71.1-x86_64-unknown-linux-gnu.tar.gz && \ - curl -O "https://static.rust-lang.org/dist/rust-1.71.1-x86_64-pc-windows-gnu.tar.gz" && \ - echo "15289233721ad7c3d697890d9c6079ca3b8a0f6740c080fbec3e8ae3a5ea5c8c rust-1.71.1-x86_64-pc-windows-gnu.tar.gz" | sha256sum -c && \ - tar -xzf rust-1.71.1-x86_64-pc-windows-gnu.tar.gz && \ - rm -r *.tar.gz - -# NOTE: we were previously caching dependencies here (through `cargo vendor`). It's a tradeoff between the image size -# and not needing internet access when running the image to build the software. - -# For some reason, we can't just set the RUSTFLAGS environment variable to add `-L` for compiling dependencies. -# This doesn't work: RUSTFLAGS="-L /liana/rust-1.71.1-x86_64-pc-windows-gnu/rust-std-x86_64-pc-windows-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/ -L /liana/rust-1.71.1-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/" -# As a workaround, we use a wrapped `rustc` binary that always links against the windows stdlib we just downloaded. -# Some issues that seem to be related: -# https://github.com/rust-lang/rust/issues/40717 -# https://github.com/rust-lang/rust/issues/48409 -RUN echo "#!/bin/sh" > rustc_wrapper.sh && \ - echo "/liana/rust-1.71.1-x86_64-unknown-linux-gnu/rustc/bin/rustc \"\$@\" -L /liana/rust-1.71.1-x86_64-pc-windows-gnu/rust-std-x86_64-pc-windows-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/ -L /liana/rust-1.71.1-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/" >> rustc_wrapper.sh && \ - chmod +x rustc_wrapper.sh -ENV RUSTC="/liana/rustc_wrapper.sh" - -CMD ["./docker/windows_cmd.sh"] diff --git a/contrib/reproducible/docker/windows_cmd.sh b/contrib/reproducible/docker/windows_cmd.sh deleted file mode 100755 index b087a7cb1..000000000 --- a/contrib/reproducible/docker/windows_cmd.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env sh - -# ================================================================= -# The script ran within the Docker container to build the Liana GUI. -# ================================================================= - -set -xe - -# Build the GUI for Windows. The Windows Portable Execution (PE) format contains some timestamps. -# Instruct ld to set them to 0. -alias cargo="/liana/rust-1.71.1-x86_64-unknown-linux-gnu/cargo/bin/cargo" -RUSTFLAGS="-Clink-arg=-Wl,--no-insert-timestamp" \ - cargo rustc \ - -p liana-gui \ - --release \ - --target x86_64-pc-windows-gnu - -# Avoid having to get root on the host to remove the target dir. -chmod -R a+rw target/ - -set +xe