diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index 917ee713826..8a8aca21036 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -266,6 +266,40 @@ jobs: # 2. the makefile doesn't try to install libstdbuf even though stdbuf is skipped DESTDIR=/tmp/ make SKIP_UTILS="stdbuf" install + # keep this job minimal to avoid have many duplicated build with CICD + build_makefile-other: + name: Build/Makefile + runs-on: ${{ matrix.job.os }} + env: + CARGO_INCREMENTAL: 0 + strategy: + fail-fast: false + matrix: + job: + - { os: windows-latest , features: feat_os_windows } + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + - uses: Swatinem/rust-cache@v2 + - name: Run sccache-cache + id: sccache-setup + uses: mozilla-actions/sccache-action@v0.0.9 + continue-on-error: true + - name: Export sccache + if: steps.sccache-setup.outcome == 'success' + run: | + echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV + echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + - name: "`make build`" + shell: bash + run: | + set -x + # Check that we exclude unix programs to avoid build failure + make PREFIX=/tmp/usr MULTICALL=y COMPLETIONS=n MANPAGES=n LOCALES=n \ + SKIP_UTILS="arch b2sum base32 base64 basename basenc cat cksum comm cp csplit cut date dd df dir dircolors dirname du echo env expand expr factor false fmt fold head hostname join link ln ls md5sum mkdir mktemp more mv nl nproc numfmt od paste pr printenv printf ptx pwd readlink realpath rm rmdir seq sha1sum sha224sum sha256sum sha384sum sha512sum shred shuf sleep sort split sum sync tac tail tee test touch tr truncate tsort uname unexpand uniq unlink vdir wc whoami yes" + target/debug/coreutils.exe true + test_busybox: name: Tests/BusyBox test suite runs-on: ${{ matrix.job.os }} diff --git a/GNUmakefile b/GNUmakefile index ae266b6c277..a99fefa46ec 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -62,44 +62,31 @@ TOYBOX_ROOT := $(BASEDIR)/tmp TOYBOX_VER := 0.8.12 TOYBOX_SRC := $(TOYBOX_ROOT)/toybox-$(TOYBOX_VER) -#------------------------------------------------------------------------ -# Detect the host system. -# On Windows uname -s might return MINGW_NT-* or CYGWIN_NT-*. -# Otherwise let it default to the kernel name returned by uname -s -# (Linux, Darwin, FreeBSD, …). -#------------------------------------------------------------------------ -OS ?= $(shell uname -s) +# Detect the target system +# See https://doc.rust-lang.org/beta/rustc/platform-support.html +# todo: support building wasm +OS := $(or $(CARGO_BUILD_TARGET),$(shell rustc --print host-tuple)) # Windows does not allow symlink by default. # Allow to override LN for AppArmor. -ifneq (,$(findstring _NT,$(OS))) +ifneq (,$(findstring windows,$(OS))) LN ?= ln -f endif LN ?= ln -sf -# Possible programs -PROGS := \ - $(shell sed -n '/feat_Tier1 = \[/,/\]/p' Cargo.toml | sed '1d;2d' |tr -d '],"\n')\ - $(shell sed -n '/feat_common_core = \[/,/\]/p' Cargo.toml | sed '1d' |tr -d '],"\n') - -UNIX_PROGS := \ - $(shell sed -n '/feat_require_unix_core = \[/,/\]/p' Cargo.toml | sed '1d' |tr -d '],"\n') \ - hostid \ - pinky \ - stdbuf \ - uptime \ - users \ - who - SELINUX_PROGS := \ chcon \ runcon $(info Detected OS = $(OS)) -ifeq (,$(findstring MINGW,$(OS))) - PROGS += $(UNIX_PROGS) +ifeq (,$(findstring windows,$(OS))) + FEATURE_EXTRACT_UTILS := feat_os_unix +else + FEATURE_EXTRACT_UTILS := feat_Tier1 endif +PROGS := $(shell cargo tree --depth 1 --features $(FEATURE_EXTRACT_UTILS) --format "{p}" --prefix none | sed -E -n 's/^uu_([^ ]+).*/\1/p') + ifeq ($(SELINUX_ENABLED),1) PROGS += $(SELINUX_PROGS) endif @@ -114,7 +101,7 @@ endif # Programs with usable tests TESTS := \ - $(sort $(filter $(UTILS),$(PROGS) $(UNIX_PROGS) $(SELINUX_PROGS))) + $(sort $(filter $(UTILS),$(PROGS) $(SELINUX_PROGS))) TEST_NO_FAIL_FAST := TEST_SPEC_FEATURE := @@ -288,7 +275,7 @@ install: build install-manpages install-completions install-locales mkdir -p $(INSTALLDIR_BIN) ifneq (,$(and $(findstring stdbuf,$(UTILS)),$(findstring feat_external_libstdbuf,$(CARGOFLAGS)))) mkdir -p $(DESTDIR)$(LIBSTDBUF_DIR) -ifneq (,$(findstring CYGWIN,$(OS))) +ifneq (,$(findstring cygwin,$(OS))) $(INSTALL) -m 755 $(BUILDDIR)/deps/stdbuf.dll $(DESTDIR)$(LIBSTDBUF_DIR)/libstdbuf.dll else $(INSTALL) -m 755 $(BUILDDIR)/deps/libstdbuf.* $(DESTDIR)$(LIBSTDBUF_DIR)/ @@ -308,7 +295,7 @@ else endif uninstall: -ifeq (,$(findstring MINGW,$(OS))) +ifeq (,$(findstring windows,$(OS))) rm -f $(DESTDIR)$(LIBSTDBUF_DIR)/libstdbuf.* -rm -d $(DESTDIR)$(LIBSTDBUF_DIR) 2>/dev/null || true endif