From d09f351cba0f30839a22bcf0847dc4d3d39cb3d0 Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Fri, 15 May 2026 19:17:46 +0900 Subject: [PATCH] date: fix build for cygwin --- .github/workflows/make.yml | 2 +- src/uu/date/src/locale.rs | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index f8ed24d16..f96de558b 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -303,7 +303,7 @@ jobs: run: | set -x pacman -Sy --noconfirm --needed make rust base-devel - DESTDIR=/tmp/c make install PROG_PREFIX=uu- PROFILE=release-small COMPLETIONS=n MANPAGES=n LOCALES=n SKIP_UTILS=date # FIXME: build date + DESTDIR=/tmp/c make install PROG_PREFIX=uu- PROFILE=release-small COMPLETIONS=n MANPAGES=n LOCALES=n # Check that utils are built with given profile ./target/release-small/true # Check that the progs have prefix diff --git a/src/uu/date/src/locale.rs b/src/uu/date/src/locale.rs index 109583123..ed6ec0a8a 100644 --- a/src/uu/date/src/locale.rs +++ b/src/uu/date/src/locale.rs @@ -12,7 +12,7 @@ macro_rules! cfg_langinfo { ($($item:item)*) => { $( - #[cfg(all(unix, not(target_os = "android"), not(target_os = "redox")))] + #[cfg(all(unix, not(target_os = "android"), not(target_os = "cygwin"), not(target_os = "redox")))] $item )* } @@ -27,9 +27,9 @@ cfg_langinfo! { /// glibc's `_DATE_FMT` has been stable for the last 12 years /// being added upstream to libc TODO: update to libc - #[cfg(target_os = "linux")] + #[cfg(any(target_os = "linux", target_os = "cygwin"))] const DATE_FMT: libc::nl_item = 0x2006c; - #[cfg(not(target_os = "linux"))] + #[cfg(not(any(target_os = "linux", target_os = "cygwin")))] const DATE_FMT: libc::nl_item = libc::D_T_FMT; } @@ -110,7 +110,12 @@ cfg_langinfo! { } /// On platforms without nl_langinfo support, use 24-hour format by default -#[cfg(any(not(unix), target_os = "android", target_os = "redox"))] +#[cfg(any( + not(unix), + target_os = "android", + target_os = "cygwin", + target_os = "redox" +))] pub fn get_locale_default_format() -> &'static str { "%a %b %e %X %Z %Y" }