Opened 3 years ago

Closed 3 years ago

#63358 closed defect (worksforme)

glib2 @2.65.0: extra bit added on to universal.patch

Reported by: kencu (Ken) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: glib2, glib2-devel

Description (last modified by kencu (Ken))

While looking over the recent glib2 update, and considering the glib 2.67 update to come, I noticed this bit added onto universal.patch:

--- meson.build.orig	2019-11-17 14:26:49.000000000 -0300
+++ meson.build	2019-11-17 14:27:32.000000000 -0300
@@ -1584,17 +1584,9 @@
   glibconfig_conf.set(d[1], val)
 endforeach
 
-# We need a more robust approach here...
 host_cpu_family = host_machine.cpu_family()
-if host_cpu_family == 'x86' or host_cpu_family == 'x86_64' or host_cpu_family == 's390' or host_cpu_family == 's390x' or host_cpu_family.startswith('arm') or host_cpu_family == 'aarch64' or host_cpu_family.startswith('crisv32') or host_cpu_family.startswith('etrax')
-  glib_memory_barrier_needed = false
-elif host_cpu_family.startswith('sparc') or host_cpu_family.startswith('alpha') or host_cpu_family.startswith('powerpc') or host_cpu_family == 'ia64'
-  glib_memory_barrier_needed = true
-else
-  warning('Unknown host cpu: ' + host_cpu_family)
-  glib_memory_barrier_needed = true
-endif
-glibconfig_conf.set('G_ATOMIC_OP_MEMORY_BARRIER_NEEDED', glib_memory_barrier_needed)
+glib_is_powerpc = '#if (defined(__PPC__) || defined(__PPC64__) || defined(__powerpc__) || defined(__powerpc64__) || defined(_ARCH_PPC)  || defined(_ARCH_PPC64))\n#ifdef G_ATOMIC_OP_MEMORY_BARRIER_NEEDED\n#undef G_ATOMIC_OP_MEMORY_BARRIER_NEEDED\n#endif\n#define G_ATOMIC_OP_MEMORY_BARRIER_NEEDED 1\n#else\n#ifdef G_ATOMIC_OP_MEMORY_BARRIER_NEEDED\n#undef G_ATOMIC_OP_MEMORY_BARRIER_NEEDED\n#endif\n#endif'
+glibconfig_conf.set('glib_is_powerpc', glib_is_powerpc)
 
 # We need to decide at configure time if GLib will use real atomic
 # operations ("lock free") or emulated ones with a mutex.  This is

This was all done a few years ago, I note, as the update to glib2 has been in the works for a while.

This patch may well be correct -- it probably is, as all the tests work out well on 10.4 PPC to BigSur -- but even if so, it should be probably moved out of universal.patch and put into it's own separate patchfile so we don't lose track of it, and what it is supposed to be doing.

Change History (5)

comment:1 Changed 3 years ago by kencu (Ken)

The update to glib2 has been worked on by various people over the past couple of years, and at this moment I can't recall exactly just which one of us added this bit, or exactly why it was added.

If I added it, I would have usually put some explanation into the patch as to what the reason for it was.

Last edited 3 years ago by kencu (Ken) (previous) (diff)

comment:2 Changed 3 years ago by kencu (Ken)

It would appear that glib_memory_barrier_needed is "false" for Intel and arm processors at any rate.

For powerpc, it appears that glib_memory_barrier_needed should be set to "true" however.... so that is something to be tweaked here, or on the next glib2 update.

comment:3 Changed 3 years ago by kencu (Ken)

Description: modified (diff)

comment:4 Changed 3 years ago by kencu (Ken)

Looking again, I think all that stuff after glib_is_powerpc is somehow inserted into the universal.patch as something like a define. So I guess it is all connected together.

comment:5 Changed 3 years ago by kencu (Ken)

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.