Skip to content

Commit

Permalink
fix release script
Browse files Browse the repository at this point in the history
  • Loading branch information
edouardparis committed Nov 14, 2024
1 parent 802270b commit 00cc580
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 88 deletions.
12 changes: 6 additions & 6 deletions contrib/release/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ TARGET_DIR="$BUILD_DIR" ./contrib/reproducible/docker/docker-build.sh
(
cd "$BUILD_DIR"
create_dir "$LINUX_DIR_NAME"
cp "$BUILD_DIR/release/lianad" "$BUILD_DIR/release/liana-cli" "$BUILD_DIR/gui/release/liana-gui" ../README.md "$LINUX_DIR_NAME"
cp "$BUILD_DIR/release/lianad" "$BUILD_DIR/release/liana-cli" "$BUILD_DIR/release/liana-gui" ../README.md "$LINUX_DIR_NAME"
tar -czf "$LINUX_ARCHIVE" "$LINUX_DIR_NAME"
cp "$LINUX_ARCHIVE" "$RELEASE_DIR"

unzip ../contrib/release/debian/package.zip
sed -i "s/VERSION_PLACEHOLDER/$VERSION/g" ./package/DEBIAN/control
cp "$BUILD_DIR/release/lianad" "$BUILD_DIR/release/liana-cli" "$BUILD_DIR/gui/release/liana-gui" ../README.md ./package/usr/bin/
cp "$BUILD_DIR/release/lianad" "$BUILD_DIR/release/liana-cli" "$BUILD_DIR/release/liana-gui" ../README.md ./package/usr/bin/
DIRNAME="liana_$VERSION-1_amd64"
mv ./package "$DIRNAME"
dpkg-deb -Zxz --build "$DIRNAME"
Expand All @@ -55,23 +55,23 @@ TARGET_DIR="$BUILD_DIR" ./contrib/reproducible/docker/docker-build.sh
(
cd "$BUILD_DIR"
create_dir "$WINDOWS_DIR_NAME"
cp "$BUILD_DIR/gui/x86_64-pc-windows-gnu/release/liana-gui.exe" ../README.md "$WINDOWS_DIR_NAME"
cp "$BUILD_DIR/x86_64-pc-windows-gnu/release/liana-gui.exe" ../README.md "$WINDOWS_DIR_NAME"
zip -r "$WINDOWS_ARCHIVE" "$WINDOWS_DIR_NAME"
cp "$WINDOWS_ARCHIVE" "$RELEASE_DIR"
cp "$BUILD_DIR/gui/x86_64-pc-windows-gnu/release/liana-gui.exe" "$RELEASE_DIR/$LIANA_PREFIX.exe"
cp "$BUILD_DIR/x86_64-pc-windows-gnu/release/liana-gui.exe" "$RELEASE_DIR/$LIANA_PREFIX.exe"
)

# Create the MacOS archive and a zipped application bundle of liana-gui.
(
cd "$BUILD_DIR"
create_dir "$MAC_DIR_NAME"
cp "$BUILD_DIR/x86_64-apple-darwin/release/lianad" "$BUILD_DIR/x86_64-apple-darwin/release/liana-cli" "$BUILD_DIR/gui/x86_64-apple-darwin/release/liana-gui" ../README.md "$MAC_DIR_NAME"
cp "$BUILD_DIR/x86_64-apple-darwin/release/lianad" "$BUILD_DIR/x86_64-apple-darwin/release/liana-cli" "$BUILD_DIR/x86_64-apple-darwin/release/liana-gui" ../README.md "$MAC_DIR_NAME"
tar -czf "$MAC_ARCHIVE" "$MAC_DIR_NAME"
cp "$MAC_ARCHIVE" "$RELEASE_DIR"

unzip ../contrib/release/macos/Liana.app.zip
sed -i "s/VERSION_PLACEHOLDER/$VERSION/g" ./Liana.app/Contents/Info.plist
cp "$BUILD_DIR/gui/x86_64-apple-darwin/release/liana-gui" ./Liana.app/Contents/MacOS/Liana
cp "$BUILD_DIR/x86_64-apple-darwin/release/liana-gui" ./Liana.app/Contents/MacOS/Liana
zip -ry Liana-noncodesigned.zip Liana.app
cp ./Liana-noncodesigned.zip "$RELEASE_DIR/"

Expand Down
8 changes: 2 additions & 6 deletions contrib/reproducible/docker/docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ docker run --rm -ti \
-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/Cargo.lock":/liana/liana/Cargo.lock \
-v "$PWD/liana/src":/liana/liana/src \
-v "$PWD/liana-gui/Cargo.toml":/liana/liana-gui/Cargo.toml \
-v "$PWD/liana-gui/Cargo.lock":/liana/liana-gui/Cargo.lock \
-v "$PWD/liana-gui/src":/liana/liana-gui/src \
-v "$PWD/liana-ui/Cargo.toml":/liana/liana-ui/Cargo.toml \
-v "$PWD/liana-ui/Cargo.lock":/liana/liana-ui/Cargo.lock \
-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


Expand All @@ -42,15 +40,13 @@ docker run -ti \
-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/Cargo.lock":/liana/liana/Cargo.lock \
-v "$PWD/liana/src":/liana/liana/src \
-v "$PWD/liana-gui/Cargo.toml":/liana/liana-gui/Cargo.toml \
-v "$PWD/liana-gui/Cargo.lock":/liana/liana-gui/Cargo.lock \
-v "$PWD/liana-gui/src":/liana/liana-gui/src \
-v "$PWD/liana-ui/Cargo.toml":/liana/liana-ui/Cargo.toml \
-v "$PWD/liana-ui/Cargo.lock":/liana/liana-ui/Cargo.lock \
-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
Expand Down
25 changes: 9 additions & 16 deletions contrib/reproducible/docker/macos_cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,18 @@ 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"

PATH="$PATH:$PWD/osxcross/target/bin/" \
CC=o64-clang \
CXX=o64-clang++ \
RUSTFLAGS="$RUSTFLAGS -Clinker=o64-clang" \
cargo rustc \
for package_name in "liana" "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

cd gui/
PATH="$PATH:$PWD/../osxcross/target/bin/" \
CC=o64-clang \
CXX=o64-clang++ \
RUSTFLAGS="$RUSTFLAGS -Clinker=o64-clang" \
cargo rustc \
--target x86_64-apple-darwin \
--release
cd ..
done

# Avoid having to get root on the host to remove the target dir.
chmod -R a+rw target/ gui/target
chmod -R a+rw target/

set +xe
1 change: 1 addition & 0 deletions contrib/reproducible/docker/windows_cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ set -xe
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

Expand Down
27 changes: 17 additions & 10 deletions contrib/reproducible/guix/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,25 @@ branch = "patch-0.12.3"
replace-with = "vendored_sources"
EOF

ls -la .cargo/config.toml

export CARGO_HOME="/liana/.cargo"

# We need to set RUSTC_BOOTSTRAP=1 as a workaround to be able to use unstable
# features in the GUI dependencies
RUSTC_BOOTSTRAP=1 cargo -vvv \
--color always \
--frozen \
--offline \
rustc \
--jobs "$JOBS" \
--release \
--target-dir "/out"

for bin_name in "liana-gui lianad liana-cli"; do
for package_name in "liana" "liana-gui"; do
RUSTC_BOOTSTRAP=1 cargo -vvv \
--color always \
--frozen \
--offline \
rustc \
-p "$package_name" \
--jobs "$JOBS" \
--release \
--target-dir "/out"
done

for bin_name in "liana-gui" "lianad" "liana-cli"; do
# Assume 64bits. Even bitcoind doesn't ship 32bits binaries for x86.
# FIXME: is there a cleaner way than using patchelf for this?
patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 "/out/release/$bin_name"
Expand Down
29 changes: 3 additions & 26 deletions contrib/reproducible/guix/guix-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,38 +59,16 @@ time_machine() {
PROJECT_ROOT="$PWD"
PROJECT_VENDOR_DIR="$VENDOR_DIR"
PROJECT_OUT_DIR="$OUT_DIR"
PROJECT_PATCHES_ROOT="$PWD/contrib/reproducible/guix/liana-patches"

maybe_create_dir "$PROJECT_OUT_DIR"

# Pull the sources of our dependencies before building them in the container.
if ! [ -d "$PROJECT_VENDOR_DIR" ]; then
# Download the dependencies
($CARGO_BIN vendor "$PROJECT_VENDOR_DIR" )

# Patch some dependencies sources if needed for this project
(
cd "$PROJECT_VENDOR_DIR"
for patch_file in $(ls "$PROJECT_PATCHES_ROOT"); do
patch -p1 < "$PROJECT_PATCHES_ROOT/$patch_file"
done
)

# Some of the checksums will be incorrect. Instead of cherry-picking remove them
# altogether, since they aren't useful anyways (see comment below).
for dep in $(ls "$PROJECT_VENDOR_DIR"); do
echo "{\"files\":{}}" > "$PROJECT_VENDOR_DIR/$dep/.cargo-checksum.json"
done
fi

cp "$PROJECT_ROOT/Cargo.lock" "$BUILD_ROOT/Cargo.lock"
# Remove the checksums from the Cargo.lock. In the container `cargo rustc` would compare
# them against the .cargo-checksum.json to make sure they weren't tampered with since they
# where vendored. But we just removed the checksums from the .cargo-checksum.json.
# There is little point in checking integrity between the above vendor step and now anyways.
# What matters is checking integrity after downloading the crates from the internet and
# `cargo vendor` does that already.
sed -i '/checksum/d' "$BUILD_ROOT/Cargo.lock"

# Bootstrap a reproducible environment as specified by the manifest in an isolated
# container, and build the project.
Expand All @@ -99,16 +77,15 @@ sed -i '/checksum/d' "$BUILD_ROOT/Cargo.lock"
# miss some dependencies).
time_machine shell --no-cwd \
--expose="$PWD/Cargo.toml=/liana/Cargo.toml" \
--expose="$PWD/Cargo.lock=/liana/Cargo.lock" \
--expose="$BUILD_ROOT/Cargo.lock=/liana/Cargo.lock" \
--expose="$PWD/liana/src=/liana/liana/src" \
--expose="$PWD/liana/Cargo.toml=/liana/liana/Cargo.toml" \
--expose="$PWD/liana/Cargo.lock=/liana/liana/Cargo.lock" \
--expose="$PWD/liana-gui/Cargo.toml=/liana/liana-gui/Cargo.toml" \
--expose="$PWD/liana-gui/Cargo.lock=/liana/liana-gui/Cargo.lock" \
--expose="$PWD/liana-gui/src=/liana/liana-gui/Cargo.lock" \
--expose="$PWD/liana-gui/src=/liana/liana-gui/src" \
--expose="$PWD/liana-ui/src=/liana/liana-ui/src" \
--expose="$PWD/liana-ui/Cargo.toml=/liana/liana-ui/Cargo.toml" \
--expose="$PWD/liana-ui/static=/liana/liana-ui/static" \
--expose="$PWD/fuzz/Cargo.toml=/liana/fuzz/Cargo.toml" \
--expose="$PWD/contrib/reproducible/guix/build.sh=/liana/build.sh" \
--expose="$PROJECT_VENDOR_DIR=/vendor" \
--share="$PROJECT_OUT_DIR=/out" \
Expand Down
42 changes: 18 additions & 24 deletions contrib/reproducible/guix/manifest.scm
Original file line number Diff line number Diff line change
Expand Up @@ -170,27 +170,21 @@ FILE-NAME found in ./patches relative to the current file."

;; END of the newer rustc versions copied over from the current Guix master.

(let ((is_gui (getenv "IS_GUI")))
(concatenate-manifests
(list
(specifications->manifest
(append
(list
"rust:cargo"
"coreutils-minimal"
"patchelf"
"[email protected]")
;; Additional dependencies for building the GUI.
(if
(string=? is_gui "1")
(list "pkg-config"
"eudev"
"fontconfig")
'())))
;; The GUI's MSRV is 1.70 and the daemon's 1.63. We just use the same rustc version for
;; both.
;; FIXME: be able to compile against a specified glibc (or musl) instead of having to
;; resort to backporting the newer rustc releases here. Also have proper Guix packages
;; for the two projects.
(packages->manifest
`(,rust-1.71)))))
(concatenate-manifests
(list
(specifications->manifest
(list
"rust:cargo"
"coreutils-minimal"
"patchelf"
"[email protected]"
"pkg-config"
"eudev"
"fontconfig"))
;; The GUI's MSRV is 1.70 and the daemon's 1.63. We just use the same rustc version for
;; both.
;; FIXME: be able to compile against a specified glibc (or musl) instead of having to
;; resort to backporting the newer rustc releases here. Also have proper Guix packages
;; for the two projects.
(packages->manifest
`(,rust-1.71))))

0 comments on commit 00cc580

Please sign in to comment.