forked from paypal/seifnode
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstallrng.sh
executable file
·79 lines (57 loc) · 1.36 KB
/
installrng.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/sh
unamestr=`node -e "console.log(process.platform);"`
npm install nan
if [[ "$unamestr" != "win32" ]]; then
echo `pwd`
rngConfigFile="`pwd`/config"
mkdir deps
cd deps
git clone https://github.com/paypal/seifrng.git
cd seifrng
if [ -d "./build" ]; then
rm -rf build
fi
rngCmakeCmd="cmake ../"
if ! type cmake > /dev/null; then
# attempt to install cmake
echo "Attempting to install cmake locally....."
echo "This is slow. It is recommended that cmake be installed globally."
if [ ! -d "./3rdParty" ]; then
mkdir 3rdParty
fi
cd 3rdParty
git clone https://gitlab.kitware.com/cmake/cmake.git
cd cmake
./bootstrap && make -j4
rngCmakeCmd="../3rdParty/cmake/bin/cmake ../"
cd ../../
fi
mkdir build
cd build
rngBuildCmd="make"
rngBuildInstallCmd="make install"
echo "Runnning $rngCmakeCmd"
eval $rngCmakeCmd
echo "Runnning $rngBuildInstallCmd"
eval $rngBuildInstallCmd
if [[ $? != 0 ]]; then
exit 1
fi
echo "Running $rngBuildCmd"
echo `$rngBuildCmd`
if [ -d "../3rdParty/cryptopp" ]; then
echo "CryptoPP Installed Locally."
else
if [ ! -d "../3rdParty" ]; then
mkdir ../3rdParty
fi
echo "Moving CryptoPP."
cp -r /usr/local/include/cryptopp ../3rdParty
cp /usr/local/lib/libcryptopp.a ../3rdParty/cryptopp/libcryptopp.a
fi
cd ../../../
node-gyp rebuild
else
echo "[Error] OS not supported."
exit 1
fi