chiark / gitweb /
configure.ac, debian/: Overhaul Wireshark plugin build machinery.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 12 Jun 2016 13:12:38 +0000 (14:12 +0100)
  * Depend on the a newish version of Wireshark because I couldn't find
    out where the API changes happened.

  * It seems that Wireshark actually does provide a `pkg-config'
    dropping now, so I can use it rather than complaining about how it's
    not there.

configure.ac
debian/control
debian/tripe-wireshark.install

index dc5ed90..ce74aeb 100644 (file)
@@ -195,58 +195,45 @@ AM_CONDITIONAL([HAVE_PYCATACOMB], [test ${HAVE_PYMOD_CATACOMB-no} = yes])
 
 dnl--------------------------------------------------------------------------
 dnl Wireshark.
-dnl
-dnl This is all distressingly ugly and complicated.  Why they can't just
-dnl provide a pkg-config dropping containing all the useful information about
-dnl the installation I don't know.
-
-WIRESHARK_CFLAGS=""
-: ${wireshark_plugindir=unknown}
 
 dnl Get the user to help.
+wireshark_plugindir=unknown
 AC_ARG_WITH([wireshark],
            AS_HELP_STRING(
-             [--with-wireshark[=DIR]],
+             [--with-wireshark],
              [build and install Wireshark plugin]),
            [case "$withval" in
-              no)  haveshark=no needshark=no ;;
-              yes) haveshark=yes needshark=yes ;;
-              *)   haveshark=yes needshark=yes
+              no)  wantshark=no mustshark=no ;;
+              yes) wantshark=yes mustshark=yes ;;
+              *)   wantshark=yes mustshark=yes
                    wireshark_plugindir=$withval ;;
            esac],
-           [haveshark=yes needshark=no])
+           [wantshark=yes mustshark=no])
+
+case "$wantshark" in
+  yes)
+    PKG_CHECK_MODULES([WIRESHARK], [wireshark >= 1.12.1],
+       [haveshark=yes], [haveshark=no])
+    ;;
+  *)
+    haveshark=no
+    ;;
+esac
 
-dnl Try to find the Wireshark installation directory the hard way.  This is
-dnl remarkably annoying.  This is, unfortunately, very likely to guess wrong,
-dnl but there doesn't seem to be a better way.
 case "$haveshark,$wireshark_plugindir" in
   yes,unknown)
     AC_CACHE_CHECK([where to put Wireshark plugins],
       [mdw_cv_wireshark_plugin_dir], [
       mdw_cv_wireshark_plugin_dir=$(
-       for i in \
-         $libexecdir $libdir $exec_prefix/lib $prefix/lib \
-         /usr/local/lib /usr/lib
-       do
-         for j in \
-           wireshark/plugins/* wireshark/*/plugins \
-           */wireshark/plugins/* */wireshark/*/plugins
-         do
-           for k in $i/$j/*.so; do
-             if test -f "$k"; then
-               echo $(AS_DIRNAME(["$k"]))
-               exit
-             fi
-           done
-         done
-       done
-       echo "failed"
-      )
-    ])
-    case $mdw_cv_wireshark_plugin_dir in
-      failed) haveshark=no ;;
-      *) wireshark_plugindir=$mdw_cv_wireshark_plugin_dir ;;
+       $PKG_CONFIG --variable=plugindir "wireshark >= 1.12.1")])
+    case "$mdw_cv_wireshark_plugin_dir" in
+      /*) wireshark_plugindir=$mdw_cv_wireshark_plugin_dir ;;
+      *)
+       AC_MSG_WARN([failed to read Wireshark plugin directory])
+       haveshark=no
+       ;;
     esac
+    ;;
 esac
 
 dnl If we're still interested, find Glib.
@@ -254,50 +241,12 @@ case "$haveshark" in
   yes) AM_PATH_GLIB_2_0([2.4.0], [], [haveshark=false], [gmodule]) ;;
 esac
 
-dnl Find the include directory.  This would be much easier if they just
-dnl provided a pkg-config file.
-case "$haveshark" in
-  yes)
-    bad=yes
-    mdw_CFLAGS=$CFLAGS
-    wsprefix=`echo $wireshark_plugindir | sed 's:/lib/.*$::'`
-    AC_CACHE_CHECK([how to find the Wireshark headers],
-                  [mdw_cv_wireshark_includes], [
-      mdw_cv_wireshark_includes=failed
-      for i in \
-         "" \
-         "-I${wsprefix}/include/wireshark" \
-         "-I${wsprefix}/include" \
-         "-I${prefix}/include/wireshark" \
-         "-I${prefix}/include" \
-         "-I/usr/include/wireshark" \
-         "-I/usr/local/include/wireshark" \
-         "-I/usr/local/include"; do
-       CFLAGS="$GLIB_CFLAGS $i"
-       AC_TRY_COMPILE([
-#include <netinet/in.h>
-#include <glib.h>
-#include <wireshark/config.h>
-#include <wireshark/epan/packet.h>],
-       [dissector_handle_t dh; dh = create_dissector_handle(0, 0);],
-       [bad=no; break])
-      done
-      case "$bad" in
-       no) mdw_cv_wireshark_includes=$i ;;
-      esac
-      CFLAGS=$mdw_CFLAGS
-    ])
-    case "$mdw_cv_wireshark_includes" in
-      failed) haveshark=no ;;
-    esac
-esac
-
 case "$haveshark,$needshark" in
   no,yes)
     AC_MSG_ERROR([failed to configure Wireshark plugin])
     ;;
   yes,*)
-    WIRESHARK_CFLAGS="$GLIB_CFLAGS $mdw_cv_wireshark_includes"
+    WIRESHARK_CFLAGS="$GLIB_CFLAGS $WIRESHARK_CFLAGS"
     AC_SUBST(WIRESHARK_CFLAGS)
     AC_SUBST(wireshark_plugindir)
     ;;
index beff118..b11909b 100644 (file)
@@ -4,7 +4,7 @@ Priority: extra
 Maintainer: Mark Wooding <mdw@distorted.org.uk>
 XS-Python-Version: >= 2.4
 Build-Depends: debhelper (>= 9), pkg-config, curl, rsync, python-central,
-       tshark, wireshark-dev (>= 0.10.10),
+       tshark, wireshark-dev (>= 1.12.1),
        mlib-dev (>= 2.2.2),
        catacomb-dev (>= 2.2.2+38), catacomb-bin (>= 2.1.4)
 Build-Depends-Indep: python,
index 1b5cf74..d45cc3f 100644 (file)
@@ -1 +1 @@
-debian/tmp/usr/lib/wireshark
+debian/tmp/usr/lib/*/wireshark