Commit f2cb9ba4 authored by George Matsumura's avatar George Matsumura Committed by Uli Schlachter
Browse files

meson: Fix musl build



This constitutes few fixes that are necessary to compile correctly
and reduce errors when using musl libc.
Signed-off-by: George Matsumura's avatarGeorge Matsumura <gmmatsumura01@bvsd.org>
parent b87e53dc
......@@ -38,10 +38,13 @@
* Adrian Johnson <ajohnson@redneon.com>
*/
#define _GNU_SOURCE 1 /* strtod_l() */
#include "cairoint.h"
#include "cairo-error-private.h"
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <locale.h>
#ifdef HAVE_XLOCALE_H
......
......@@ -164,11 +164,13 @@ static cairo_bool_t
is_running_under_debugger (void)
{
#if HAVE_UNISTD_H && HAVE_LIBGEN_H && __linux__
char buf[1024];
char buf[1024] = { 0 };
char buf2[1024] = { 0 };
sprintf (buf, "/proc/%d/exe", getppid ());
if (readlink (buf, buf, sizeof (buf)) != -1 &&
strncmp (basename (buf), "gdb", 3) == 0)
if (readlink (buf, buf2, sizeof (buf2)) != -1 &&
buf2[1023] == 0 &&
strncmp (basename (buf2), "gdb", 3) == 0)
{
return TRUE;
}
......
......@@ -83,6 +83,7 @@
#include <sys/un.h>
#include <errno.h>
#include <assert.h>
#include <unistd.h>
#if CAIRO_HAS_REAL_PTHREAD
#include <pthread.h>
#endif
......@@ -906,7 +907,7 @@ write_result (const char *trace, struct slave *slave)
static int index;
char *filename;
xasprintf (&filename, "%s-%s-pass-%d-%d-%d.png",
xasprintf (&filename, "%s-%s-pass-%d-%ld-%ld.png",
trace, slave->target->name, ++index,
slave->start_line, slave->end_line);
cairo_surface_write_to_png (slave->image, filename);
......@@ -1175,7 +1176,7 @@ test_run (void *base,
if (write_results) write_result (trace, &slaves[1]);
if (write_traces && slaves[0].is_recording) {
char buf[80];
snprintf (buf, sizeof (buf), "%d", slaves[0].image_serial);
snprintf (buf, sizeof (buf), "%ld", slaves[0].image_serial);
write_trace (trace, buf, &slaves[0]);
}
......@@ -1203,7 +1204,7 @@ test_run (void *base,
image = 0;
}
}
done:
ret = TRUE;
out:
......
......@@ -1663,11 +1663,13 @@ cairo_test_get_context (cairo_t *cr)
}
cairo_t *
cairo_test_create (cairo_surface_t *surface, cairo_test_context_t *ctx)
cairo_test_create (cairo_surface_t *surface,
const cairo_test_context_t *ctx)
{
cairo_t *cr = cairo_create(surface);
cairo_set_user_data(cr, &_cairo_test_context_key, ctx, NULL);
return cr;
cairo_t *cr = cairo_create (surface);
cairo_set_user_data (cr, &_cairo_test_context_key,
(void*) ctx, NULL);
return cr;
}
cairo_surface_t *
......
......@@ -320,7 +320,8 @@ cairo_bool_t
cairo_test_mkdir (const char *path);
cairo_t *
cairo_test_create (cairo_surface_t *surface, cairo_test_context_t *ctx);
cairo_test_create (cairo_surface_t *surface,
const cairo_test_context_t *ctx);
CAIRO_END_DECLS
......
......@@ -784,7 +784,7 @@ static cairo_bool_t
_init_logfile (void)
{
static cairo_bool_t initialized;
char buf[4096];
char buf[4105];
const char *filename;
const char *env;
......
......@@ -58,8 +58,7 @@ foreach util : cairo_utils
)
endforeach
# This is useless and doesn't build on Windows
if host_machine.system() != 'windows'
if cc.has_header_symbol('malloc.h', '__malloc_hook')
libmallocstats = library('malloc-stats', 'malloc-stats.c')
endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment