Parrot Virtual Machine bindings to libgit2
This is library for Parrot Virtual Machine to provide libgit2 bindings to all languages running on Parrot Virtual Machine.
You need Parrot VM 3.5.0 or higher configured with libffi to compile parrot-libgit2 . 4.6.0 or higher is recommended.
To see if your Parrot has libffi
You should see a true value. If you see a 0 or empty string, your Parrot is not configured with libffi.
The language Winxed is included in Parrot >= 3.5.0, and the build system of parrot-libgit2 uses it. To build parrot-libgit2:
winxed setup.winxed build
parrot-libgit2 uses Rosella to run and implement a test suite.
To run the parrot-libgit2 test suite:
winxed setup.winxed test
winxed setup.winxed install
If you installed Parrot into a system-wide directory that only root can write to, you will need sudo:
sudo winxed setup.winxed install
winxed setup.winxed clean
We read in libgit2 header files and generate an NCI binding file. This file is read in by $PARROT/tools/dev/ncidef2pir.pl and a PIR file is generated which allows Parrot to call libgit2 C functions from PIR.
This only understands function signature API changes, not datastructure API changes. Those are still manually decribed to the StructView PMC in src/Git2/Common.winxed .
This makes it trivial to release a new version of parrot-libgit2 when the libgit2 API changes, which it will for the forseable future. Currently, the 0.15.0 release of libgit2 is supported.
Generating NCI definitions
There is a script called header2nci.pl in bin/ that generates the NCI definition file from a libgit2 header file. Example:
perl ./bin/header2nci.pl /usr/local/include/git2/repository.h
This script has some bugs and does not parse all of libgit2 correctly yet. TODO: Make header2nci.pl able to parse all libgit2 headers.
There is a Makefile target to generate our NCI definitions from libgit2
TODO: add this as a custom step to setup.winxed
Beer, pull requests and patches welcome! Fork and be merry.