一键安装thrift-0.9.0的脚本

本文发布时间: 2019-Mar-22
#!/bin/sh# 一键安装thrift-0.9.0的脚本# thrift依赖boost、openssl和libevent# 下面的变量值可以根据实现做修改PROJECT_HOME=$HOME/iflow # 项目源码主目录# thrift及依赖的第三方库源码包存放目录和安装目录,# 一键脚本要和第三方库源码包放在同一个目录下THIRD_PARTY_HOME=$PROJECT_HOME/third-partyboost=boost_1_52_0openssl=openssl-1.0.1clibevent=libevent-2.0.19-stablethrift=thrift-0.9.0## 安装boost#printf "\n\033[0;32;34minstalling boost\033[m\n"tar xzf $boost.tar.gzcd $boost./bootstrap.shif test $? -ne 0; thenexit 1fi./b2 install --prefix=$THIRD_PARTY_HOME/boostprintf "\n\033[0;32;34m./b2 install return $?\033[m\n"cd -## 安装openssl#printf "\n\033[0;32;34minstalling openssl\033[m\n"tar xzf $openssl.tar.gzcd $openssl./config --prefix=$THIRD_PARTY_HOME/openssl shared threadsif test $? -ne 0; thenexit 1fimakeif test $? -ne 0; thenexit 1fimake installcd -## 安装libevent#printf "\n\033[0;32;34minstalling libevent\033[m\n"tar xzf $libevent.tar.gzcd $libevent./configure --prefix=$THIRD_PARTY_HOME/libeventif test $? -ne 0; thenexit 1fimakeif test $? -ne 0; thenexit 1fimake installcd -## 安装thrift#printf "\n\033[0;32;34minstalling thrift\033[m\n"tar xzf $thrift.tar.gzcd $thrift# 按照常规的configure,使用--with-openssl,会遇到# “Error: libcrypto required.”错误,这里使用CPPFLAGS和LDFLAGS替代./configure --prefix=$THIRD_PARTY_HOME/thrift \ --with-boost=$THIRD_PARTY_HOME/boost \ --with-libevent=$THIRD_PARTY_HOME/libevent \ CPPFLAGS="-I$THIRD_PARTY_HOME/openssl/include" \ LDFLAGS="-ldl -L$THIRD_PARTY_HOME/openssl/lib" \ --with-qt4=no --with-c_glib=no --with-csharp=no \ --with-java=no --with-erlang=no --with-python=no \ --with-perl=no --with-ruby=no --with-haskell=no \ --with-go=no --with-d=noif test $? -ne 0; thenexit 1fi# 完成上述修改后,configure可以成功了,但还需要下面修改,# 否则make时会报malloc未声明sed -i -e 's!#define HAVE_MALLOC 0!#define HAVE_MALLOC 1!' config.hsed -i -e 's!#define HAVE_REALLOC 0!#define HAVE_REALLOC 1!' config.hsed -i -e 's!#define malloc rpl_malloc!/*#define malloc rpl_malloc*/!' config.hsed -i -e 's!#define realloc rpl_realloc!/*#define realloc rpl_realloc*/!' config.hmakeif test $? -ne 0; thenexit 1fimake installcd -# 安装成功提示一下printf "\n\033[0;32;34minstall SUCCESS\033[m\n"本文出自 “飞月” 博客


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2024-Mar-04 02:11pm
栏目列表