[gnome-builder/gnome-builder-3-34] core: remap various architectures



commit fce4d6d2d977810b51d6d3f04f792ea60a7a5ec7
Author: Christian Hergert <chergert redhat com>
Date:   Tue Nov 5 10:09:38 2019 -0800

    core: remap various architectures
    
    We want to keep these consistent so that they map to external tooling no
    matter what the host system claims. We might need to do this in a couple
    other places in the future, but for now, given the design of Builder, this
    is probably the widest net to cast.
    
    Fixes #1061
    Fixes #1070

 src/libide/core/ide-global.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/src/libide/core/ide-global.c b/src/libide/core/ide-global.c
index 3546cfe8d..bd47b1432 100644
--- a/src/libide/core/ide-global.c
+++ b/src/libide/core/ide-global.c
@@ -177,16 +177,29 @@ ide_get_system_type (void)
 gchar *
 ide_get_system_arch (void)
 {
-  struct utsname u;
+  static GHashTable *remap;
   const char *machine;
+  struct utsname u;
 
   if (uname (&u) < 0)
     return g_strdup ("unknown");
 
-  /* config.sub doesn't accept amd64-OS */
-  machine = strcmp (u.machine, "amd64") ? u.machine : "x86_64";
+  if (g_once_init_enter (&remap))
+    {
+      GHashTable *mapping;
 
-  return g_strdup (machine);
+      mapping = g_hash_table_new (g_str_hash, g_str_equal);
+      g_hash_table_insert (mapping, (gchar *)"amd64", (gchar *)"x86_64");
+      g_hash_table_insert (mapping, (gchar *)"armv7l", (gchar *)"aarch64");
+      g_hash_table_insert (mapping, (gchar *)"i686", (gchar *)"i386");
+
+      g_once_init_leave (&remap, mapping);
+    }
+
+  if (g_hash_table_lookup_extended (remap, u.machine, NULL, (gpointer *)&machine))
+    return g_strdup (machine);
+  else
+    return g_strdup (u.machine);
 }
 
 gsize


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]