Skip to content

Commit

Permalink
Merge pull request #5655 from rennsax/fix-configure
Browse files Browse the repository at this point in the history
Fix platform compatibility for _os_find and _os_date functions
  • Loading branch information
waruqi authored Sep 24, 2024
2 parents eecce19 + 2a12207 commit 583f8e6
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

Expand Down

0 comments on commit 583f8e6

Please sign in to comment.