Skip to content

Instantly share code, notes, and snippets.

@konsolebox
Last active February 7, 2025 08:42
Show Gist options
  • Save konsolebox/02bb53cda0789840362c721ca9ce5ec3 to your computer and use it in GitHub Desktop.
Save konsolebox/02bb53cda0789840362c721ca9ce5ec3 to your computer and use it in GitHub Desktop.
inherit toolchain-funcs
tc-get-resource-dir() {
local compiler_type=$(tc-get-compiler-type)
case ${compiler_type} in
gcc)
$(tc-getCC) -print-search-dirs | \
awk '/^install: / { print $2; r = 1 } END { exit !r }' || die
;;
clang)
$(tc-getCC) -print-resource-dir || die
;;
*)
die "Unsupported compiler type: ${compiler_type}"
;;
esac
}
tc-get-include-dir() {
local resource_dir
resource_dir=$(tc-get-resource-dir) && echo "${resource_dir%/}/include"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment