Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,31 @@ _os_iorunv() {
}

# find file in the given directory
# e.g. _os_find . xmake.sh
# e.g. _os_find . xmake.sh [depth]
_os_find() {
local dir="${1}"
local name="${2}"
local depth="${3}"
if test_nz "${depth}"; then
_ret=$(find "${dir}" -maxdepth "${depth}" -mindepth "${depth}" -type f -name "${name}" | LC_ALL=C sort)
# Solaris doesn't support -maxdepth, use shell to filter depth
if is_host "solaris"; then
_ret=""
local file=""
for file in $(find "${dir}" -type f -name "${name}" | LC_ALL=C sort); do
local relpath="${file#${dir}/}"
local slash_count=$(echo "${relpath}" | tr -cd '/' | wc -c | tr -d ' ')
if test "${slash_count}" = "$((${depth} - 1))"; then
if test -z "${_ret}"; then
_ret="${file}"
else
_ret="${_ret}
${file}"
fi
fi
done
else
_ret=$(find "${dir}" -maxdepth "${depth}" -mindepth "${depth}" -type f -name "${name}" | LC_ALL=C sort)
fi
else
_ret=$(find "${dir}" -type f -name "${name}" | LC_ALL=C sort)
fi
Expand Down Expand Up @@ -2800,7 +2818,8 @@ _load_options_and_toolchains() {
includes "${file}"
else
# include all xmake.sh files in next sub-directories
local files=`find ${xmake_sh_projectdir} -maxdepth 2 -mindepth 2 -name "xmake.sh"`
_os_find "${xmake_sh_projectdir}" "xmake.sh" "2"
local files="${_ret}"
for file in ${files}; do
includes "${file}"
done
Expand Down
Loading