Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ jobs:
- aarch64-apple-darwin
- x86_64-pc-windows-msvc
- aarch64-pc-windows-msvc
- x86_64-linux-android
- aarch64-linux-android
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-24.04
Expand Down Expand Up @@ -92,6 +94,16 @@ jobs:
echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
vcpkg install openssl:arm64-windows-static-md

- target: x86_64-linux-android
os: ubuntu-24.04
name: trunk-x86_64-linux-android-termux.tar.gz
cross: "true"
args: --features termux,vendored
- target: aarch64-linux-android
os: ubuntu-24.04
name: trunk-aarch64-linux-android-termux.tar.gz
cross: "true"
args: --features termux,vendored
runs-on: ${{ matrix.os }}

steps:
Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,6 @@ update_check = ["crates_io_api"]

# enable vendoring on crates supporting that
vendored = ["openssl?/vendored"]

# enable android target for termux
termux = []
5 changes: 5 additions & 0 deletions Cross.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ pre-build = [
"dpkg --add-architecture $CROSS_DEB_ARCH",
"apt-get update && apt-get install --assume-yes libssl-dev:$CROSS_DEB_ARCH libssl-dev"
]
[target.x86_64-linux-android]
image = "ghcr.io/cross-rs/x86_64-linux-android:edge"

[target.aarch64-linux-android]
image = "ghcr.io/cross-rs/aarch64-linux-android:edge"
5 changes: 4 additions & 1 deletion src/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ use std::{
path::{Component, Path, PathBuf},
process::Stdio,
};
use tokio::{fs, process::Command};
use tokio::process::Command;
#[cfg(not(all(target_os = "android", feature = "termux")))]
use tokio::fs;

pub static BUILDING: Emoji = Emoji("📦 ", "");
pub static SUCCESS: Emoji = Emoji("✅ ", "");
Expand Down Expand Up @@ -127,6 +129,7 @@ pub async fn path_exists_and(
}

/// Check whether a given path exists, is a file and marked as executable.
#[cfg(not(all(target_os = "android", feature = "termux")))]
pub async fn is_executable(path: impl AsRef<Path>) -> Result<bool> {
#[cfg(unix)]
let has_executable_flag = |meta: Metadata| {
Expand Down
12 changes: 8 additions & 4 deletions src/config/models/hook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ impl Hook {
&& let Some(cfg) = self.overrides.macos.as_ref()
{
return &cfg.command;
} else if cfg!(target_os = "linux")
&& let Some(cfg) = self.overrides.linux.as_ref()
} else if cfg!(any(
target_os = "linux",
all(target_os = "android", feature = "termux")
)) && let Some(cfg) = self.overrides.linux.as_ref()
{
return &cfg.command;
}
Expand All @@ -47,8 +49,10 @@ impl Hook {
&& let Some(cfg) = self.overrides.macos.as_ref()
{
return &cfg.command_arguments;
} else if cfg!(target_os = "linux")
&& let Some(cfg) = self.overrides.linux.as_ref()
} else if cfg!(any(
target_os = "linux",
all(target_os = "android", feature = "termux")
)) && let Some(cfg) = self.overrides.linux.as_ref()
{
return &cfg.command_arguments;
}
Expand Down
30 changes: 24 additions & 6 deletions src/config/rt/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,18 @@ pub struct RtcBuild {
/// `pattern_script` and `pattern_preload`.
pub pattern_params: HashMap<String, String>,
/// Optional root certificate chain for use when downloading dependencies.
#[cfg(any(feature = "native-tls", feature = "rustls"))]
#[cfg(all(
any(feature = "native-tls", feature = "rustls"),
not(all(target_os = "android", feature = "termux"))
))]
pub root_certificate: Option<PathBuf>,
/// Sets if reqwest is allowed to ignore certificate validation errors (defaults to false).
///
/// **WARNING**: Setting this to true can make you vulnerable to man-in-the-middle attacks. Sometimes this is necessary when working behind corporate proxies.
#[cfg(any(feature = "native-tls", feature = "rustls"))]
#[cfg(all(
any(feature = "native-tls", feature = "rustls"),
not(all(target_os = "android", feature = "termux"))
))]
pub accept_invalid_certs: bool,
/// Control minification
pub minify: Minify,
Expand Down Expand Up @@ -213,9 +219,15 @@ impl RtcBuild {
offline: build.offline,
frozen: build.frozen,
locked: build.locked,
#[cfg(any(feature = "native-tls", feature = "rustls"))]
#[cfg(all(
any(feature = "native-tls", feature = "rustls"),
not(all(target_os = "android", feature = "termux"))
))]
root_certificate: build.root_certificate.map(PathBuf::from),
#[cfg(any(feature = "native-tls", feature = "rustls"))]
#[cfg(all(
any(feature = "native-tls", feature = "rustls"),
not(all(target_os = "android", feature = "termux"))
))]
accept_invalid_certs: build.accept_invalid_certs,
minify: build.minify,
no_sri: build.no_sri,
Expand Down Expand Up @@ -285,9 +297,15 @@ impl RtcBuild {
/// Build [`HttpClientOptions`] options form configuration.
pub fn client_options(&self) -> HttpClientOptions {
HttpClientOptions {
#[cfg(any(feature = "native-tls", feature = "rustls"))]
#[cfg(all(
any(feature = "native-tls", feature = "rustls"),
not(all(target_os = "android", feature = "termux"))
))]
root_certificate: self.root_certificate.clone(),
#[cfg(any(feature = "native-tls", feature = "rustls"))]
#[cfg(all(
any(feature = "native-tls", feature = "rustls"),
not(all(target_os = "android", feature = "termux"))
))]
accept_invalid_certificates: self.accept_invalid_certs,
}
}
Expand Down
Loading