qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, qemu-ppc@nongnu.org
Subject: [Qemu-devel] [PATCH v3 9/9] disas: Add capstone as submodule
Date: Tue, 26 Sep 2017 13:14:27 -0700	[thread overview]
Message-ID: <20170926201427.2833-10-richard.henderson@linaro.org> (raw)
In-Reply-To: <20170926201427.2833-1-richard.henderson@linaro.org>

Do not require the submodule, but use it if present (in preference
even to a system copy).  This will allow us to easily use capstone
in older systems for which a package is not available, and also
easily track bug fixes from upstream.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 Makefile    |  4 ++++
 .gitmodules |  3 +++
 capstone    |  1 +
 configure   | 12 +++++++++++-
 4 files changed, 19 insertions(+), 1 deletion(-)
 create mode 160000 capstone

diff --git a/Makefile b/Makefile
index 2be61fcf1c..4723a65e9c 100644
--- a/Makefile
+++ b/Makefile
@@ -335,6 +335,10 @@ subdir-dtc:dtc/libfdt dtc/tests
 dtc/%:
 	mkdir -p $@
 
+# ??? Overriding CFLAGS causes us to lose defines added in the sub-makefile.
+subdir-capstone:
+	$(call quiet-command,$(MAKE) -C $(SRC_PATH)/capstone CAPSTONE_SHARED=no BUILDDIR="$(BUILD_DIR)/capstone" CC="$(CC)" AR="$(AR)" LD="$(LD)" $(SUBDIR_MAKEFLAGS) $(BUILD_DIR)/capstone/libcapstone.a)
+
 $(SUBDIR_RULES): libqemuutil.a $(common-obj-y) $(chardev-obj-y) \
 	$(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY))
 
diff --git a/.gitmodules b/.gitmodules
index 84c54cdc49..bcb80d701a 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -34,3 +34,6 @@
 [submodule "roms/QemuMacDrivers"]
 	path = roms/QemuMacDrivers
 	url = git://git.qemu.org/QemuMacDrivers.git
+[submodule "capstone"]
+	path = capstone
+	url = https://github.com/aquynh/capstone.git
diff --git a/capstone b/capstone
new file mode 160000
index 0000000000..a279481dbf
--- /dev/null
+++ b/capstone
@@ -0,0 +1 @@
+Subproject commit a279481dbfd54bb1e2336d771e89978cc6d43176
diff --git a/configure b/configure
index 62d172d88a..b0c30992ff 100755
--- a/configure
+++ b/configure
@@ -4378,7 +4378,14 @@ fi
 # capstone
 
 if test "$capstone" != no; then
-  if $pkg_config capstone; then
+  if test -d ${source_path}/capstone ; then
+    # have submodule capstone - use it
+    capstone=yes
+    capstone_internal=yes
+    mkdir -p capstone
+    QEMU_CFLAGS="$QEMU_CFLAGS -I\$(SRC_PATH)/capstone/include"
+    LIBS="\$(BUILD_DIR)/capstone/libcapstone.a $LIBS"
+  elif $pkg_config capstone; then
     capstone=yes
     QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags capstone)"
     LIBS="$($pkg_config --libs capstone) $LIBS"
@@ -6577,6 +6584,9 @@ done # for target in $targets
 if [ "$dtc_internal" = "yes" ]; then
   echo "config-host.h: subdir-dtc" >> $config_host_mak
 fi
+if [ "$capstone_internal" = "yes" ]; then
+  echo "config-host.h: subdir-capstone" >> $config_host_mak
+fi
 
 if test "$numa" = "yes"; then
   echo "CONFIG_NUMA=y" >> $config_host_mak
-- 
2.13.5

  parent reply	other threads:[~2017-09-26 20:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-26 20:14 [Qemu-devel] [PATCH v3 0/9] Support the Capstone disassembler Richard Henderson
2017-09-26 20:14 ` [Qemu-devel] [PATCH v3 1/9] target/i386: Convert to disas_set_info hook Richard Henderson
2017-09-26 20:14 ` [Qemu-devel] [PATCH v3 2/9] target/ppc: " Richard Henderson
2017-09-26 20:14 ` [Qemu-devel] [PATCH v3 3/9] disas: Remove unused flags arguments Richard Henderson
2017-09-26 20:14 ` [Qemu-devel] [PATCH v3 4/9] disas: Support the Capstone disassembler library Richard Henderson
2017-09-26 20:14 ` [Qemu-devel] [PATCH v3 5/9] i386: Support Capstone in disas_set_info Richard Henderson
2017-09-26 20:14 ` [Qemu-devel] [PATCH v3 6/9] arm: " Richard Henderson
2017-09-26 20:14 ` [Qemu-devel] [PATCH v3 7/9] ppc: " Richard Henderson
2017-09-26 20:14 ` [Qemu-devel] [PATCH v3 8/9] disas: Remove monitor_disas_is_physical Richard Henderson
2017-09-26 20:14 ` Richard Henderson [this message]
2017-09-26 20:27 ` [Qemu-devel] [PATCH v3 0/9] Support the Capstone disassembler no-reply
2017-09-26 20:29 ` no-reply
2017-09-27 19:06 ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170926201427.2833-10-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).