diff mbox series

sysprof: fix build with musl

Message ID 20180907010032.18028-1-ross.burton@intel.com
State New
Headers show
Series sysprof: fix build with musl | expand

Commit Message

Ross Burton Sept. 7, 2018, 1 a.m. UTC
Signed-off-by: Ross Burton <ross.burton@intel.com>

---
 meta/recipes-kernel/sysprof/files/wordsize.patch | 62 ++++++++++++++++++++++++
 meta/recipes-kernel/sysprof/sysprof_3.30.0.bb    |  1 +
 2 files changed, 63 insertions(+)
 create mode 100644 meta/recipes-kernel/sysprof/files/wordsize.patch

-- 
2.11.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
diff mbox series

Patch

diff --git a/meta/recipes-kernel/sysprof/files/wordsize.patch b/meta/recipes-kernel/sysprof/files/wordsize.patch
new file mode 100644
index 00000000000..4ce77777825
--- /dev/null
+++ b/meta/recipes-kernel/sysprof/files/wordsize.patch
@@ -0,0 +1,62 @@ 
+capture: use size of void* instead of glibc-specific __WORDSIZE
+
+__WORDSIZE is glibc-specific so sp-capture-types.h doesn't work with musl.
+
+As this code is all about the size of pointers, do sizeof(void*) at configure
+time and use that to determine what values to use.
+
+Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/sysprof/merge_requests/5]
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+diff --git a/config.h.meson b/config.h.meson
+index 2d8c8fb..d927b1b 100644
+--- a/config.h.meson
++++ b/config.h.meson
+@@ -34,3 +34,6 @@
+ 
+ /* Version number of package */
+ #mesondefine VERSION
++
++/* Size of a pointer */
++#mesondefine VOID_P_SIZE
+diff --git a/lib/capture/sp-capture-types.h b/lib/capture/sp-capture-types.h
+index 48fcfb8..bc3ab9c 100644
+--- a/lib/capture/sp-capture-types.h
++++ b/lib/capture/sp-capture-types.h
+@@ -19,6 +19,7 @@
+ #ifndef SP_CAPTURE_FORMAT_H
+ #define SP_CAPTURE_FORMAT_H
+ 
++#include <config.h>
+ #include <glib.h>
+ 
+ #ifdef SP_ENABLE_GOBJECT
+@@ -32,12 +33,14 @@ G_BEGIN_DECLS
+ #define SP_CAPTURE_MAGIC (GUINT32_TO_LE(0xFDCA975E))
+ #define SP_CAPTURE_ALIGN (sizeof(SpCaptureAddress))
+ 
+-#if __WORDSIZE == 64
++#if VOID_P_SIZE == 8
+ # define SP_CAPTURE_JITMAP_MARK    G_GUINT64_CONSTANT(0xE000000000000000)
+ # define SP_CAPTURE_ADDRESS_FORMAT "0x%016lx"
+-#else
++#elif VOID_P_SIZE == 4
+ # define SP_CAPTURE_JITMAP_MARK    G_GUINT64_CONSTANT(0xE0000000)
+ # define SP_CAPTURE_ADDRESS_FORMAT "0x%016llx"
++#else
++#error Unknown VOID_P_SIZE
+ #endif
+ 
+ #define SP_CAPTURE_CURRENT_TIME   (sp_clock_get_current_time())
+diff --git a/meson.build b/meson.build
+index ff7296b..d841c0d 100644
+--- a/meson.build
++++ b/meson.build
+@@ -35,6 +35,7 @@ has_clockid = cc.has_member('struct perf_event_attr', 'clockid', prefix: '#inclu
+ if has_use_clockid and has_clockid
+   config_h.set10('HAVE_PERF_CLOCKID', true)
+ endif
++config_h.set('VOID_P_SIZE', cc.sizeof('void*'))
+ 
+ add_global_arguments([
+   '-DHAVE_CONFIG_H',
diff --git a/meta/recipes-kernel/sysprof/sysprof_3.30.0.bb b/meta/recipes-kernel/sysprof/sysprof_3.30.0.bb
index 4f1b75017d2..7783ab27f50 100644
--- a/meta/recipes-kernel/sysprof/sysprof_3.30.0.bb
+++ b/meta/recipes-kernel/sysprof/sysprof_3.30.0.bb
@@ -14,6 +14,7 @@  SRC_URI[archive.sha256sum] = "29cd2c4be277f00698dce48259219557c4fddc2c01254b8fac
 SRC_URI += " \
            file://define-NT_GNU_BUILD_ID.patch \
            file://0001-Do-not-build-anything-in-help-as-it-requires-itstool.patch \
+           file://wordsize.patch \
            "
 RECIPE_NO_UPDATE_REASON = "Waiting for resolution of https://bugzilla.gnome.org/show_bug.cgi?id=794625"