On Sat, Aug 05, 2006 at 04:02:39PM -0700, David Brownell wrote:
> There seems to be a missing "install gzipped usb.ids file" step
> for "make install" ...

Oops, you are right. Please find attached a new version of the patch.

> Are pciutils going to install compressed pci.ids?

Actually the idea of the compressed usb.ids has been given to me by the
Debian maintainer of pciutils. The current version of pciutils in Debian
already deals with compressed pci.ids, but I don't know if the patch has
been merged upstream yet.

Bye,
Aurelien

-- 
  .''`.  Aurelien Jarno             | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [EMAIL PROTECTED]         | [EMAIL PROTECTED]
   `-    people.debian.org/~aurel32 | www.aurel32.net
--- usbutils-0.72.orig/configure.in
+++ usbutils-0.72/configure.in
@@ -34,6 +34,25 @@
 AC_CHECK_LIB(usb, usb_get_string_simple, ,
        [AC_MSG_ERROR(get libusb 0.1.8 or newer)])
 
+
+dnl zlib on enabled by default (if found)
+USE_ZLIB=yes
+AC_ARG_ENABLE(zlib,
+  AC_HELP_STRING([--disable-zlib],
+                 [disable support for zlib]),
+  [
+    if eval "test x$enable_zlib = xno"; then
+      USE_ZLIB=
+    fi
+  ])
+if test "$USE_ZLIB" = "yes" ; then
+  AC_CHECK_LIB(z, inflateEnd)
+  if test "${ac_cv_lib_z_inflateEnd}" = "yes" ; then
+    HAVE_ZLIB="yes"
+  fi
+fi
+AM_CONDITIONAL(HAVE_ZLIB, test x$HAVE_ZLIB = xyes)
+
 #AC_ARG_ENABLE(usbmodules,
 #      [  --enable-usbmodules     build usbmodules (for Linux 2.4)],
 #      [ case "${enableval}" in
--- usbutils-0.72.orig/Makefile.am
+++ usbutils-0.72/Makefile.am
@@ -11,10 +11,16 @@
        devtree.c devtree.h list.h \
        usbmisc.c usbmisc.h
 
-data_DATA = usb.ids
-
 man_MANS = lsusb.8
 
+install-data-local:
+       $(mkinstalldirs) $(DESTDIR)$(datadir)
+if HAVE_ZLIB
+       gzip -c -n -9 $(srcdir)/usb.ids > $(DESTDIR)$(datadir)/usb.ids
+else
+       $(INSTALL_DATA) $(srcdir)/usb.ids $(DESTDIR)$(datadir)/usb.ids
+endif
+
 # usbmodules is needed only with 2.4 based hotplugging, and is OBSOLETE 
 
 # EXTRA_PROGRAMS = usbmodules
@@ -27,4 +33,4 @@
 #    man_MANS += usbmodules.8
 #endif
 
-EXTRA_DIST = $(man_MANS) $(data_DATA) update-usbids.sh
+EXTRA_DIST = $(man_MANS) usb.ids update-usbids.sh
--- usbutils-0.72.orig/names.c
+++ usbutils-0.72/names.c
@@ -38,6 +38,19 @@
 #include "config.h"
 #endif
 
+#ifdef HAVE_LIBZ
+#include <zlib.h>
+#define        my_file                         gzFile
+#define        my_fopen(path, mode)            gzopen(path, mode)
+#define        my_fgets(s, size, stream)       gzgets(stream, s, size)
+#define        my_close(f)                     gzclose(f)
+#else
+#define        my_file                         FILE*
+#define        my_fopen(path, mode)            fopen(path, mode)
+#define        my_fgets(s, size, stream)       fgets(s, size, stream)
+#define        my_close(f)                     fclose(f)
+#endif
+
 #include "names.h"
 
 
@@ -454,14 +467,14 @@
 
 #define DBG(x) 
 
-static void parse(FILE *f)
+static void parse(my_file f)
 {
        char buf[512], *cp;
        unsigned int linectr = 0;
        int lastvendor = -1, lastclass = -1, lastsubclass = -1, lasthut=-1, 
lastlang=-1;
        unsigned int u;
 
-       while (fgets(buf, sizeof(buf), f)) {
+       while (my_fgets(buf, sizeof(buf), f)) {
                linectr++;
                /* remove line ends */
                if ((cp = strchr(buf, 13)))
@@ -785,12 +798,12 @@
 
 int names_init(char *n)
 {
-       FILE *f;
+       my_file f;
        
-       if (!(f = fopen(n, "r"))) {
+       if (!(f = my_fopen(n, "r"))) {
                return errno;
        }
        parse(f);
-       fclose(f);
+       my_close(f);
        return 0;
 }
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to