summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2017-07-01 11:31:06 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2017-07-01 11:31:06 +0100
commit852bd890b7611653aaa93d74f37edec9bd5e984f (patch)
tree3d529e8bf133f42eb046ef0f0853b71fd271392a
parent1f9144c6b95cb8c949a98842dc8d9df64ba94863 (diff)
downloadgall-852bd890b7611653aaa93d74f37edec9bd5e984f.tar.bz2
Remove internal libgit2 and clean up Makefile
This removes the submodule of libgit2 and uses pkg-config to ensure that we get the cflags, libs, etc, for libgit2 sorted properly. Also should reduce noise when libgit2 is not available on the system.
-rw-r--r--.gitmodules3
-rw-r--r--Makefile43
m---------libgit20
3 files changed, 22 insertions, 24 deletions
diff --git a/.gitmodules b/.gitmodules
index 6f8f2a5..8f93b7c 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,6 +1,3 @@
-[submodule "libgit2"]
- path = libgit2
- url = git://git.gitano.org.uk/libgit2.git
[submodule "extras/luacov"]
path = extras/luacov
url = git://git.gitano.org.uk/luacov.git
diff --git a/Makefile b/Makefile
index 506593c..f876431 100644
--- a/Makefile
+++ b/Makefile
@@ -10,14 +10,23 @@ INST_BASE := $(PREFIX)
INST_ROOT := $(DESTDIR)$(INST_BASE)/share/lua/$(LUA_VER)
C_INST_ROOT := $(DESTDIR)$(INST_BASE)/lib/lua/$(LUA_VER)
-INCS := -I/usr/include/lua$(LUA_VER) -Ilibgit2/build/gall-install/include
+ifeq ($(shell pkg-config --exists libgit2 && echo YAY),YAY)
+HAVE_GIT2 := YES
+GIT2_CFLAGS := $(shell pkg-config --cflags libgit2)
+GIT2_LIBS := $(shell pkg-config --libs libgit2)
+else
+HAVE_GIT2 := NO
+GIT2_CFLAGS :=
+GIT2_LIBS :=
+endif
+
+INCS := -I/usr/include/lua$(LUA_VER) $(GIT2_CFLAGS)
OPT := -O0 -g
PIC := -fPIC
WARN := -Wall -Werror
DEFS :=
CFLAGS := $(INCS) $(OPT) $(WARN) $(DEFS) $(PIC) $(CFLAGS)
-LIBGIT2_LDEPS ?= -lssl -lssh2 -lrt
-LFLAGS := -O1 -g -Llibgit2/build/gall-install/lib -lgit2 $(LIBGIT2_LDEPS) $(LFLAGS)
+LFLAGS := -O1 -g $(GIT2_LIBS) $(LFLAGS)
MOD_FILES := $(patsubst %,%.lua,$(subst .,/,$(MODULES)))
@@ -37,33 +46,23 @@ install: cmodule
LUA := LUA_CPATH="$(shell pwd)/lib/?.so;;" LUA_PATH="$(shell pwd)/lib/?.lua;$(shell pwd)/extras/luacov/src/?.lua;;" __GALL_LL_GIT2_BLACKLIST="$(shell lua$(LUA_VER) find-git2)" lua$(LUA_VER) -e "dofile('blacklist-system-git2')"
-cmodule: try-cmodule
+ifeq ($(HAVE_GIT2),YES)
+cmodule: lib/gall/ll/git2.so
-try-cmodule:
- -@$(MAKE) --no-print-directory do-cmodule
-
-do-cmodule: lib/gall/ll/git2.so
-
-lib/gall/ll/git2.so: libgit2/build/gall-install-stamp lib/gall/ll/git2.c
+lib/gall/ll/git2.so: lib/gall/ll/git2.c
$(CC) $(CFLAGS) lib/gall/ll/git2.c -o $@ -shared $(LFLAGS)
-libgit2/build/gall-install-stamp:
- mkdir -p libgit2/build
- cd libgit2/build && cmake -DBUILD_SHARED_LIBS:BOOLEAN=OFF -DCMAKE_INSTALL_PREFIX:PATH=$(shell pwd)/libgit2/build/gall-install -DCMAKE_C_FLAGS=-fPIC ..
- cd libgit2/build && $(MAKE) $(DASH_J)
- echo "DISABLED BECAUSE LIBGIT2 AUTHORS ARE MAD: cd libgit2/build && $(MAKE) test"
- cd libgit2/build && ./libgit2_clar -xonline
- cd libgit2/build && $(MAKE) install DESTDIR=""
- touch $@
+else
+cmodule:
+ @echo "Unable to compile C module, libgit2 not found. SKIPPING"
+endif
clean:
$(RM) luacov.report.out luacov.report.git2.out luacov.stats.out
- $(RM) -r libgit2/build luagit2/build lib/gall/ll/git2.so
+ $(RM) -r lib/gall/ll/git2.so
distclean: clean
find . -name "*~" -delete
- $(RM) libgit2/tests-clar/clar.h
- $(RM) libgit2/tests-clar/clar_main.c
.PHONY: example
example:
@@ -87,12 +86,14 @@ test: cmodule
done; \
$(LUA) extras/luacov/src/bin/luacov -X luacov. -X test. $(MODULES); \
exit $$ERR
+ifeq ($(HAVE_GIT2),YES)
@echo -n "Allowing use of luagit2 saves "; \
PRE=$$(grep sp.spawn_simple luacov.report.git2.out | awk '{print $$1}'); \
POST=$$(grep sp.spawn_simple luacov.report.out | awk '{print $$1}'); \
NORM=$$((POST - PRE)); \
echo -n $$((NORM - PRE)) / $${NORM}; \
echo " calls out to git executable during test suite."
+endif
.PHONY: interactive
interactive:
diff --git a/libgit2 b/libgit2
deleted file mode 160000
-Subproject b4d00c1d2466de3558a7cc6983dce4eb2ee9843