support installing czmq in default path while zeromq library path is specified


Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/69cf6cbd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/69cf6cbd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/69cf6cbd

Branch: refs/heads/master
Commit: 69cf6cbd8f3ffc63c49de74fe8a5dbc621578b86
Parents: 65afb1a
Author: xiezl <[email protected]>
Authored: Thu Jun 18 14:38:31 2015 +0800
Committer: xiezl <[email protected]>
Committed: Thu Jun 18 14:38:31 2015 +0800

----------------------------------------------------------------------
 README.md             |  4 +-
 thirdparty/install.sh | 98 +++++++++++++++++++++++++++++-----------------
 2 files changed, 65 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/69cf6cbd/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 981e389..0b135d2 100644
--- a/README.md
+++ b/README.md
@@ -91,10 +91,10 @@ Here is a table showing the first arguments:
        zeromq                                  zeromq lib
        zookeeper                               Apache zookeeper
 
-*: Since czmq depends on zeromq, the script offers you one more argument to 
indicate zeromq location.
+*: Since czmq depends on zeromq, the script offers you one more argument with 
"-f" option  to indicate zeromq location.
 The installation commands of czmq can be:
 
-       $ ./install.sh czmq  /usr/local /usr/local/zeromq
+       $ ./install.sh czmq  /usr/local -f /usr/local/zeromq
 
 After the execution, czmq will be installed in /usr/local while zeromq is 
installed in /usr/local/zeromq.
 

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/69cf6cbd/thirdparty/install.sh
----------------------------------------------------------------------
diff --git a/thirdparty/install.sh b/thirdparty/install.sh
index 2b7cfc8..3bffeba 100755
--- a/thirdparty/install.sh
+++ b/thirdparty/install.sh
@@ -47,22 +47,32 @@ function install_czmq()
        tar zxvf czmq-3.0.0-rc1.tar.gz && cd czmq-3.0.0;
        
        if [ $# == 2 ]
+       then
+               if [ $1 == "null" ]
                then
-                       echo "install czmq in $1 and libzmq path is $2";
+                       echo "install czmq in default path. libzmq path is $2";
+                       ./configure --with-libzmq=$2;
+                       make && sudo make install;
+               else
+                       echo "install czmq in $1. libzmq path is $2";
                        ./configure --prefix=$1 --with-libzmq=$2;
                        make && make install;
-               elif [ $# == 1 ]
-               then
-                       echo "install czmq in $1 and libzmq path is default";
-                       ./configure --prefix=$1;
-                       make && make install;
-               elif [ $# == 0 ]
+               fi
+       elif [ $# == 1 ]
+       then
+               if [ $1 == "null" ]
                then
-                       echo "install czmq in default path";
+                       echo "install czmq in default path.";
                        ./configure;
                        make && sudo make install;
                else
-                       echo "wrong commands";
+                       echo "install czmq in $1";
+                       ./configure --prefix=$1;
+                       make && make install;
+               fi
+       else
+               echo "ERROR: wrong command.";
+               return -1;
        fi
 
        if [ $? -ne 0 ]
@@ -381,34 +391,52 @@ do
                ;;
        "czmq")
                echo "install czmq";
-               if [[ $2 == */* ]];then
-                       if [[ $3 == */* ]];then
-                               install_czmq $2 $3;
-                               if [ $? -ne 0 ] 
-                               then
-                                       echo "ERROR during czmq installation" ;
-                                       exit;
-                               fi  
-                               shift
-                               shift
-                               shift
+               if [ $2 == "-f" ]
+               then
+                       if [[ $4 == */* ]]
+                       then
+                               install_czmq $4 $3;
                        else
-                               install_czmq $2;
-                               if [ $? -ne 0 ] 
-                               then
-                                   echo "ERROR during czmq installation" ;
-                                   exit;
-                               fi  
-                               shift
-                               shift
+                               install_czmq null $3;
+                       fi
+                       if [ $? -ne 0 ] 
+                       then
+                               echo "ERROR during czmq installation" ;
+                               exit;
+                       fi
+                       shift
+                       shift
+                       shift
+                       shift
+               elif [ $3 == "-f" ]
+               then
+                       install_czmq $2 $4;
+                       if [ $? -ne 0 ] 
+                       then
+                               echo "ERROR during czmq installation" ;
+                               exit;
+                       fi
+                       shift
+                       shift
+                       shift
+                       shift
+               elif [[ $2 == */* ]]
+               then
+                       install_czmq $2;
+                       if [ $? -ne 0 ] 
+                       then
+                               echo "ERROR during czmq installation" ;
+                               exit;
                        fi
+                       shift
+                       shift
                else
-                       install_czmq;
-                   if [ $? -ne 0 ] 
-                   then
-                       echo "ERROR during czmq installation" ;
-                       exit;
-                   fi  
+                       install_czmq null;
+                       if [ $? -ne 0 ] 
+                       then
+                           echo "ERROR during czmq installation" ;
+                           exit;
+                       fi  
                        shift
                fi
                ;;
@@ -658,7 +686,7 @@ do
                        echo "ERROR during zeromq installation" ;
                        exit;
                    fi  
-                       install_czmq;
+                       install_czmq null;
                    if [ $? -ne 0 ] 
                    then
                        echo "ERROR during czmq installation" ;

Reply via email to