From cb2cec9b0f2f0fa5c1d2f2a36221e0e2376e2539 Mon Sep 17 00:00:00 2001 From: Denis Budyak Date: Sat, 16 Feb 2019 14:51:21 +0300 Subject: [PATCH] Add support to install on windows (#79) * Added some paths that were missing on Windows * Conditionalized 'make install' * Set direction to execute install.sh with bash --- Makefile | 14 +++++--------- install.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 install.sh 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 + +