[cairo-commit] util/cairo-trace

Chris Wilson ickle at kemper.freedesktop.org
Tue Nov 4 06:22:37 PST 2008


 util/cairo-trace/Makefile.am |   10 ++++++++--
 util/cairo-trace/trace.c     |    8 ++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit a3d56c60e85176526d6cce139441b6921acc9218
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Nov 4 14:06:02 2008 +0000

    [trace] Use a common directory by default.
    
    If called directly (e.g. via /etc/ld.so.preload) put the output trace into
    a central directory, and not the pwd.

diff --git a/util/cairo-trace/Makefile.am b/util/cairo-trace/Makefile.am
index f9c68b1..50bd255 100644
--- a/util/cairo-trace/Makefile.am
+++ b/util/cairo-trace/Makefile.am
@@ -1,5 +1,7 @@
-bin_SCRIPTS = cairo-trace
 cairolibdir = $(libdir)/cairo
+cairooutdir = $(localstatedir)/lib/cairo-trace
+
+bin_SCRIPTS = cairo-trace
 cairolib_LTLIBRARIES = cairo-trace.la
 
 AM_CPPFLAGS = -I$(top_srcdir)/src \
@@ -9,15 +11,19 @@ cairo_trace_la_SOURCES = \
 			 lookup-symbol.c \
 			 lookup-symbol.h \
 			 trace.c
+cairo_trace_la_CPPFLAGS = -DCAIRO_TRACE_OUTDIR="\"$(cairooutdir)\"" \
+			  $(AM_CPPFLAGS)
 cairo_trace_la_CFLAGS = $(CAIRO_CFLAGS)
 cairo_trace_la_LDFLAGS = -module -no-undefined
 cairo_trace_la_LIBADD = -ldl -lz $(BFD_LIBS)
 
+
 system-install: install
+	mkdir -p $(cairooutdir)
 	grep -sq $(cairolibdir)/cairo-trace.so /etc/ld.so.preload || echo $(cairolibdir)/cairo-trace.so >> /etc/ld.so.preload
 
 system-uninstall: uninstall
-	sed -e '$(cairolibdir)\/cairo-trace.so/d' < /etc/ld.so.preload > /tmp/ld.so.preload && mv /tmp/ld.so.preload /etc/ld.so.preload;
+	sed -e '/cairo-trace.so/d' < /etc/ld.so.preload > /tmp/ld.so.preload && mv /tmp/ld.so.preload /etc/ld.so.preload;
 
 EXTRA_DIST = \
 	COPYING \
diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index eeca07a..680a6b9 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -41,6 +41,10 @@
 # include <cairo-ft.h>
 #endif
 
+#ifndef CAIRO_TRACE_OUTDIR
+#define CAIRO_TRACE_OUTDIR "."
+#endif
+
 #include "lookup-symbol.h"
 
 /* Reverse the bits in a byte with 7 operations (no 64-bit):
@@ -448,13 +452,13 @@ _init_logfile (void)
 
 	filename = getenv ("CAIRO_TRACE_OUTDIR");
 	if (filename == NULL)
-	    filename = ".";
+	    filename = CAIRO_TRACE_OUTDIR;
 
 	get_prog_name (name, sizeof (name));
 	if (*name == '\0')
 	    strcpy (name, "cairo-trace.dat");
 
-	snprintf (buf, sizeof (buf), "%s/%s.%d.cs",
+	snprintf (buf, sizeof (buf), "%s/%s.%d.trace",
 		filename, name, getpid());
 
 	filename = buf;


More information about the cairo-commit mailing list