1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00
Commit graph

17 commits

Author SHA1 Message Date
Sylvestre Ledru
42339fe191
GNUMakefile: install libstdbuf (#8238)
Use external libstdbuf.so when building with make, as embedding the library
is only needed to work around "cargo install" limitations with shared libraries.

Also change default installation directory to /usr/local/libexec/coreutils/ for consistency
with GNU coreutils

Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
2025-06-30 09:17:31 +02:00
Daniel Hofstetter
7ead5121da Cargo.toml/config.toml: format files 2025-06-27 15:11:54 +02:00
Etienne Cordonnier
e1441eff2c GNUMakefile: install libstdbuf
Use external libstdbuf.so when building with make, as embedding the library
is only needed to work around "cargo install" limitations with shared libraries.

Also change default installation directory to /usr/local/libexec/coreutils/ for consistency
with GNU coreutils

Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
2025-06-22 23:30:34 +02:00
Etienne Cordonnier
99aa51a9a9 stdbuf: add feat_external_stdbuf
Fixes https://github.com/uutils/coreutils/issues/6591

 "feat_external_stdbuf": use an external libstdbuf.so for stdbuf instead of embedding it into
 the stdbuf binary.
 There are 2 use-cases:
 1. Installation of uutils-coreutils using cargo install (e.g. from crates.io
    which supports only "cargo install" as installation method).  In this case,
    installing libstdbuf.so is impossible, because "cargo install" installs
    only binary programs (no cdylib), thus libstdbuf.so must be embedded into
    stdbuf and written to /tmp at runtime.  This is a hack, and may not work
    on some platforms, e.g. because the SELinux permissions may not allow
    stdbuf to write to /tmp, /tmp may be read-only, libstdbuf.so may not work
    at all without SELinux labels, etc.

 2. Installation of uutils-coreutils using an external tool, e.g. dpkg/apt on
    debian. In this case, libstdbuf.so should be installed separately to its
    correct location and the environment variable LIBSTDBUF_PATH configures the
    installation path during the build. E.g. LIBSTDBUF_PATH="/lib/libstdbuf.so"

Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
2025-06-13 11:08:00 +02:00
Etienne Cordonnier
35634b46a0 stdbuf: fix cross-compilation
Summary:

Partial fix for https://github.com/uutils/coreutils/issues/6591

The current code declare libstdbuf as a build-dependency of stdbuf as a
workaround to enforce that libstdbuf is compiled before stdbuf. This breaks
cross-compilation, because build-dependencies were compiled for the host
architecture, and not for the target architecture.

The reason this workaround is necessary is that bindeps is available only in nightly at the moment:
https://rust-lang.github.io/rfcs/3028-cargo-binary-dependencies.html

This commit replaces the "build-dependency" workaround with another workaround:
calling cargo manually to build libstdbuf in the build.rs of stdbuf, in order to ensure that libstdbuf is built before stdbuf.

Changes:

- Removed cpp/cpp_build dependencies:

The cpp, cpp_build, and related dependencies were removed because they made cross-compilation in a build.rs file very complex, since you need
to pass proper CXX env variables for cross-compilation, whereas cross-compiling rust code using cargo is quite simple.
Provided Rust implementations for getting stdin, stdout, and stderr pointers.
Switched from C++/cpp macro-based initialization to using the Rust ctor crate for library initialization.

- Remove "feat_require_crate_cpp" which is not needed any more, since stdbuf was the only utility using the cpp crate.

Tests:

This commit fixes e.g. this test:
cross test --target aarch64-unknown-linux-gnu --features stdbuf test_stdbuf::test_libstdbuf_preload -- --nocapture

- The "i686" build of stdbuf was also broken (stdbuf 32 bits, but libstdbuf 64 bits) and test_stdbuf::test_libstdbuf_preload of the i686 builds in github CI serves as regression
test for this issue, no need to add a cross-rs test for aarch64.
- The x86_64 musl build of stdbuf was also broken and was passing tests in CI only because it was compiled with the wrong libc (glibc instead of musl)

Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
2025-06-02 10:55:57 +02:00
Daniel Hofstetter
5ead081bb3 Revert #7944 as some CI jobs fail
with "unrecognized command line option '-std=gnu17'"
2025-05-20 17:26:38 +02:00
Daniel Hofstetter
992e16221c .cargo/config.toml: set CFLAGS='-std=gnu17'
to make onig compile with GCC 15, which by default uses a newer C
standard (C23)
2025-05-19 11:17:59 +02:00
Daniel Hofstetter
12ab9c2c21 uucore: add crate_version macro 2025-03-15 16:03:16 +01:00
Justin Tracey
5994759560
move lints from rustflags to Cargo.toml
This prevents unnecessary rebuilds when mixing runs of `cargo clippy` and other
cargo commands (e.g., `cargo c && cargo clippy && cargo c` no longer rebuilds).
2024-09-29 14:14:15 -04:00
Dimitris Apostolou
8fcce6e2a5
cargo: fix feature = "cargo-clippy" deprecation 2024-02-28 14:51:23 +02:00
Daniel Hofstetter
744d94e630 cargo: rename "config" to "config.toml" 2024-02-07 09:15:04 +01:00
Kamil Ogórek
b056e29b06 lint: Enable clippy::if_not_else rule 2023-03-26 22:23:53 +02:00
Terts Diepraam
74b54074e1
deps: bump time from 0.3.17 to 0.3.20 (#4643) 2023-03-26 21:47:12 +02:00
Sylvestre Ledru
c810a5e051 be consistent in the rustflag declaration 2022-05-24 19:05:27 +02:00
Sylvestre Ledru
3a576f2441 time: Various fixes 2022-05-01 17:00:35 +02:00
Daniel Eades
4f8d1c5fcf add additional lints 2022-01-31 20:40:47 +01:00
Ian Douglas Scott
a23a8ed1f1
Add cross build targeting Redox to Travis CI 2017-12-08 21:03:59 -08:00