Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
e664a075
Y
YTBP
项目概览
YottaChain
/
YTBP
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YTBP
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e664a075
编写于
5月 09, 2018
作者:
B
Bill Hamilton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
darwin: added check for cmake cache file in eos/ doc root
上级
2ae61517
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
377 addition
and
238 deletion
+377
-238
eosio_build.sh
eosio_build.sh
+4
-0
scripts/eosio_build_darwin.sh
scripts/eosio_build_darwin.sh
+373
-238
未找到文件。
eosio_build.sh
浏览文件 @
e664a075
...
...
@@ -35,6 +35,10 @@
printf
"
\\
n
\\
tPlease cd into directory %s to run this script.
\\
n
\\
tExiting now.
\\
n
\\
n"
"
${
CWD
}
"
exit
1
fi
if
[
-f
"
${
PWD
}
/CMakeCache.txt"
]
;
then
printf
"
\\
n
\\
tPlease remove file %s/CMakeCache.txt before building EOS.IO.
\\
n
\\
tExiting now.
\\
n
\\
n"
"
${
PWD
}
"
exit
1
fi
function
usage
()
{
...
...
scripts/eosio_build_darwin.sh
浏览文件 @
e664a075
OS_VER
=
`
sw_vers
-productVersion
`
OS_MAJ
=
`
echo
"
${
OS_VER
}
"
|
cut
-d
'.'
-f1
`
OS_MIN
=
`
echo
"
${
OS_VER
}
"
|
cut
-d
'.'
-f2
`
OS_PATCH
=
`
echo
"
${
OS_VER
}
"
|
cut
-d
'.'
-f3
`
OS_VER
=
$(
sw_vers
-productVersion
)
OS_MAJ
=
$(
echo
"
${
OS_VER
}
"
|
cut
-d
'.'
-f1
)
OS_MIN
=
$(
echo
"
${
OS_VER
}
"
|
cut
-d
'.'
-f2
)
OS_PATCH
=
$(
echo
"
${
OS_VER
}
"
|
cut
-d
'.'
-f3
)
MEM_GIG
=
`
bc
<<<
"(
$(
sysctl
-in
hw.memsize
)
/ 1024000000)"
`
MEM_GIG
=
$(
bc
<<<
"(
$(
sysctl
-in
hw.memsize
)
/ 1024000000)"
)
CPU_SPEED
=
`
bc
<<<
"scale=2; (
$(
sysctl
-in
hw.cpufrequency
)
/ 10^6) / 10"
`
CPU_SPEED
=
$(
bc
<<<
"scale=2; (
$(
sysctl
-in
hw.cpufrequency
)
/ 10^6) / 10"
)
CPU_CORE
=
$(
sysctl
-in
machdep.cpu.core_count
)
blksize
=
`
df
.
|
head
-1
|
awk
'{print $2}'
|
cut
-d-
-f1
`
gbfactor
=
$((
1073741824
/
$blksize
))
total_blks
=
`
df
.
|
tail
-1
|
awk
'{print $2}'
`
avail_blks
=
`
df
.
|
tail
-1
|
awk
'{print $4}'
`
DISK_TOTAL
=
$((
$total_blks
/
$gbfactor
))
DISK_AVAIL
=
$((
$avail_blks
/
$gbfactor
))
DISK_INSTALL
=
$(
df
-h
.
|
tail
-1
|
tr
-s
' '
|
cut
-d
\
-f1
||
cut
-d
' '
-f1
)
blksize
=
$(
df
.
|
head
-1
|
awk
'{print $2}'
|
cut
-d-
-f1
)
gbfactor
=
$((
1073741824
/
blksize
))
total_blks
=
$(
df
.
|
tail
-1
|
awk
'{print $2}'
)
avail_blks
=
$(
df
.
|
tail
-1
|
awk
'{print $4}'
)
DISK_TOTAL
=
$((
total_blks
/
gbfactor
))
DISK_AVAIL
=
$((
avail_blks
/
gbfactor
))
printf
"
\n\t
OS name:
$ARCH
\n
"
printf
"
\t
OS Version:
${
OS_VER
}
\n
"
printf
"
\t
CPU speed:
${
CPU_SPEED
}
Ghz
\n
"
printf
"
\t
CPU cores:
$CPU_CORE
\n
"
printf
"
\t
Physical Memory:
$MEM_GIG
Gbytes
\n
"
printf
"
\t
Disk space total:
${
DISK_TOTAL
}
G
\n
"
printf
"
\t
Disk space available:
${
DISK_AVAIL
}
G
\n\n
"
printf
"
\\
n
\\
tOS name: %s
\\
n"
"
${
ARCH
}
"
printf
"
\\
tOS Version: %s
\\
n"
"
${
OS_VER
}
"
printf
"
\\
tCPU speed: %sGhz
\\
n"
"
${
CPU_SPEED
}
"
printf
"
\\
tCPU cores: %s
\\
n"
"
${
CPU_CORE
}
"
printf
"
\\
tPhysical Memory: %s Gbytes
\\
n"
"
${
MEM_GIG
}
"
printf
"
\\
tDisk install: %s
\\
n"
"
${
DISK_INSTALL
}
"
printf
"
\\
tDisk space total: %sG
\\
n"
"
${
DISK_TOTAL
}
"
printf
"
\\
tDisk space available: %sG
\\
n
\\
n"
"
${
DISK_AVAIL
}
"
if
[
$MEM_GIG
-lt
7
]
;
then
if
[
"
${
MEM_GIG
}
"
-lt
7
]
;
then
echo
"Your system must have 7 or more Gigabytes of physical memory installed."
echo
"Exiting now."
exit
1
fi
if
[
$OS_MIN
-lt
12
]
;
then
if
[
"
${
OS_MIN
}
"
-lt
12
]
;
then
echo
"You must be running Mac OS 10.12.x or higher to install EOSIO."
echo
"Exiting now."
exit
1
fi
if
[
$DISK_AVAIL
-lt
$DISK_MIN
]
;
then
if
[
"
${
DISK_AVAIL
}
"
-lt
"
$DISK_MIN
"
]
;
then
echo
"You must have at least
${
DISK_MIN
}
GB of available storage to install EOSIO."
echo
"Exiting now."
exit
1
fi
printf
"
\
t
Checking XCode installation
\n
"
XCODESELECT
=
$(
which
xcode-select
)
if
[
$?
-ne
0
]
;
then
printf
"
\
n\t
XCode must be installed in order to proceed.
\n
\n
"
printf
"
\
t
exiting now.
\n
"
printf
"
\
\
tChecking xcode-select installation
\
\
n"
if
!
XCODESELECT
=
$(
command
-v
xcode-select
)
then
printf
"
\
\
n
\\
tXCode must be installed in order to proceed.
\\
n
\
\
n"
printf
"
\
\
tExiting now.
\
\
n"
exit
1
fi
printf
"
\t
XCode installation found.
\n\n
"
printf
"
\\
txcode-select installation found @
\\
n"
printf
"
\\
t%s
\\
n
\\
n"
"
${
XCODESELECT
}
"
printf
"
\
t
Checking Ruby installation
\n
"
RUBY
=
$(
which
ruby
)
if
[
$?
-ne
0
]
;
then
printf
"
\
n
Ruby must be installed in order to proceed.
\n
\n
"
printf
"
\
t
exiting now.
\n
"
printf
"
\
\
tChecking Ruby installation.
\
\
n"
if
!
RUBY
=
$(
command
-v
ruby
)
then
printf
"
\
\
nRuby must be installed in order to proceed.
\\
n
\
\
n"
printf
"
\
\
tExiting now.
\
\
n"
exit
1
fi
printf
"
\t
Ruby installation found.
\n\n
"
printf
"
\t
Checking Home Brew installation
\n
"
BREW
=
$(
which brew
)
if
[
$?
-ne
0
]
;
then
printf
"
\t
Homebrew must be installed to compile EOS.IO
\n\n
"
printf
"
\t
Do you wish to install Home Brew?
\n
"
printf
"
\\
tRuby installation found @
\\
n"
printf
"
\\
t%s
\\
n
\\
n"
"
${
RUBY
}
"
printf
"
\\
tChecking Home Brew installation
\\
n"
if
!
BREW
=
$(
command
-v
brew
)
then
printf
"
\\
tHomebrew must be installed to compile EOS.IO
\\
n
\\
n"
printf
"
\\
tDo you wish to install Home Brew?
\\
n"
select
yn
in
"Yes"
"No"
;
do
case
$yn
in
case
"
${
yn
}
"
in
[
Yy]
*
)
$XCODESELECT
--install
2>/dev/null
;
$RUBY
-e
"
$(
curl
-fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install
)
"
if
[
$?
-ne
0
]
;
then
"
${
XCODESELECT
}
"
--install
2>/dev/null
;
if
!
"
${
RUBY
}
"
-e
"
$(
curl
-fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install
)
"
then
echo
"Unable to install homebrew at this time. Exiting now."
exit
1
;
fi
...
...
@@ -83,82 +87,80 @@
done
fi
printf
"
\t
Home Brew installation found.
\n\n
"
printf
"
\\
tHome Brew installation found @
\\
n"
printf
"
\\
t%s
\\
n
\\
n"
"
${
BREW
}
"
COUNT
=
1
PERMISSION_GETTEXT
=
0
BOOST_CHECK
=
0
DISPLAY
=
""
DEP
=
""
printf
"
\
t
Checking dependencies.
\n
"
var_ifs
=
${
IFS
}
IFS
=
','
printf
"
\
\
tChecking dependencies.
\
\
n"
var_ifs
=
"
${
IFS
}
"
IFS
=
","
while
read
-r
name tester testee brewname uri
do
printf
"
\
t
Checking
$name
...
"
if
[
${
tester
}
${
testee
}
]
;
then
printf
'\t\t %s found\n'
"
$name
"
printf
"
\
\
tChecking %s ... "
"
${
name
}
"
if
[
"
${
tester
}
"
"
${
testee
}
"
]
;
then
printf
"
\\
t
\\
t %s found
\\
n"
"
${
name
}
"
continue
fi
# resolve conflict with homebrew glibtool and apple/gnu installs of libtool
if
[
${
testee
}
==
"/usr/local/bin/glibtool"
]
;
then
if
[
${
tester
}
"/usr/local/bin/libtool"
]
;
then
printf
'\t\t %s found\n'
"
$name
"
if
[
"
${
testee
}
"
==
"/usr/local/bin/glibtool"
]
;
then
if
[
"
${
tester
}
"
"/usr/local/bin/libtool"
]
;
then
printf
"
\\
t
\\
t %s found
\\
n"
"
${
name
}
"
continue
fi
fi
if
[
$brewname
=
"gettext"
]
;
then
if
[
"
${
brewname
}
"
=
"gettext"
]
;
then
PERMISSION_GETTEXT
=
1
fi
DEP
=
$DEP
"
${
brewname
}
"
DISPLAY
=
"
${
DISPLAY
}${
COUNT
}
.
${
name
}
\
n
\t
"
printf
"
\
t\t
${
name
}
${
bldred
}
NOT
${
txtrst
}
found.
\n
"
let
COUNT++
DISPLAY
=
"
${
DISPLAY
}${
COUNT
}
.
${
name
}
\
\
n
\
\
t"
printf
"
\
\
t
\\
t %s
${
bldred
}
NOT
${
txtrst
}
found.
\\
n"
"
${
name
}
"
((
COUNT++
))
done
< scripts/eosio_build_dep
IFS
=
${
var_ifs
}
IFS
=
"
${
var_ifs
}
"
printf
"
\t
Checking Python3 ... "
if
[
-z
`
python3
-c
'import sys; print(sys.version_info.major)'
2>/dev/null
`
]
;
then
printf
"
\
\
tChecking Python3 ... "
if
[
-z
"
$(
python3
-c
'import sys; print(sys.version_info.major)'
2>/dev/null
)
"
]
;
then
DEP
=
$DEP
"python@3 "
DISPLAY
=
"
${
DISPLAY
}${
COUNT
}
. Python 3
\
n
\t
"
printf
"
\
t\t
python3
${
bldred
}
NOT
${
txtrst
}
found.
\n
"
let
DCOUNT++
DISPLAY
=
"
${
DISPLAY
}${
COUNT
}
. Python 3
\
\
n
\
\
t"
printf
"
\
\
t
\\
t python3
${
bldred
}
NOT
${
txtrst
}
found.
\
\
n"
((
DCOUNT++
))
else
printf
"
\
t\t
Python3 found
\n
"
printf
"
\
\
t
\\
t Python3 found
\
\
n"
fi
if
[
$COUNT
-gt
1
]
;
then
printf
"
\
n\t
The following dependencies are required to install EOSIO.
\n
"
printf
"
\
n\t
$DISPLAY
\n\n
"
printf
"
\
\
n
\\
tThe following dependencies are required to install EOSIO.
\
\
n"
printf
"
\
\
n
\\
t%s
\\
n
\\
n"
"
${
DISPLAY
}
"
echo
"Do you wish to install these packages?"
select
yn
in
"Yes"
"No"
;
do
case
$yn
in
[
Yy]
*
)
if
[
$PERMISSION_GETTEXT
-eq
1
]
;
then
sudo chown
-R
$(
whoami
)
/usr/local/share
sudo chown
-R
"
$(
whoami
)
"
/usr/local/share
fi
$XCODESELECT
--install
2>/dev/null
;
printf
"
\
t
Updating Home Brew.
\n
"
brew update
if
[
$?
-ne
0
]
;
then
printf
"
\
t
Unable to update Home Brew at this time.
\n
"
printf
"
\
t
Exiting now.
\n
\n
"
"
${
XCODESELECT
}
"
--install
2>/dev/null
;
printf
"
\
\
tUpdating Home Brew.
\
\
n"
if
!
brew update
then
printf
"
\
\
tUnable to update Home Brew at this time.
\
\
n"
printf
"
\
\
tExiting now.
\\
n
\
\
n"
exit
1
;
fi
printf
"
\t
Installing Dependencies.
\n
"
if
[
"
${
BOOST_CHECK
}
"
=
1
]
;
then
brew remove boost
fi
brew
install
--force
$DEP
if
[
$?
-ne
0
]
;
then
printf
"
\t
Homebrew exited with the above errors.
\n
"
printf
"
\t
Exiting now.
\n\n
"
printf
"
\\
tInstalling Dependencies.
\\
n"
if
!
"
${
BREW
}
"
install
--force
"
${
DEP
}
"
then
printf
"
\\
tHomebrew exited with the above errors.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
brew
unlink
$DEP
&&
brew
link
--force
$DEP
if
[
$?
-ne
0
]
;
then
printf
"
\
t
Homebrew exited with the above errors.
\n
"
printf
"
\
t
Exiting now.
\n
\n
"
if
!
"
${
BREW
}
"
unlink
"{DEP}"
&&
"
${
BREW
}
"
link
--force
"
${
DEP
}
"
then
printf
"
\
\
tHomebrew exited with the above errors.
\
\
n"
printf
"
\
\
tExiting now.
\\
n
\
\
n"
exit
1
;
fi
break
;;
...
...
@@ -167,41 +169,42 @@
esac
done
else
printf
"
\
n\t
No required Home Brew dependencies to install.
\n
"
printf
"
\
\
n
\\
tNo required Home Brew dependencies to install.
\
\
n"
fi
printf
"
\
n\t
Checking boost library installation.
\n
"
BVERSION
=
`
cat
"/usr/local/include/boost/version.hpp"
2>/dev/null |
grep
"#define BOOST_VERSION"
|
tail
-1
|
tr
-s
' '
|
cut
-d
\
-f3
`
printf
"
\
\
n
\\
tChecking boost library installation.
\
\
n"
BVERSION
=
$(
grep
"#define BOOST_VERSION"
"/usr/local/include/boost/version.hpp"
2>/dev/null |
tail
-1
|
tr
-s
' '
|
cut
-d
\
-f3
)
if
[
"
${
BVERSION
}
"
!=
"106600"
]
;
then
if
[
!
-z
"
${
BVERSION
}
"
]
;
then
printf
"
\
t
Found Boost Version
${
BVERSION
}
.
\n
"
printf
"
\
t
EOS.IO requires Boost version 1.66.
\n
"
printf
"
\
t
Would you like to uninstall version
${
BVERSION
}
and install Boost version 1.66.
\n
"
printf
"
\
\
tFound Boost Version %s.
\\
n"
"
${
BVERSION
}
"
printf
"
\
\
tEOS.IO requires Boost version 1.66.
\
\
n"
printf
"
\
\
tWould you like to uninstall version %s and install Boost version 1.66.
\\
n"
"
${
BVERSION
}
"
select
yn
in
"Yes"
"No"
;
do
case
$yn
in
[
Yy]
*
)
if
brew list |
grep
"boost"
then
printf
"
\
t
Unlinking Boost Version
${
BVERSION
}
.
\n
"
echo
unlinking boost
"
${
BVERSION
}
"
if
!
brew
unlink
boost
printf
"
\
\
tUnlinking Boost Version %s.
\\
n"
"
${
BVERSION
}
"
printff
"
\\
tunlinking boost %s
\\
n"
"
${
BVERSION
}
"
if
!
"
${
BREW
}
"
unlink
boost
then
printf
"
\
t
Unable to remove boost libraries at this time. 0
\n
"
printf
"
\
t
Exiting now.
\n
\n
"
printf
"
\
\
tUnable to remove boost libraries at this time. 0
\
\
n"
printf
"
\
\
tExiting now.
\\
n
\
\
n"
exit
1
;
fi
else
printf
"
\
t
Removing Boost Version
${
BVERSION
}
.
\n
"
sudo rm
-rf
"
${
BOOST_ROOT
}
/include/boost"
if
[
$?
-ne
0
]
;
then
printf
"
\
t
Unable to remove boost libraries at this time. 1
\n
"
printf
"
\
t
Exiting now.
\n
\n
"
printf
"
\
\
tRemoving Boost Version %s.
\\
n"
"
${
BVERSION
}
"
if
!
sudo rm
-rf
"
${
BOOST_ROOT
}
/include/boost"
then
printf
"
\
\
tUnable to remove boost libraries at this time. 1
\
\
n"
printf
"
\
\
tExiting now.
\\
n
\
\
n"
exit
1
;
fi
sudo rm
-rf
"
${
BOOST_ROOT
}
/lib/libboost*"
if
[
$?
-ne
0
]
;
then
printf
"
\
t
Unable to remove boost libraries at this time. 2
\n
"
printf
"
\
t
Exiting now.
\n
\n
"
if
!
sudo rm
-rf
"
${
BOOST_ROOT
}
/lib/libboost*"
then
printf
"
\
\
tUnable to remove boost libraries at this time. 2
\
\
n"
printf
"
\
\
tExiting now.
\\
n
\
\
n"
exit
1
;
fi
fi
...
...
@@ -211,170 +214,302 @@
esac
done
fi
printf
"
\
t
Installing boost libraries.
\n
"
printf
"
\
\
tInstalling boost libraries.
\
\
n"
if
[
!
-d
"/usr/local/Cellar/boost/1.66.0"
]
;
then
if
!
brew
install
"https://raw.githubusercontent.com/Homebrew/homebrew-core/76a83d798d76aa43459ceb145b721ba4a16a54a6/Formula/boost.rb"
then
printf
"
\
t
Unable to install boost 1.66 libraries at this time. 0
\n
"
printf
"
\
t
Exiting now.
\n
\n
"
exit
;
printf
"
\
\
tUnable to install boost 1.66 libraries at this time. 0
\
\
n"
printf
"
\
\
tExiting now.
\\
n
\
\
n"
exit
1
;
fi
printf
"
\
t
Pinning boost libraries.
\n
"
printf
"
\
\
tPinning boost libraries.
\
\
n"
if
!
brew pin boost
then
printf
"
\
t
Unable to pin boost libraries at this time. 2
\n
"
printf
"
\
t
Exiting now.
\n
\n
"
exit
;
printf
"
\
\
tUnable to pin boost libraries at this time. 2
\
\
n"
printf
"
\
\
tExiting now.
\\
n
\
\
n"
exit
1
;
fi
else
if
!
brew switch boost 1.66.0
then
printf
"
\
t
Unable to swtich boost libraries to 1.66.0 at this time. 1
\n
"
printf
"
\
t
Exiting now.
\n
\n
"
printf
"
\
\
tUnable to swtich boost libraries to 1.66.0 at this time. 1
\
\
n"
printf
"
\
\
tExiting now.
\\
n
\
\
n"
exit
;
fi
fi
printf
"
\
t
Boost 1.66.0 successfully installed @ /usr/local.
\n
"
printf
"
\
\
tBoost 1.66.0 successfully installed @ /usr/local.
\
\
n"
else
printf
"
\
t
Boost 1.66.0 found at /usr/local.
\n
"
printf
"
\
\
tBoost 1.66.0 found at /usr/local.
\
\
n"
fi
printf
"
\n\t
Checking MongoDB C++ driver installation.
\n
"
if
[
!
-e
/usr/local/lib/libmongocxx-static.a
]
;
then
cd
${
TEMP_DIR
}
brew
install
--force
pkgconfig
brew
unlink
pkgconfig
&&
brew
link
--force
pkgconfig
printf
"
\\
n
\\
tChecking MongoDB C++ driver installation.
\\
n"
if
[
!
-e
"/usr/local/lib/libmongocxx-static.a"
]
;
then
if
!
cd
"
${
TEMP_DIR
}
"
then
printf
"
\\
tUnable to enter directory %s.
\\
n"
"
${
TEMP_DIR
}
"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
pkgconfig
=
$(
"
${
BREW
}
"
list |
grep
pkg-config
)
then
if
!
"
${
BREW
}
"
install
--force
pkg-config
then
printf
"
\\
tHomebrew returned an error installing pkg-config.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
"
${
BREW
}
"
unlink
pkg-config
&&
"
${
BREW
}
"
link
--force
pkg-config
then
printf
"
\\
tHomebrew returned an error linking pkgconfig.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
fi
STATUS
=
$(
curl
-LO
-w
'%{http_code}'
--connect-timeout
30 https://github.com/mongodb/mongo-c-driver/releases/download/1.9.3/mongo-c-driver-1.9.3.tar.gz
)
if
[
"
${
STATUS
}
"
-ne
200
]
;
then
rm
-f
${
TEMP_DIR
}
/mongo-c-driver-1.9.3.tar.gz
printf
"
\t
Unable to download MongoDB C driver at this time.
\n
"
printf
"
\t
Exiting now.
\n\n
"
exit
;
fi
tar
xf mongo-c-driver-1.9.3.tar.gz
rm
-f
${
TEMP_DIR
}
/mongo-c-driver-1.9.3.tar.gz
cd
mongo-c-driver-1.9.3
./configure
--enable-static
--with-libbson
=
bundled
--enable-ssl
=
darwin
--disable-automatic-init-and-cleanup
--prefix
=
/usr/local
if
[
$?
-ne
0
]
;
then
printf
"
\t
Configuring MongoDB C driver has encountered the errors above.
\n
"
printf
"
\t
Exiting now.
\n\n
"
exit
;
fi
make
-j
${
CPU_CORE
}
if
[
$?
-ne
0
]
;
then
printf
"
\t
Error compiling MongoDB C driver.
\n
"
printf
"
\t
Exiting now.
\n\n
"
exit
;
fi
sudo
make
install
if
[
$?
-ne
0
]
;
then
printf
"
\t
Error installing MongoDB C driver.
\n
Make sure you have sudo privileges.
\n
"
printf
"
\t
Exiting now.
\n\n
"
exit
;
fi
cd
..
rm
-rf
${
TEMP_DIR
}
/mongo-c-driver-1.9.3
cd
${
TEMP_DIR
}
rm
-rf
${
TEMP_DIR
}
/mongo-cxx-driver
git clone https://github.com/mongodb/mongo-cxx-driver.git
--branch
releases/stable
--depth
1
if
[
$?
-ne
0
]
;
then
printf
"
\t
Unable to clone MongoDB C++ driver at this time.
\n
"
printf
"
\t
Exiting now.
\n\n
"
exit
;
fi
cd
mongo-cxx-driver/build
cmake
-DBUILD_SHARED_LIBS
=
OFF
-DCMAKE_BUILD_TYPE
=
Release
-DCMAKE_INSTALL_PREFIX
=
/usr/local ..
if
[
$?
-ne
0
]
;
then
printf
"
\t
Cmake has encountered the above errors building the MongoDB C++ driver.
\n
"
printf
"
\t
Exiting now.
\n\n
"
exit
;
fi
make
-j
${
CPU_CORE
}
if
[
$?
-ne
0
]
;
then
printf
"
\t
Error compiling MongoDB C++ driver.
\n
"
printf
"
\t
Exiting now.
\n\n
"
exit
;
fi
sudo
make
install
if
[
$?
-ne
0
]
;
then
printf
"
\t
Error installing MongoDB C++ driver.
\n
Make sure you have sudo privileges.
\n
"
printf
"
\t
Exiting now.
\n\n
"
exit
;
fi
cd
rm
-rf
${
TEMP_DIR
}
/mongo-cxx-driver
if
!
rm
-f
"
${
TEMP_DIR
}
/mongo-c-driver-1.9.3.tar.gz"
then
printf
"
\\
tUnable to remove file %s/mongo-c-driver-1.9.3.tar.gz.
\\
n"
"
${
TEMP_DIR
}
"
fi
printf
"
\\
tUnable to download MongoDB C driver at this time.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
tar
xf mongo-c-driver-1.9.3.tar.gz
then
printf
"
\\
tUnable to unarchive file mongo-c-driver-1.9.3.tar.gz.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
rm
-f
"
${
TEMP_DIR
}
/mongo-c-driver-1.9.3.tar.gz"
then
printf
"
\\
tUnable to remove file mongo-c-driver-1.9.3.tar.gz.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
cd
mongo-c-driver-1.9.3
then
printf
"
\\
tUnable to cd into directory %s/mongo-c-driver-1.9.3.
\\
n"
"
${
TEMP_DIR
}
"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
./configure
--enable-static
--with-libbson
=
bundled
--enable-ssl
=
darwin
--disable-automatic-init-and-cleanup
--prefix
=
/usr/local
then
printf
"
\\
tConfiguring MongoDB C driver has encountered the errors above.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
make
-j
"
${
CPU_CORE
}
"
then
printf
"
\\
tError compiling MongoDB C driver.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
sudo
make
install
then
printf
"
\\
tError installing MongoDB C driver.
\\
nMake sure you have sudo privileges.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
cd
"
${
TEMP_DIR
}
"
then
printf
"
\\
tUnable to enter directory %s.
\\
n"
"
${
TEMP_DIR
}
"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
rm
-rf
"
${
TEMP_DIR
}
/mongo-c-driver-1.9.3"
then
printf
"
\\
tUnable to remove directory %s/mongo-c-driver-1.9.3.
\\
n"
"
${
TEMP_DIR
}
"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
git clone https://github.com/mongodb/mongo-cxx-driver.git
--branch
releases/stable
--depth
1
then
printf
"
\\
tUnable to clone MongoDB C++ driver at this time.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
cd
"
${
TEMP_DIR
}
/mongo-cxx-driver/build"
then
printf
"
\\
tUnable to enter directory %s/mongo-cxx-driver/build.
\\
n"
"
${
TEMP_DIR
}
"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
cmake
-DBUILD_SHARED_LIBS
=
OFF
-DCMAKE_BUILD_TYPE
=
Release
-DCMAKE_INSTALL_PREFIX
=
/usr/local ..
then
printf
"
\\
tCmake has encountered the above errors building the MongoDB C++ driver.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
make
-j
"
${
CPU_CORE
}
"
then
printf
"
\\
tError compiling MongoDB C++ driver.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
sudo
make
install
then
printf
"
\\
tError installing MongoDB C++ driver.
\\
nMake sure you have sudo privileges.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
cd
"
${
TEMP_DIR
}
"
then
printf
"
\\
tUnable to enter directory %s.
\\
n"
"
${
TEMP_DIR
}
"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
rm
-rf
"
${
TEMP_DIR
}
/mongo-cxx-driver"
then
printf
"
\\
tUnable to remove directory %s/mongo-cxx-driver.
\\
n"
"
${
TEMP_DIR
}
"
"
${
TEMP_DIR
}
"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
printf
"
\\
tMongo C++ driver installed at /usr/local/lib/libmongocxx-static.a.
\\
n"
else
printf
"
\
t
Mongo C++ driver found at /usr/local/lib/libmongocxx-static.a.
\n
"
printf
"
\
\
tMongo C++ driver found at /usr/local/lib/libmongocxx-static.a.
\
\
n"
fi
printf
"
\
n\t
Checking secp256k1-zkp installation.
\n
"
printf
"
\
\
n
\\
tChecking secp256k1-zkp installation.
\
\
n"
# install secp256k1-zkp (Cryptonomex branch)
if
[
!
-e
/usr/local/lib/libsecp256k1.a
]
;
then
cd
${
TEMP_DIR
}
git clone https://github.com/cryptonomex/secp256k1-zkp.git
if
[
$?
-ne
0
]
;
then
printf
"
\t
Unable to clone repo secp256k1-zkp @ https://github.com/cryptonomex/secp256k1-zkp.git.
\n
"
printf
"
\t
Exiting now.
\n\n
"
exit
;
fi
cd
secp256k1-zkp
./autogen.sh
if
[
$?
-ne
0
]
;
then
printf
"
\t
Error running autogen
\n
"
printf
"
\t
Exiting now.
\n\n
"
exit
;
fi
./configure
make
-j
${
CPU_CORE
}
if
[
$?
-ne
0
]
;
then
printf
"
\t
Error compiling secp256k1-zkp.
\n
"
printf
"
\t
Exiting now.
\n\n
"
exit
;
fi
sudo
make
install
rm
-rf
${
TEMP_DIR
}
/secp256k1-zkp
if
[
!
-e
"/usr/local/lib/libsecp256k1.a"
]
;
then
if
!
cd
"
${
TEMP_DIR
}
"
then
printf
"
\\
tUnable to enter directory %s.
\\
n"
"
${
TEMP_DIR
}
"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
git clone https://github.com/cryptonomex/secp256k1-zkp.git
then
printf
"
\\
tUnable to clone repo secp256k1-zkp @ https://github.com/cryptonomex/secp256k1-zkp.git.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
cd
"
${
TEMP_DIR
}
/secp256k1-zkp"
then
printf
"
\\
tUnable to enter directory %s/secp256k1-zkp.
\\
n"
"
${
TEMP_DIR
}
"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
./autogen.sh
then
printf
"
\\
tError running autogen.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
./configure
then
printf
"
\\
tConfiguring secp256k1-zkp has returned the above error.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
make
-j
"
${
CPU_CORE
}
"
then
printf
"
\\
tError compiling secp256k1-zkp.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
sudo
make
install
then
printf
"
\\
tInstalling secp256k1-zkp has returned the above error.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
rm
-rf
"
${
TEMP_DIR
}
/secp256k1-zkp"
then
printf
"
\\
tUnable to remove directory %s/secp256k1-zkp56k1-zkp.
\\
n"
"
${
TEMP_DIR
}
"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
printf
"
\\
n
\\
n
\\
tSuccessffully installed secp256k1 @ /usr/local/lib/.
\\
n
\\
n"
else
printf
"
\
t
secp256k1 found at /usr/local/lib/
\n
"
printf
"
\
\
tsecp256k1 found at /usr/local/lib/.
\
\
n"
fi
printf
"
\
n\t
Checking LLVM with WASM support.
\n
"
printf
"
\
\
n
\\
tChecking LLVM with WASM support.
\
\
n"
if
[
!
-d
/usr/local/wasm/bin
]
;
then
cd
${
TEMP_DIR
}
mkdir
wasm-compiler
cd
wasm-compiler
git clone
--depth
1
--single-branch
--branch
release_40 https://github.com/llvm-mirror/llvm.git
if
[
$?
-ne
0
]
;
then
printf
"
\t
Unable to clone llvm repo @ https://github.com/llvm-mirror/llvm.git.
\n
"
printf
"
\t
Exiting now.
\n\n
"
exit
;
fi
cd
llvm/tools
git clone
--depth
1
--single-branch
--branch
release_40 https://github.com/llvm-mirror/clang.git
if
[
$?
-ne
0
]
;
then
printf
"
\t
Unable to clone clang repo @ https://github.com/llvm-mirror/clang.git.
\n
"
printf
"
\t
Exiting now.
\n\n
"
exit
;
fi
cd
..
mkdir
build
cd
build
sudo
cmake
-G
"Unix Makefiles"
-DCMAKE_INSTALL_PREFIX
=
/usr/local/wasm
\
if
!
cd
"
${
TEMP_DIR
}
"
then
printf
"
\\
tUnable to enter directory %s.
\\
n"
"
${
TEMP_DIR
}
"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
mkdir
"
${
TEMP_DIR
}
/wasm-compiler"
then
printf
"
\\
tUnable to create directory %s/wasm-compiler.
\\
n"
"
${
TEMP_DIR
}
"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
cd
"
${
TEMP_DIR
}
/wasm-compiler"
then
printf
"
\\
tUnable to enter directory %s/wasm-compiler.
\\
n"
"
${
TEMP_DIR
}
"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
git clone
--depth
1
--single-branch
--branch
release_40 https://github.com/llvm-mirror/llvm.git
then
printf
"
\\
tUnable to clone llvm repo @ https://github.com/llvm-mirror/llvm.git.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
cd
"
${
TEMP_DIR
}
/wasm-compiler/llvm/tools"
then
printf
"
\\
tUnable to enter directory %s/wasm-compiler/llvm/tools.
\\
n"
"
${
TEMP_DIR
}
"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
git clone
--depth
1
--single-branch
--branch
release_40 https://github.com/llvm-mirror/clang.git
then
printf
"
\\
tUnable to clone clang repo @ https://github.com/llvm-mirror/clang.git.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
cd
"
${
TEMP_DIR
}
/wasm-compiler/llvm"
then
printf
"
\\
tUnable to enter directory %s/wasm-compiler/llvm.
\\
n"
"
${
TEMP_DIR
}
"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
mkdir
"
${
TEMP_DIR
}
/wasm-compiler/llvm/build"
then
printf
"
\\
tUnable to create directory %s/wasm-compiler/llvm/build.
\\
n"
"
${
TEMP_DIR
}
"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
cd
"
${
TEMP_DIR
}
/wasm-compiler/llvm/build"
then
printf
"
\\
tUnable to enter directory %s/wasm-compiler/llvm/build.
\\
n"
"
${
TEMP_DIR
}
"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
cmake
-G
"Unix Makefiles"
-DCMAKE_INSTALL_PREFIX
=
/usr/local/wasm
\
-DLLVM_TARGETS_TO_BUILD
=
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD
=
WebAssembly
\
-DCMAKE_BUILD_TYPE
=
Release ../
if
[
$?
-ne
0
]
;
then
printf
"
\t
Error compiling WASM.
\n
"
printf
"
\t
Exiting now.
\n\n
"
exit
;
then
printf
"
\\
tError compiling LLVM/Clang with WASM support.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
sudo
make
-j
"
${
CPU_CORE
}
"
install
then
printf
"
\\
tCompiling LLVM/Clang with WASM support has exited with the error above.
\\
n"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
if
!
sudo rm
-rf
"
${
TEMP_DIR
}
/wasm-compiler"
then
printf
"
\\
tUnable to remove directory %s/wasm-compiler.
\\
n"
"
${
TEMP_DIR
}
"
printf
"
\\
tExiting now.
\\
n
\\
n"
exit
1
;
fi
sudo
make
-j
${
CPU_CORE
}
install
sudo rm
-rf
${
TEMP_DIR
}
/wasm-compiler
printf
"
\\
tSuccessfully installed LLVM/Clang with WASM support @ /usr/local/wasm/bin/.
\\
n"
else
printf
"
\
t
WASM found at /usr/local/wasm/bin/
\n
"
printf
"
\
\
tWASM found at /usr/local/wasm/bin/.
\
\
n"
fi
function
print_instructions
()
{
printf
"
\
n\t
$(
which mongod
)
-f
${
MONGOD_CONF
}
&
\n
"
printf
"
\
t
cd
${
BUILD_DIR
}
; make test
\n\n
"
printf
"
\
\
n
\\
t%s -f %s &
\\
n"
"
$(
command
-v
mongod
)
"
"
${
MONGOD_CONF
}
"
printf
"
\
\
tcd %s; make test
\\
n
\\
n"
"
${
BUILD_DIR
}
"
return
0
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录