Skip to content

Commit d09f351

Browse files
oech3cakebaker
authored andcommitted
date: fix build for cygwin
1 parent 40c36f6 commit d09f351

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

.github/workflows/make.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ jobs:
303303
run: |
304304
set -x
305305
pacman -Sy --noconfirm --needed make rust base-devel
306-
DESTDIR=/tmp/c make install PROG_PREFIX=uu- PROFILE=release-small COMPLETIONS=n MANPAGES=n LOCALES=n SKIP_UTILS=date # FIXME: build date
306+
DESTDIR=/tmp/c make install PROG_PREFIX=uu- PROFILE=release-small COMPLETIONS=n MANPAGES=n LOCALES=n
307307
# Check that utils are built with given profile
308308
./target/release-small/true
309309
# Check that the progs have prefix

src/uu/date/src/locale.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
macro_rules! cfg_langinfo {
1313
($($item:item)*) => {
1414
$(
15-
#[cfg(all(unix, not(target_os = "android"), not(target_os = "redox")))]
15+
#[cfg(all(unix, not(target_os = "android"), not(target_os = "cygwin"), not(target_os = "redox")))]
1616
$item
1717
)*
1818
}
@@ -27,9 +27,9 @@ cfg_langinfo! {
2727

2828
/// glibc's `_DATE_FMT` has been stable for the last 12 years
2929
/// being added upstream to libc TODO: update to libc
30-
#[cfg(target_os = "linux")]
30+
#[cfg(any(target_os = "linux", target_os = "cygwin"))]
3131
const DATE_FMT: libc::nl_item = 0x2006c;
32-
#[cfg(not(target_os = "linux"))]
32+
#[cfg(not(any(target_os = "linux", target_os = "cygwin")))]
3333
const DATE_FMT: libc::nl_item = libc::D_T_FMT;
3434
}
3535

@@ -110,7 +110,12 @@ cfg_langinfo! {
110110
}
111111

112112
/// On platforms without nl_langinfo support, use 24-hour format by default
113-
#[cfg(any(not(unix), target_os = "android", target_os = "redox"))]
113+
#[cfg(any(
114+
not(unix),
115+
target_os = "android",
116+
target_os = "cygwin",
117+
target_os = "redox"
118+
))]
114119
pub fn get_locale_default_format() -> &'static str {
115120
"%a %b %e %X %Z %Y"
116121
}

0 commit comments

Comments
 (0)