From 6d77eed814b4cf67bcaff63f0c18bbd8a7d765e7 Mon Sep 17 00:00:00 2001 From: Chip Senkbeil Date: Sat, 14 May 2022 12:57:11 -0500 Subject: [PATCH] Fix musl release --- .github/workflows/release.yml | 4 +++- Cargo.lock | 30 ------------------------------ Cargo.toml | 7 ++++--- distant-ssh2/Cargo.toml | 15 ++++++--------- 4 files changed, 13 insertions(+), 43 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3796aec..c84ef38 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -123,6 +123,8 @@ jobs: path: | ${{ env.X86_GNU_REL_BIN }} + # NOTE: For musl, we only support ssh2 and not libssh for the time being due to some + # build issue with libssh-rs-sys not finding the symbol ENGINE_cleanup in libcrypto linux_musl: name: "Build release on Linux (musl)" runs-on: ubuntu-latest @@ -147,7 +149,7 @@ jobs: - name: Build binary (MUSL x86_64) run: | source $HOME/.cargo/env - cargo build --release --all-features --target ${{ env.X86_MUSL_ARCH }} + cargo build --release --no-default-features --features ssh2 --target ${{ env.X86_MUSL_ARCH }} ls -l ./${{ env.X86_MUSL_DIR }} strip ./${{ env.X86_MUSL_DIR }}/${{ env.BUILD_BIN }} mv ./${{ env.X86_MUSL_DIR }}/${{ env.BUILD_BIN }} ./${{ env.X86_MUSL_REL_BIN }} diff --git a/Cargo.lock b/Cargo.lock index 5d70bd8..798e9a3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -607,7 +607,6 @@ dependencies = [ "indoc", "log", "once_cell", - "openssl", "predicates", "rand 0.8.4", "rpassword", @@ -730,21 +729,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "fork" version = "0.1.18" @@ -1314,20 +1298,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" -[[package]] -name = "openssl" -version = "0.10.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" -dependencies = [ - "bitflags", - "cfg-if 1.0.0", - "foreign-types", - "libc", - "once_cell", - "openssl-sys", -] - [[package]] name = "openssl-src" version = "300.0.4+3.0.1" diff --git a/Cargo.toml b/Cargo.toml index a920a1c..501fa89 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,8 +20,9 @@ lto = true codegen-units = 1 [features] -default = ["ssh2"] -ssh2 = ["distant-ssh2"] +default = ["libssh", "ssh2"] +libssh = ["distant-ssh2/libssh"] +ssh2 = ["distant-ssh2/ssh2"] [dependencies] derive_more = { version = "0.99.16", default-features = false, features = ["display", "from", "error", "is_variant"] } @@ -42,7 +43,7 @@ termwiz = "0.15.0" whoami = "1.1.2" # Optional native SSH functionality -distant-ssh2 = { version = "=0.16.1", path = "distant-ssh2", features = ["serde"], optional = true } +distant-ssh2 = { version = "=0.16.1", path = "distant-ssh2", default-features = false, features = ["serde"], optional = true } [target.'cfg(unix)'.dependencies] fork = "0.1.18" diff --git a/distant-ssh2/Cargo.toml b/distant-ssh2/Cargo.toml index d9342f5..2afc1a2 100644 --- a/distant-ssh2/Cargo.toml +++ b/distant-ssh2/Cargo.toml @@ -10,6 +10,11 @@ repository = "https://github.com/chipsenkbeil/distant" readme = "README.md" license = "MIT OR Apache-2.0" +[features] +default = ["libssh", "ssh2"] +libssh = ["wezterm-ssh/libssh-rs", "wezterm-ssh/vendored-openssl-libssh-rs"] +ssh2 = ["wezterm-ssh/ssh2", "wezterm-ssh/vendored-openssl-ssh2"] + [dependencies] async-compat = "0.2.1" distant-core = { version = "=0.16.1", path = "../distant-core" } @@ -20,15 +25,7 @@ rpassword = "5.0.1" shell-words = "1.0" smol = "1.2" tokio = { version = "1.12.0", features = ["full"] } -wezterm-ssh = { version = "0.4.0", features = ["vendored-openssl"] } - -# Constrained to the last version of openssl that builds together with -# `openssl-sys = "=0.9.71"` which we are constrained to in libssh-rs used -# by wezterm-ssh until it switches back to openssl 3.x. -# https://github.com/sfackler/rust-openssl/issues/1630 -# https://github.com/sfackler/rust-openssl/pull/1578 -# https://github.com/wez/libssh-rs/blob/main/libssh-rs-sys/Cargo.toml -openssl = "=0.10.38" +wezterm-ssh = { version = "0.4.0", default-features = false } # Optional serde support for data structures serde = { version = "1.0.126", features = ["derive"], optional = true }