From c3fca84f25d6f33505ee6a9111d4674247ee5ebb Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 4 Dec 2014 01:56:01 -0800 Subject: [PATCH] Add git and mercurial as dependencies --- DEVELOPERS.md | 12 +++++++++++- Makefile | 5 ++++- checkdeps.sh | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100755 checkdeps.sh diff --git a/DEVELOPERS.md b/DEVELOPERS.md index fde00da2d..46e789b4a 100644 --- a/DEVELOPERS.md +++ b/DEVELOPERS.md @@ -1,6 +1,16 @@ ### Build Dependencies This installation document assumes Ubuntu 12.04 or later on x86-64. +##### Install Git and GCC +```sh +$ sudo apt-get install git build-essential +``` + +##### Install Mercurial +```sh +$ sudo apt-get install mercurial +``` + ##### Install YASM ```sh $ sudo apt-get install yasm @@ -20,7 +30,7 @@ $ export PATH=$PATH:$GOPATH/bin ``` ### Setup your Minio Github Repository     -Fork [Minio upstream](https://github.com/Minio-io/minio) source repository to your own personal repository. Copy the URL and pass it to ``go get`` command. Go uses git to clone a copy into your project workspace folder. +Fork [Minio upstream](https://github.com/Minio-io/minio) source repository to your own personal repository. Copy the URL and pass it to ``go get`` command. Go uses git to clone a copy into your project workspace folder. ```sh $ go get -u github.com/$USER_ID/minio $ cd $GOPATH/src/github.com/$USER_ID/minio/ diff --git a/Makefile b/Makefile index b3ca9139e..92b1a6e09 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,10 @@ MAKE_OPTIONS := -s all: getdeps cover install -getdeps: +checkdeps: + @./checkdeps.sh + +getdeps: checkdeps @go get github.com/tools/godep && echo "Installing godep" @go get code.google.com/p/go.tools/cmd/cover && echo "Installing cover" diff --git a/checkdeps.sh b/checkdeps.sh new file mode 100755 index 000000000..ddb2df578 --- /dev/null +++ b/checkdeps.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +echo -n "Checking dependencies for Minio.. " + +## Check all dependencies are present +MISSING="" + +env git --version > /dev/null 2>&1 +if [ $? -ne 0 ]; then + MISSING="${MISSING} git" +fi + +env hg --version > /dev/null 2>&1 +if [ $? -ne 0 ]; then + MISSING="${MISSING} mercurial" +fi + +env gcc --version > /dev/null 2>&1 +if [ $? -ne 0 ]; then + MISSING="${MISSING} build-essential" +fi + +## If dependencies are missing, warn the user and abort +if [ "x${MISSING}" != "x" ]; then + echo "ERROR" + echo + echo "The following build tools are missing:" + echo + echo "** ${MISSING} **" + echo + echo "Please install them " + echo "$ sudo apt-get install ${MISSING}" + echo + exit 1 +fi +echo "SUCCESS"