Bug 1253622 - Move the mozilla-trace.h generation into moz.build; r=ted
authorMs2ger <Ms2ger@gmail.com>
Mon, 07 Mar 2016 14:59:13 +0100
changeset 287095 dd46a77cdf656048cce156d66fe0988e2e34ba84
parent 287094 db12e253eb848d6644284f3ca034ae01e0ca4ed6
child 287096 2f9b726495d18514f553bb64aea96f22f19ca15b
push id30065
push userkwierso@gmail.com
push dateWed, 09 Mar 2016 00:01:05 +0000
treeherdermozilla-central@886b5480b578 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1253622
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1253622 - Move the mozilla-trace.h generation into moz.build; r=ted
probes/Makefile.in
probes/moz.build
probes/trace-gen.py
deleted file mode 100644
--- a/probes/Makefile.in
+++ /dev/null
@@ -1,14 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-ifdef HAVE_DTRACE
-export:: $(DIST)/include/mozilla-trace.h
-
-# Replace _DTRACE_VERSION with INCLUDE_MOZILLA_DTRACE
-$(DIST)/include/mozilla-trace.h: mozilla-trace.d Makefile
-	dtrace -x nolibs -h -s $(srcdir)/mozilla-trace.d -o mozilla-trace.h.tmp
-	sed -e 's/if _DTRACE_VERSION/ifdef INCLUDE_MOZILLA_DTRACE/' \
-	    mozilla-trace.h.tmp > $(DIST)/include/mozilla-trace.h
-	rm mozilla-trace.h.tmp
-endif
--- a/probes/moz.build
+++ b/probes/moz.build
@@ -1,6 +1,18 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+if CONFIG['HAVE_DTRACE']:
+    EXPORTS += [
+        '!mozilla-trace.h',
+    ]
+
+    GENERATED_FILES += [
+        'mozilla-trace.h',
+    ]
+
+    trace = GENERATED_FILES['mozilla-trace.h']
+    trace.script = 'trace-gen.py'
+    trace.inputs += ['mozilla-trace.d']
new file mode 100644
--- /dev/null
+++ b/probes/trace-gen.py
@@ -0,0 +1,15 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import os
+import subprocess
+
+def main(fp, input):
+    temporary_file = 'mozilla-trace.h.tmp'
+    subprocess.check_call(['dtrace', '-x', 'nolibs', '-h', '-s', input, '-o', temporary_file])
+    
+    with open(temporary_file, 'r') as temporary_fp:
+        output = temporary_fp.read()
+    fp.write(output.replace('if _DTRACE_VERSION', 'ifdef INCLUDE_MOZILLA_DTRACE'))
+    os.remove(temporary_file)