Skip to content

Commit

Permalink
This commit is mostly dedicated to build pains
Browse files Browse the repository at this point in the history
  • Loading branch information
fxfactorial committed May 28, 2015
1 parent 5a6ccd2 commit b429ac8
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 17 deletions.
4 changes: 2 additions & 2 deletions META
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ name = "ocaml-libgit2"
version = "0.01"
description = "Convenient OCaml C bindings to libgit2, along with helper functions"
requires ="ctypes,ctypes.foreign,uri"
# archive(byte) = "git.cmo"
archive(native) ="git.cmx"
archive(byte) = "git.cmo"
archive(native) ="git.cmx"
34 changes: 24 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
ROOT := $(shell pwd)
PACKAGES := ctypes.foreign,uri
CCLIB := libgit2.0.22.0.dylib
SRC := git.ml

.PHONY:clean git_test build_libgit
.PHONY: clean

git_test:
ocamlfind ocamlopt -package $(PACKAGES) -cclib $(CCLIB) \
-linkpkg $(SRC) -o $@
./$@
native:libgit set_meta
ocamlfind ocamlopt -package $(PACKAGES) \
-cclib `ocamlfind query ocaml-libgit2`/$(CCLIB) -linkpkg $(SRC) -o Git_test

build_libgit:
libgit:
@echo "Updating libgit2 itself"
git submodule update --remote
mkdir libgit2/build
cmake libgit2
cmake --build libgit2/build/
ocamlfind install ocaml-libgit2 META
# The trick is the ; since cd is done in a separate shell
cd `ocamlfind query ocaml-libgit2`; \
cmake $(ROOT)/libgit2 -DBUILD_CLAR=OFF; \
cmake --build .; \
find . -not -name "*.dylib" -not -name "META" -delete

set_meta:
#Need something better
echo "linkopts = \"-cclib" `ocamlfind query ocaml-libgit2`/$(CCLIB)"\"" >> \
`ocamlfind query ocaml-libgit2`/META

install:
ocamlfind install ocaml-libgit2 -add git.cmo git.cmi git.cmt git.o git.cmx

uninstall:
ocamlfind remove ocaml-libgit2
clean:
rm -rf *.cmi *.cmt *.cmx *.cmo *.o git_test libgit_gen_*
rm -rf *.cmi *.cmt *.cmx *.cmo *.o git_test libgit_gen_* a.out
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@

This package provides bindings to [libgit2](https://libgit2.github.com). The modules are organized
all under the `Git` module where the submodules correspond to all the
headers in the [include](https://github.com/libgit2/libgit2/tree/master/include/git2) directory of libgit2.
headers in the [include](https://github.com/libgit2/libgit2/tree/master/include/git2) of libgit2.

# Helpers

The root `Git` module also contains helper functions for common
tasks. These let you deal with OCaml values rather than dealing with
the `Ctypes` library.
the `Ctypes` library.

# Installation

Since I work on OS X primarily, my first goal is to have this working
transparently and cleanly on that platform first.

# Documentation

I'm trying to expose as much of the API as I can and the naming is 1-1
between the OCaml side and C.
If lost, the best documentation is libgit2's [docs](https://libgit2.github.com/libgit2/#HEAD)
between the OCaml side and C. If lost then look at libgit2's own
[docs](https://libgit2.github.com/libgit2/#HEAD).
1 change: 1 addition & 0 deletions git.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
open Ctypes
open Foreign


module Common = struct

let git_feature_t = typedef int64_t "git_feature_t"
Expand Down
Binary file removed libgit2.0.22.0.dylib
Binary file not shown.

0 comments on commit b429ac8

Please sign in to comment.