build files for processor-trace/libipt

Change-Id: Ia38c5ca89ff7604aa500e71066e75faf369c78a3
diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 0000000..b25d3ef
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,9 @@
+# Copyright 2017 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+group("processor-trace") {
+  deps = [
+    "libipt",
+  ]
+}
diff --git a/libipt/BUILD.gn b/libipt/BUILD.gn
new file mode 100644
index 0000000..f2f069a
--- /dev/null
+++ b/libipt/BUILD.gn
@@ -0,0 +1,100 @@
+# Copyright 2017 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+group("libipt") {
+  deps = [
+    ":ipt",
+  ]
+}
+
+static_library("ipt") {
+  sources = [
+    "include/intel-pt.h",
+    "internal/include/pt_asid.h",
+    "internal/include/pt_block_cache.h",
+    "internal/include/pt_block_decoder.h",
+    "internal/include/pt_config.h",
+    "internal/include/pt_cpu.h",
+    "internal/include/pt_cpuid.h",
+    "internal/include/pt_decoder_function.h",
+    "internal/include/pt_encoder.h",
+    "internal/include/pt_event_queue.h",
+    "internal/include/pt_ild.h",
+    "internal/include/pt_image.h",
+    "internal/include/pt_image_section_cache.h",
+    "internal/include/pt_insn.h",
+    "internal/include/pt_insn_decoder.h",
+    "internal/include/pt_last_ip.h",
+    "internal/include/pt_mapped_section.h",
+    "internal/include/pt_packet.h",
+    "internal/include/pt_packet_decoder.h",
+    "internal/include/pt_query_decoder.h",
+    "internal/include/pt_retstack.h",
+    "internal/include/pt_section.h",
+    "internal/include/pt_section_file.h",
+    "internal/include/pt_sync.h",
+    "internal/include/pt_time.h",
+    "internal/include/pt_tnt_cache.h",
+    "internal/include/pti-disp-defs.h",
+    "internal/include/pti-disp.h",
+    "internal/include/pti-imm-defs.h",
+    "internal/include/pti-imm.h",
+    "internal/include/pti-modrm-defs.h",
+    "internal/include/pti-modrm.h",
+    "src/pt_section.c",
+    "src/pt_section_file.c",
+    "src/pt_error.c",
+    "src/pt_packet_decoder.c",
+    "src/pt_query_decoder.c",
+    "src/pt_encoder.c",
+    "src/pt_sync.c",
+    "src/pt_version.c",
+    "src/pt_last_ip.c",
+    "src/pt_tnt_cache.c",
+    "src/pt_ild.c",
+    "src/pt_image.c",
+    "src/pt_image_section_cache.c",
+    "src/pt_retstack.c",
+    "src/pt_insn_decoder.c",
+    "src/pt_time.c",
+    "src/pt_asid.c",
+    "src/pt_event_queue.c",
+    "src/pt_packet.c",
+    "src/pt_decoder_function.c",
+    "src/pt_config.c",
+    "src/pt_insn.c",
+    "src/pt_block_decoder.c",
+    "src/pt_block_cache.c",
+  ]
+
+  if (is_linux) {
+    sources += [
+      "internal/include/posix/pt_section_posix.h",
+      "src/posix/init.c",
+      "src/posix/pt_cpuid.c",
+      "src/posix/pt_section_posix.c",
+    ]
+  }
+
+  deps = [
+  ]
+
+  include_dirs = [
+    "include",
+    "internal/include",
+  ]
+
+  if (is_linux) {
+    include_dirs += [
+      "internal/include/posix",
+    ]
+  }
+
+  defines = [
+    "PT_VERSION_MAJOR=1",
+    "PT_VERSION_MINOR=6",
+    "PT_VERSION_BUILD=0",
+    "PT_VERSION_EXT=\"\"",
+  ]
+}