Re: usbutils for Mac OS X and Cygwin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 16, 2012 at 3:07 PM, Greg Kroah-Hartman
<gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> On Tue, Oct 16, 2012 at 09:57:16AM +0800, Xiaofan Chen wrote:
>> Now usbutils git almost builds successfully out of the box under
>> Mac OS Xand Cygwin (using libusbx). Just wondering if you can
>> accept the minor fix for Mac OS X and suggest a way to fix
>> cygwin build.
>>
>> For Cygwin, there is a conflict with Cygwin's w32api package.
>>
>> DATADIR conflicts with MinGW and cydwin's <objidl.h> in their
>> w32api package.
>> http://caca.zoy.org/changeset/3404
>>
>> typedef enum tag DATADIR        {
>>         DATADIR_GET=1,
>>         DATADIR_SET
>> } DATADIR;
>>
>> I do not know the proper fix, so I just temporarily change
>> objidl.h to
>>
>> typedef enum tag DATADIR        {
>>         DATADIR_GET=1,
>>         DATADIR_SET
>> } DATADIR1;
>>
>> After that I can build usbutils.
>
> Might it just be easier to patch usbutils to be something like
> USB_IDS_DATADIR instead when building on these systems?
>

Good idea. Here is the patch based on your suggestion and
it works fine.

diff --git a/Makefile.am b/Makefile.am
index 4e53e45..8c11e54 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -25,7 +25,7 @@ lsusb_SOURCES = \

 lsusb_CPPFLAGS = \
        $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) \
-       -DDATADIR=\"$(datadir)\"
+       -DUSB_IDS_DATADIR=\"$(datadir)\"

 lsusb_LDADD = \
        $(LIBUSB_LIBS)
diff --git a/lsusb.c b/lsusb.c
index 106dd33..03d888c 100644
--- a/lsusb.c
+++ b/lsusb.c
@@ -4016,15 +4016,15 @@ int main(int argc, char *argv[])


        /* by default, print names as well as numbers */
-       err = names_init(DATADIR "/usb.ids");
+       err = names_init(USB_IDS_DATADIR "/usb.ids");
 #ifdef HAVE_LIBZ
        if (err != 0)
-               err = names_init(DATADIR "/usb.ids.gz");
+               err = names_init(USB_IDS_DATADIR "/usb.ids.gz");
 #endif
        if (err != 0)
                fprintf(stderr, "%s: cannot open \"%s\", %s\n",
                                argv[0],
-                               DATADIR "/usb.ids",
+                               USB_IDS_DATADIR "/usb.ids",
                                strerror(err));
        status = 0;

-- 
Xiaofan
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux