compat: fmemopen for Mac OS and iOS

Originally ported from [ingenuitas python-tesseract]
(https://github.com/ingenuitas/python-tesseract/blob/master/fmemopen.c).
Ported by Jeff Verkoeyen under the Apache 2.0 License.

From the fmemopen man page:

> FILE *fmemopen(void *buf, size_t size, const char *mode);
>
> The fmemopen() function opens a stream that permits the access
> specified by mode. The stream allows I/O to be performed on the string
> or memory buffer pointed to by buf. This buffer must be at least size
> bytes long.

Alas, this method does not exist on BSD operating systems (specifically
Mac OS X and iOS). It is possible to recreate this functionality using a
BSD-specific method called `funopen`.

From the funopen man page:

> FILE * funopen(const void *cookie, int (*readfn)(void *, char *, int),
>                int (*writefn)(void *, const char *, int),
>                fpos_t (*seekfn)(void *, fpos_t, int),
>                int (*closefn)(void *));
>
> The funopen() function associates a stream with up to four
> ``I/O functions''.  Either readfn or writefn must be specified; the
> others can be given as an appropriately-typed NULL pointer.  These I/O
> functions will be used to read, write, seek and close the new stream.

fmemopen.c provides a simple implementation of fmemopen using funopen so
that you can create FILE pointers to blocks of memory.

Signed-off-by: David Michael Barr <b@rr-dav.id.au>
Makefile: link to libgit2

Signed-off-by: David Michael Barr <b@rr-dav.id.au>
link libgit2 statically

Signed-off-by: David Michael Barr <b@rr-dav.id.au>
compat: integrate fmemopen

Signed-off-by: David Michael Barr <b@rr-dav.id.au>
vcs-svn: remove report_buffer

Signed-off-by: David Michael Barr <b@rr-dav.id.au>
vcs-svn: plumb libgit2 repository

Signed-off-by: David Michael Barr <b@rr-dav.id.au>
vcs-svn: add basic commit logic

Signed-off-by: David Michael Barr <b@rr-dav.id.au>
vcs-svn: read preimage from repository

Signed-off-by: David Michael Barr <b@rr-dav.id.au>
vcs-svn: stream blobs to repository

Signed-off-by: David Michael Barr <b@rr-dav.id.au>
vcs-svn: start passing git_oid about

Signed-off-by: David Michael Barr <b@rr-dav.id.au>
vcs-svn: open repository in current working directory

Signed-off-by: David Michael Barr <b@rr-dav.id.au>
vcs-svn: plumb ls to the index

Signed-off-by: David Michael Barr <b@rr-dav.id.au>
vcs-svn: add simple mark map

Signed-off-by: David Michael Barr <b@rr-dav.id.au>
vcs-svn: include commit id in progress

Signed-off-by: David Michael Barr <b@rr-dav.id.au>
vcs-svn: rename index to fe_index
vcs-svn: fall back to write-tree for directories

Signed-off-by: David Michael Barr <b@rr-dav.id.au>
vcs-svn: handle directory deletion

Signed-off-by: David Michael Barr <b@rr-dav.id.au>
vcs-svn: handle modify to directory

Signed-off-by: David Michael Barr <b@rr-dav.id.au>
vcs-svn: fix strptime warning

Signed-off-by: David Michael Barr <b@rr-dav.id.au>
vcs-svn: 2-phase tree deletion

Signed-off-by: David Michael Barr <b@rr-dav.id.au>