This function figures out which architecture the build environment has -
which might not be the same as the requested architecture.
*/
-const char* pakfire_arch_supported_by_host(const char* name) {
+static const char* pakfire_arch_is_natively_supported_by_host(const char* name) {
if (!name) {
errno = EINVAL;
return NULL;
return name;
// Not supported
- errno = ENOTSUP;
+ return NULL;
+}
+
+const char* pakfire_arch_is_supported_by_host(const char* name) {
+ const char* arch = NULL;
+
+ // Check if we natively support this architecture
+ arch = pakfire_arch_is_natively_supported_by_host(name);
+ if (arch)
+ return arch;
+
+ // Otherwise check if we have an interpreter
+ char* interpreter = pakfire_arch_find_interpreter(name);
+ if (interpreter) {
+ free(interpreter);
+
+ return name;
+ }
+
+ // Otherwise this architecture is not supported
return NULL;
}
// If the host supports this architecture natively,
// we do not need to search for the interpreter
- if (pakfire_arch_supported_by_host(name))
+ if (pakfire_arch_is_natively_supported_by_host(name))
goto ERROR;
const struct pakfire_arch* arch = pakfire_arch_find(name);
const char* pakfire_arch_platform(const char* name);
int pakfire_arch_is_compatible(const char* name, const char* compatible_arch);
-const char* pakfire_arch_supported_by_host(const char* name);
+const char* pakfire_arch_is_supported_by_host(const char* name);
char* pakfire_arch_find_interpreter(const char* name);
#endif
}
// Enable all CPU features that CPU has to offer
- if (!pakfire_arch_supported_by_host(arch)) {
+ if (!pakfire_arch_is_supported_by_host(arch)) {
r = pakfire_jail_set_env(j, "QEMU_CPU", "max");
if (r)
goto ERROR;
goto ERROR;
// Determine the effective architecture
- p->arches.effective = pakfire_arch_supported_by_host(arch);
+ p->arches.effective = pakfire_arch_is_supported_by_host(arch);
if (!p->arches.effective) {
ERROR(p, "Unsupported architecture: %s\n", arch);
r = errno;