diff --git a/_build.sh b/_build.sh index ea1c48564..b121e88eb 100755 --- a/_build.sh +++ b/_build.sh @@ -1108,47 +1108,43 @@ build_single_target() { _CXXFLAGS_GLOBAL+=" -I${tmp}/include/c++/${_TRIPLET}" _CXXFLAGS_GLOBAL+=" -I${tmp}/include/c++/backward" fi - elif [ "${_HOST}" = 'linux' ] && [ "${_OS}" = 'linux' ] && [ "${unamem}" != "${_machine}" ]; then - if [ "${_CC}" = 'llvm' ]; then - if [ "${_CRT}" != 'musl' ]; then - _CFLAGS_GLOBAL+=" -isystem /usr/${_TRIPLETSH}/include" - _LDFLAGS_GLOBAL+=" -L/usr/${_TRIPLETSH}/lib" - if [ "${_CCRT}" = 'libgcc' ]; then - # https://packages.debian.org/testing/all/libgcc-13-dev-arm64-cross/filelist - # /usr/lib/gcc-cross/aarch64-linux-gnu/13/ - tmp="$(find "/usr/lib/gcc-cross/${_TRIPLETSH}" -mindepth 1 -maxdepth 1 -type d | head -n 1 || true)" - if [ -z "${tmp}" ]; then - >&2 echo '! Error: Failed to detect gcc-cross env root.' - exit 1 - fi - _LDFLAGS_GLOBAL+=" -L${tmp}" - fi + elif [ "${_HOST}" = 'linux' ] && [ "${_OS}" = 'linux' ] && [ "${unamem}" != "${_machine}" ] && [ "${_CRT}" != 'musl' ]; then + _CFLAGS_GLOBAL+=" -isystem /usr/${_TRIPLETSH}/include" + _LDFLAGS_GLOBAL+=" -L/usr/${_TRIPLETSH}/lib" + if [ "${_CCRT}" = 'libgcc' ]; then + # https://packages.debian.org/testing/all/libgcc-13-dev-arm64-cross/filelist + # /usr/lib/gcc-cross/aarch64-linux-gnu/13/ + tmp="$(find "/usr/lib/gcc-cross/${_TRIPLETSH}" -mindepth 1 -maxdepth 1 -type d | head -n 1 || true)" + if [ -z "${tmp}" ]; then + >&2 echo '! Error: Failed to detect gcc-cross env root.' + exit 1 fi + _LDFLAGS_GLOBAL+=" -L${tmp}" fi + fi - if [ "${_DISTRO}" = 'debian' ]; then - # https://packages.debian.org/testing/all/libstdc++-13-dev-arm64-cross/filelist - # /usr/aarch64-linux-gnu/include/c++/13/ - tmp="$(find "/usr/${_TRIPLETSH}/include/c++" -mindepth 1 -maxdepth 1 -type d | head -n 1 || true)" - if [ -n "${tmp}" ]; then - _CXXFLAGS_GLOBAL+=" -I${tmp}" - _CXXFLAGS_GLOBAL+=" -I${tmp}/${_TRIPLETSH}" - _CXXFLAGS_GLOBAL+=" -I${tmp}/backward" + if [ "${_HOST}" = 'linux' ] && [ "${_OS}" = 'linux' ] && [ "${unamem}" != "${_machine}" ] && [ "${_DISTRO}" = 'debian' ]; then + # https://packages.debian.org/testing/all/libstdc++-13-dev-arm64-cross/filelist + # /usr/aarch64-linux-gnu/include/c++/13/ + tmp="$(find "/usr/${_TRIPLETSH}/include/c++" -mindepth 1 -maxdepth 1 -type d | head -n 1 || true)" + if [ -n "${tmp}" ]; then + _CXXFLAGS_GLOBAL+=" -I${tmp}" + _CXXFLAGS_GLOBAL+=" -I${tmp}/${_TRIPLETSH}" + _CXXFLAGS_GLOBAL+=" -I${tmp}/backward" + else + # https://packages.debian.org/trixie/arm64/libstdc++-12-dev/filelist + # /usr/include/c++/12/algorithm + # /usr/include/aarch64-linux-gnu/c++/12/ext/opt_random.h + tmp1="$(find "/usr/include/c++" -mindepth 1 -maxdepth 1 -type d | head -n 1 || true)" + tmp2="$(find "/usr/include/${_TRIPLETSH}/c++" -mindepth 1 -maxdepth 1 -type d | head -n 1 || true)" + if [ -n "${tmp1}" ] && \ + [ -n "${tmp2}" ]; then + _CXXFLAGS_GLOBAL+=" -I${tmp1}" + _CXXFLAGS_GLOBAL+=" -I${tmp2}" + _CXXFLAGS_GLOBAL+=" -I${tmp1}/backward" else - # https://packages.debian.org/trixie/arm64/libstdc++-12-dev/filelist - # /usr/include/c++/12/algorithm - # /usr/include/aarch64-linux-gnu/c++/12/ext/opt_random.h - tmp1="$(find "/usr/include/c++" -mindepth 1 -maxdepth 1 -type d | head -n 1 || true)" - tmp2="$(find "/usr/include/${_TRIPLETSH}/c++" -mindepth 1 -maxdepth 1 -type d | head -n 1 || true)" - if [ -n "${tmp1}" ] && \ - [ -n "${tmp2}" ]; then - _CXXFLAGS_GLOBAL+=" -I${tmp1}" - _CXXFLAGS_GLOBAL+=" -I${tmp2}" - _CXXFLAGS_GLOBAL+=" -I${tmp1}/backward" - else - >&2 echo '! Error: Failed to detect g++-cross env root.' - exit 1 - fi + >&2 echo '! Error: Failed to detect g++-cross env root.' + exit 1 fi fi fi