← Back to team overview

dulwich-users team mailing list archive

Re: make dulwich compile with mingw

 

Hi,

Those are good points. I've modified the patch so it defines strnlen if
mingw headers are present. Of course it would be best to detect strnlen
availability explicitly. But I have no idea how that would work with
setuptools. I just wanted to get hg-git working without having to install
visual studio :)
The modified patch is attached.

thanks

On Wed, Aug 18, 2010 at 12:01 AM, David Borowitz <dborowitz@xxxxxxxxxx>wrote:

> If we just want to test for mingw specifically rather than strnlen
> generally you may be able to do:
>
> #ifdef __MINGW32_VERSION
> #define MINGW
> #endif
> ...
> #ifdef MINGW
> size_t strnlen ...
> #endif
>
> (The __MINGW32_VERSION trick is based purely on googling rather than my own
> experience.)
>
> On Tue, Aug 17, 2010 at 14:45, Jelmer Vernooij <jelmer@xxxxxxxxx> wrote:
>
>> On Tue, 2010-08-17 at 14:40 -0700, David Borowitz wrote:
>> > I'm not a huge fan of inlining this function as opposed to a
>> > conditionally-defined macro or header file. What if we want to use
>> > strlen in other places?
>> Me neither. The issue there though is that we'd have to add a complex
>> test in setup.py to see if the system provides a strnlen()
>> implementation.
>>
>> If we end up with strnlen() in more places I think we should revisit
>> this decision, and perhaps go the more complex route instead.
>>
>> Cheers,
>>
>> Jelmer
>>
>> > On Tue, Aug 17, 2010 at 14:36, Jelmer Vernooij <jelmer@xxxxxxxxx>
>> > wrote:
>> >
>> >         On Tue, 2010-08-17 at 23:30 +0200, Hans Kolek wrote:
>> >         > I've patched dulwich to compile with mingw. The patch is
>> >         attached. As
>> >         > you can see I've just removed the strnlen call and replaced
>> >         it with
>> >         > its implementation.
>> >
>> >         This looks alright, but please don't use declarations after
>> >         statements,
>> >         as they break some compilers.
>> >
>> >         Cheers,
>> >
>> >         Jelmer
>> >
>> >
>> >         _______________________________________________
>> >         Mailing list: https://launchpad.net/~dulwich-users
>> >         Post to     : dulwich-users@xxxxxxxxxxxxxxxxxxx
>> >         Unsubscribe : https://launchpad.net/~dulwich-users
>> >         More help   : https://help.launchpad.net/ListHelp
>> >
>> >
>>
>>
>

Attachment: mingw-strnlen.patch
Description: Binary data


Follow ups

References