mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
Allow compiling uucore
with wasm32-unknown-unknown
(#7840)
and fix the build
This commit is contained in:
parent
d3a2db415c
commit
c8dbd185c0
4 changed files with 20 additions and 7 deletions
18
.github/workflows/CICD.yml
vendored
18
.github/workflows/CICD.yml
vendored
|
@ -513,7 +513,7 @@ jobs:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
job:
|
job:
|
||||||
# - { os , target , cargo-options , features , use-cross , toolchain, skip-tests, workspace-tests }
|
# - { os , target , cargo-options , default-features, features , use-cross , toolchain, skip-tests, workspace-tests, skip-package, skip-publish }
|
||||||
- { os: ubuntu-latest , target: arm-unknown-linux-gnueabihf , features: feat_os_unix_gnueabihf , use-cross: use-cross , skip-tests: true }
|
- { os: ubuntu-latest , target: arm-unknown-linux-gnueabihf , features: feat_os_unix_gnueabihf , use-cross: use-cross , skip-tests: true }
|
||||||
- { os: ubuntu-24.04-arm , target: aarch64-unknown-linux-gnu , features: feat_os_unix_gnueabihf }
|
- { os: ubuntu-24.04-arm , target: aarch64-unknown-linux-gnu , features: feat_os_unix_gnueabihf }
|
||||||
- { os: ubuntu-latest , target: aarch64-unknown-linux-musl , features: feat_os_unix , use-cross: use-cross , skip-tests: true }
|
- { os: ubuntu-latest , target: aarch64-unknown-linux-musl , features: feat_os_unix , use-cross: use-cross , skip-tests: true }
|
||||||
|
@ -524,13 +524,14 @@ jobs:
|
||||||
- { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: "feat_os_unix,uudoc" , use-cross: no, workspace-tests: true }
|
- { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: "feat_os_unix,uudoc" , use-cross: no, workspace-tests: true }
|
||||||
- { os: ubuntu-latest , target: x86_64-unknown-linux-musl , features: feat_os_unix , use-cross: use-cross }
|
- { os: ubuntu-latest , target: x86_64-unknown-linux-musl , features: feat_os_unix , use-cross: use-cross }
|
||||||
- { os: ubuntu-latest , target: x86_64-unknown-redox , features: feat_os_unix_redox , use-cross: redoxer , skip-tests: true }
|
- { os: ubuntu-latest , target: x86_64-unknown-redox , features: feat_os_unix_redox , use-cross: redoxer , skip-tests: true }
|
||||||
|
- { os: ubuntu-latest , target: wasm32-unknown-unknown , default-features: false, features: uucore/format, skip-tests: true, skip-package: true, skip-publish: true }
|
||||||
- { os: macos-latest , target: aarch64-apple-darwin , features: feat_os_macos, workspace-tests: true } # M1 CPU
|
- { os: macos-latest , target: aarch64-apple-darwin , features: feat_os_macos, workspace-tests: true } # M1 CPU
|
||||||
- { os: macos-13 , target: x86_64-apple-darwin , features: feat_os_macos, workspace-tests: true }
|
- { os: macos-13 , target: x86_64-apple-darwin , features: feat_os_macos, workspace-tests: true }
|
||||||
- { os: windows-latest , target: i686-pc-windows-msvc , features: feat_os_windows }
|
- { os: windows-latest , target: i686-pc-windows-msvc , features: feat_os_windows }
|
||||||
# TODO: Re-enable after rust-onig release: https://github.com/rust-onig/rust-onig/issues/193
|
# TODO: Re-enable after rust-onig release: https://github.com/rust-onig/rust-onig/issues/193
|
||||||
# - { os: windows-latest , target: x86_64-pc-windows-gnu , features: feat_os_windows }
|
# - { os: windows-latest , target: x86_64-pc-windows-gnu , features: feat_os_windows }
|
||||||
- { os: windows-latest , target: x86_64-pc-windows-msvc , features: feat_os_windows }
|
- { os: windows-latest , target: x86_64-pc-windows-msvc , features: feat_os_windows }
|
||||||
- { os: windows-latest , target: aarch64-pc-windows-msvc , features: feat_os_windows, use-cross: use-cross , skip-tests: true }
|
- { os: windows-latest , target: aarch64-pc-windows-msvc , features: feat_os_windows, use-cross: use-cross , skip-tests: true }
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
|
@ -620,6 +621,10 @@ jobs:
|
||||||
CARGO_FEATURES_OPTION='' ;
|
CARGO_FEATURES_OPTION='' ;
|
||||||
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features=${{ matrix.job.features }}' ; fi
|
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features=${{ matrix.job.features }}' ; fi
|
||||||
outputs CARGO_FEATURES_OPTION
|
outputs CARGO_FEATURES_OPTION
|
||||||
|
# * CARGO_DEFAULT_FEATURES_OPTION
|
||||||
|
CARGO_DEFAULT_FEATURES_OPTION='' ;
|
||||||
|
if [ "${{ matrix.job.default-features }}" == "false" ]; then CARGO_DEFAULT_FEATURES_OPTION='--no-default-features' ; fi
|
||||||
|
outputs CARGO_DEFAULT_FEATURES_OPTION
|
||||||
# * CARGO_CMD
|
# * CARGO_CMD
|
||||||
CARGO_CMD='cross'
|
CARGO_CMD='cross'
|
||||||
CARGO_CMD_OPTIONS='+${{ env.RUST_MIN_SRV }}'
|
CARGO_CMD_OPTIONS='+${{ env.RUST_MIN_SRV }}'
|
||||||
|
@ -753,20 +758,20 @@ jobs:
|
||||||
# dependencies
|
# dependencies
|
||||||
echo "## dependency list"
|
echo "## dependency list"
|
||||||
cargo fetch --locked --quiet
|
cargo fetch --locked --quiet
|
||||||
cargo tree --locked --target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} --no-dedupe -e=no-dev --prefix=none | grep -vE "$PWD" | sort --unique
|
cargo tree --locked --target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} ${{ steps.vars.outputs.CARGO_DEFAULT_FEATURES_OPTION }} --no-dedupe -e=no-dev --prefix=none | grep -vE "$PWD" | sort --unique
|
||||||
- name: Build
|
- name: Build
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
## Build
|
## Build
|
||||||
${{ steps.vars.outputs.CARGO_CMD }} ${{ steps.vars.outputs.CARGO_CMD_OPTIONS }} build --release \
|
${{ steps.vars.outputs.CARGO_CMD }} ${{ steps.vars.outputs.CARGO_CMD_OPTIONS }} build --release \
|
||||||
--target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }}
|
--target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} ${{ steps.vars.outputs.CARGO_DEFAULT_FEATURES_OPTION }}
|
||||||
- name: Test
|
- name: Test
|
||||||
if: matrix.job.skip-tests != true
|
if: matrix.job.skip-tests != true
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
## Test
|
## Test
|
||||||
${{ steps.vars.outputs.CARGO_CMD }} ${{ steps.vars.outputs.CARGO_CMD_OPTIONS }} test --target=${{ matrix.job.target }} \
|
${{ steps.vars.outputs.CARGO_CMD }} ${{ steps.vars.outputs.CARGO_CMD_OPTIONS }} test --target=${{ matrix.job.target }} \
|
||||||
${{ steps.vars.outputs.CARGO_TEST_OPTIONS}} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }}
|
${{ steps.vars.outputs.CARGO_TEST_OPTIONS}} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} ${{ steps.vars.outputs.CARGO_DEFAULT_FEATURES_OPTION }}
|
||||||
env:
|
env:
|
||||||
RUST_BACKTRACE: "1"
|
RUST_BACKTRACE: "1"
|
||||||
- name: Test individual utilities
|
- name: Test individual utilities
|
||||||
|
@ -784,6 +789,7 @@ jobs:
|
||||||
name: ${{ env.PROJECT_NAME }}-${{ matrix.job.target }}${{ steps.vars.outputs.ARTIFACTS_SUFFIX }}
|
name: ${{ env.PROJECT_NAME }}-${{ matrix.job.target }}${{ steps.vars.outputs.ARTIFACTS_SUFFIX }}
|
||||||
path: target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}
|
path: target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}
|
||||||
- name: Package
|
- name: Package
|
||||||
|
if: matrix.job.skip-package != true
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
## Package artifact(s)
|
## Package artifact(s)
|
||||||
|
@ -819,7 +825,7 @@ jobs:
|
||||||
fi
|
fi
|
||||||
- name: Publish
|
- name: Publish
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
if: steps.vars.outputs.DEPLOY
|
if: steps.vars.outputs.DEPLOY && matrix.job.skip-publish != true
|
||||||
with:
|
with:
|
||||||
draft: true
|
draft: true
|
||||||
files: |
|
files: |
|
||||||
|
|
|
@ -21,7 +21,12 @@ path = "src/dd.rs"
|
||||||
clap = { workspace = true }
|
clap = { workspace = true }
|
||||||
gcd = { workspace = true }
|
gcd = { workspace = true }
|
||||||
libc = { workspace = true }
|
libc = { workspace = true }
|
||||||
uucore = { workspace = true, features = ["format", "parser", "quoting-style"] }
|
uucore = { workspace = true, features = [
|
||||||
|
"format",
|
||||||
|
"parser",
|
||||||
|
"quoting-style",
|
||||||
|
"fs",
|
||||||
|
] }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
|
|
||||||
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
|
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
|
||||||
|
|
|
@ -24,6 +24,7 @@ pub use uucore_procs::*;
|
||||||
// * cross-platform modules
|
// * cross-platform modules
|
||||||
pub use crate::mods::display;
|
pub use crate::mods::display;
|
||||||
pub use crate::mods::error;
|
pub use crate::mods::error;
|
||||||
|
#[cfg(feature = "fs")]
|
||||||
pub use crate::mods::io;
|
pub use crate::mods::io;
|
||||||
pub use crate::mods::line_ending;
|
pub use crate::mods::line_ending;
|
||||||
pub use crate::mods::os;
|
pub use crate::mods::os;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
pub mod display;
|
pub mod display;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
|
#[cfg(feature = "fs")]
|
||||||
pub mod io;
|
pub mod io;
|
||||||
pub mod line_ending;
|
pub mod line_ending;
|
||||||
pub mod os;
|
pub mod os;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue