diff --git a/Makefile b/Makefile index b60ee5b..1f365ab 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ -export LD_LIBRARY_PATH=$(PWD)/libgit2/install/lib -export DYLD_LIBRARY_PATH=$(PWD)/libgit2/install/lib -export PKG_CONFIG_PATH=$(PWD)/libgit2/install/lib/pkgconfig +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(PWD)/libgit2/install/lib +export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$(PWD)/libgit2/install/lib +export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$(PWD)/libgit2/install/lib/pkgconfig +export C_INCLUDE_PATH=$C_INCLUDE_PATH:$(PWD)/libgit2/install/include URL_BASE_GIT2GO=https://github.com/libgit2/git2go/archive GIT2GO_VERSION=master GOPATH=$(shell go env GOPATH) @@ -24,9 +25,4 @@ build: @echo "Ready to go!" install: - @cp ./libgit2/install/lib/lib* /usr/local/lib/ - @ldconfig /usr/local/lib >/dev/null 2>&1 || echo "ldconfig not found">/dev/null - @cp ./gitql /usr/local/bin/gitql - @ln -s -f /usr/local/bin/gitql /usr/local/bin/git-ql - @echo "Git is in /usr/local/bin/gitql" - @echo "You can also use: git ql 'query here'" + @bash install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..cb4a5a1 --- /dev/null +++ b/install.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +set -ex + +unameOut="$(uname -s)" +case "${unameOut}" in + Linux*) machine=Linux;; + Darwin*) machine=Mac;; + CYGWIN*) machine=Cygwin;; + MINGW*) machine=MinGw;; + *) machine="UNKNOWN:${unameOut}" +esac + +if [[ $machine == MinGw ]] +then + # Everything here is ugly. But MinGW seem to have no ldconfig, + # no respect to /usr/local/bin, /usr/local/lib + cp ./libgit2/install/bin/libgit2.dll /usr/bin/ + cp ./gitql.exe /usr/bin/gitql.exe + ln -s -f /usr/bin/gitql.exe /usr/bin/git-ql + echo "Gitql.exe is in /usr/bin/gitql.exe" + echo "You can also use: git ql 'query here'" +else + cp ./libgit2/install/lib/lib* /usr/local/lib/ + ldconfig /usr/local/lib >/dev/null 2>&1 || echo "ldconfig not found">/dev/null + cp ./gitql /usr/local/bin/gitql + ln -s -f /usr/local/bin/gitql /usr/local/bin/git-ql + echo "Git is in /usr/local/bin/gitql" + echo "You can also use: git ql 'query here'" +fi + +