From d4a88b6d2d50647c4bfc90e55d1b67106d55f355 Mon Sep 17 00:00:00 2001
From: devttys0 <heffnercj@gmail.com>
Date: Sat, 19 Jul 2014 12:55:22 -0400
Subject: [PATCH] Added --disable-pyqtgraph to configure

---
 Makefile.in    |  1 +
 configure      | 13 +++++++++++++
 configure.ac   |  6 ++++++
 setup.py       | 13 ++++++++-----
 src/C/Makefile |  4 ++--
 5 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 68a77ce..5f7d3f3 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -9,6 +9,7 @@ export INSTALL_OPTIONS=@INSTALL_OPTIONS@
 export PLATFORM=@PLATFORM@
 export BUILD_MAGIC=@BUILD_MAGIC@
 export BUILD_FUZZY=@BUILD_FUZZY@
+export BUILD_PYQTGRAPH=@BUILD_PYQTGRAPH@
 
 BUILD_C_LIBS=@BUILD_C_LIBS@
 PYTHON=@PYTHON@
diff --git a/configure b/configure
index d72cae6..854d25a 100755
--- a/configure
+++ b/configure
@@ -604,6 +604,7 @@ PLATFORM
 SOEXT
 SONAME
 PYTHON
+BUILD_PYQTGRAPH
 BUILD_FUZZY
 BUILD_MAGIC
 BUILD_C_LIBS
@@ -663,6 +664,7 @@ with_python
 enable_clibs
 enable_libmagic
 enable_libfuzzy
+enable_pyqtgraph
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1285,6 +1287,7 @@ Optional Features:
   --disable-clibs         do not build/install any c libraries
   --disable-libmagic      do not build/install the bundled libmagic library
   --disable-libfuzzy      do not build/install the bundled libfuzzy library
+  --disable-pyqtgraph     do not install the bundled pyqtgraph library
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -3330,6 +3333,14 @@ else
 fi
 
 
+# Check whether --enable-pyqtgraph was given.
+if test "${enable_pyqtgraph+set}" = set; then :
+  enableval=$enable_pyqtgraph; BUILD_PYQTGRAPH=0
+else
+  BUILD_PYQTGRAPH=1
+fi
+
+
 CFLAGS="-Wall -fPIC $CFLAGS"
 INSTALL_OPTIONS="-m644"
 
@@ -3370,6 +3381,8 @@ BUILD_MAGIC=$BUILD_MAGIC
 
 BUILD_FUZZY=$BUILD_FUZZY
 
+BUILD_PYQTGRAPH=$BUILD_PYQTGRAPH
+
 PYTHON=$PYTHON
 
 SONAME=$SONAME
diff --git a/configure.ac b/configure.ac
index 5b1e312..03d5d79 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,6 +27,11 @@ AC_ARG_ENABLE([libfuzzy],
               [BUILD_FUZZY=0],
               [BUILD_FUZZY=1])
 
+AC_ARG_ENABLE([pyqtgraph],
+              [AS_HELP_STRING([--disable-pyqtgraph], [do not install the bundled pyqtgraph library])],
+              [BUILD_PYQTGRAPH=0],
+              [BUILD_PYQTGRAPH=1])
+
 CFLAGS="-Wall -fPIC $CFLAGS"
 INSTALL_OPTIONS="-m644"
 
@@ -64,6 +69,7 @@ fi
 AC_SUBST(BUILD_C_LIBS, $BUILD_C_LIBS)
 AC_SUBST(BUILD_MAGIC, $BUILD_MAGIC)
 AC_SUBST(BUILD_FUZZY, $BUILD_FUZZY)
+AC_SUBST(BUILD_PYQTGRAPH, $BUILD_PYQTGRAPH)
 AC_SUBST(PYTHON, $PYTHON)
 AC_SUBST(SONAME, $SONAME)
 AC_SUBST(SOEXT, $SOEXT)
diff --git a/setup.py b/setup.py
index 420d6ba..b5fbf54 100755
--- a/setup.py
+++ b/setup.py
@@ -133,16 +133,19 @@ if "install" in sys.argv or "build" in sys.argv:
     fd.close()
 
 # The data files to install along with the module
-install_data_files = [os.path.join("libs", "pyqtgraph", "*.py"), os.path.join("libs", "*.so")]
 data_dirs = ["magic", "config", "plugins", "modules", "core"]
+install_data_files = [os.path.join("libs", "*.so")]
 
 for data_dir in data_dirs:
     install_data_files.append("%s%s*" % (data_dir, os.path.sep))
 
-for (root, dirs, files) in os.walk(os.path.join(MODULE_NAME, "libs", "pyqtgraph")):
-    if dirs:
-        for directory in dirs:
-            install_data_files.append(os.path.join(os.path.sep.join(root.split(os.path.sep)[1:]), os.path.join(directory, "*.py")))
+if os.getenv("BUILD_PYQTGRAPH") == "1":
+    install_data_files.append(os.path.join("libs", "pyqtgraph", "*.py"))
+
+    for (root, dirs, files) in os.walk(os.path.join(MODULE_NAME, "libs", "pyqtgraph")):
+        if dirs:
+            for directory in dirs:
+                install_data_files.append(os.path.join(os.path.sep.join(root.split(os.path.sep)[1:]), os.path.join(directory, "*.py")))
 
 # Install the module, script, and support files
 setup(name = MODULE_NAME,
diff --git a/src/C/Makefile b/src/C/Makefile
index 943298d..05b272d 100644
--- a/src/C/Makefile
+++ b/src/C/Makefile
@@ -1,5 +1,5 @@
-FILE_VERSION=5.18
-SSDEEP_VERSION=2.10
+FILE_VERSION=`ls file-*.tar.gz | cut -d'-' -f2 | cut -d '.' -f1,2`
+SSDEEP_VERSION=`ls ssdeep-*.tar.gz | cut -d'-' -f2 | cut -d '.' -f1,2`
 LIB_DIR="../binwalk/libs/"
 
 .PHONY: all clean_libs clean distclean
--
libgit2 0.26.0