int fatso_guess_toolchain(struct fatso* f, struct fatso_package* p, struct fatso_toolchain* out_toolchain) { if( p->toolchain != NULL ){ fatso_logf(f, FATSO_LOG_INFO, "Using explicitly provided toolchain '%s'.", p->toolchain ); // TODO: optionally set this to p->toolchain out_toolchain->name = "[config provided]"; out_toolchain->build = &build_provided_toolchain; out_toolchain->install = &install_provided_toolchain; return 0; // we found the toolchain } char* path = fatso_package_build_path(f, p); bool found = false; for (const struct init_named_toolchain* i = named_toolchains; i->name; ++i) { if (i->guess(path)) { found = true; i->init(out_toolchain); } } fatso_free(path); if (!found) { fatso_logf(f, FATSO_LOG_FATAL, "Fatso couldn't guess the toolchain of package '%s', and none was explicitly defined!", p->name); return 1; } return 0; }
int fatso_guess_toolchain(struct fatso* f, struct fatso_package* p, struct fatso_toolchain* out_toolchain) { // TODO: Use 'toolchain' option in package. char* path = fatso_package_build_path(f, p); bool found = false; for (const struct init_named_toolchain* i = named_toolchains; i->name; ++i) { if (i->guess(path)) { found = true; i->init(out_toolchain); } } fatso_free(path); if (!found) { fatso_logf(f, FATSO_LOG_FATAL, "Fatso couldn't guess the toolchain of package '%s', and none was explicitly defined!", p->name); return 1; } return 0; }