diff options
| author | ruki <[email protected]> | 2024-09-24 13:32:58 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-09-24 13:32:58 +0800 |
| commit | 583f8e6944130e157ec85b8a975a76733b3eb775 (patch) | |
| tree | 2c5d72c487805f9866d37047282ca43e0bd8dd49 | |
| parent | eecce1911df33b8cd19455bff4f0da9c88c75f59 (diff) | |
| parent | 2a1220727a367e753b92131577ab0c2fd974bff8 (diff) | |
Merge pull request #5655 from rennsax/fix-configure
Fix platform compatibility for _os_find and _os_date functions
| -rwxr-xr-x | configure | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -243,11 +243,7 @@ _os_find() { local name="${2}" local depth="${3}" if test_nz "${depth}"; then - if is_host "macosx"; then - _ret=$(find "${dir}" -depth "${depth}" -type f -name "${name}") - else - _ret=$(find "${dir}" -maxdepth "${depth}" -mindepth "${depth}" -type f -name "${name}") - fi + _ret=$(find "${dir}" -maxdepth "${depth}" -mindepth "${depth}" -type f -name "${name}") else _ret=$(find "${dir}" -type f -name "${name}") fi @@ -259,10 +255,9 @@ _os_find() { _os_date() { if test_z "${SOURCE_DATE_EPOCH}"; then _ret=$(date +"${1}") - elif is_host "macosx" "freebsd" "bsd"; then - _ret=$(date -u -r "$SOURCE_DATE_EPOCH" +"${1}") else - _ret=$(date -u -d "@$SOURCE_DATE_EPOCH" +"${1}") + # Use GNU date options first, then fallback to BSD's, and finally fallback to current time. + _ret=$(date -u -d "@$SOURCE_DATE_EPOCH" +"${1}" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" +"${1}" 2>/dev/null || date +"${1}") fi } |
