@@ -11,54 +11,71 @@ Vagrant.configure(2) do |config|
11
11
vb . name = "hbc-virtual-machine"
12
12
end
13
13
config . vm . hostname = "hbc-hostname"
14
- config . vm . provision "shell" , inline : <<-SHELL
14
+
15
+ config . vm . provision :shell , :run => 'always' , inline : <<-SHELL
16
+ echo " ===== HBC ===== Updating packages..."
15
17
sudo apt-get update
16
18
sudo apt-get install -y git g++ m4 perl libboost-all-dev htop
17
19
sudo apt-get -y autoremove
18
-
20
+
19
21
#Installing GMP
20
- GMP_V=6.1.2
21
- wget https://gmplib.org/download/gmp/gmp-$GMP_V.tar.bz2
22
- tar -xvjf gmp-$GMP_V.tar.bz2
23
- cd gmp-$GMP_V
24
- ./configure
25
- make
26
- sudo make install
27
- make check
28
- cd ..
29
- rm -fr gmp-$GMP_V*
30
- unset GMP_V
22
+ if [ ! -f "/usr/local/lib/libgmp.a" ]; then
23
+ GMP_V=6.1.2
24
+ echo " ===== HBC ===== Installing GMP-$GMP_V..."
25
+ wget https://gmplib.org/download/gmp/gmp-$GMP_V.tar.bz2
26
+ tar -xvjf gmp-$GMP_V.tar.bz2
27
+ cd gmp-$GMP_V
28
+ ./configure
29
+ make
30
+ sudo make install
31
+ make check
32
+ cd ..
33
+ rm -fr gmp-$GMP_V*
34
+ unset GMP_V
35
+ else
36
+ echo " ===== HBC ===== GMP seems already installed. Skipping..."
37
+ fi
31
38
32
39
#Installing NTL
33
- NTL_V=10.5.0
34
- wget http://www.shoup.net/ntl/ntl-$NTL_V.tar.gz
35
- tar -xvzf ntl-$NTL_V.tar.gz
36
- cd ntl-$NTL_V/src
37
- ./configure NTL_GMP_LIP=on
38
- make
39
- sudo make install
40
- cd ../..
41
- rm -fr ntl-$NTL_V*
42
- unset NTL_V
40
+ if [ ! -f "/usr/local/lib/libntl.a" ]; then
41
+ NTL_V=10.5.0
42
+ echo " ===== HBC ===== Installing NTL-$NTL_V..."
43
+ wget http://www.shoup.net/ntl/ntl-$NTL_V.tar.gz
44
+ tar -xvzf ntl-$NTL_V.tar.gz
45
+ cd ntl-$NTL_V/src
46
+ ./configure NTL_GMP_LIP=on
47
+ make
48
+ sudo make install
49
+ cd ../..
50
+ rm -fr ntl-$NTL_V*
51
+ unset NTL_V
52
+ else
53
+ echo " ===== HBC ===== NTL seems already installed. Skipping..."
54
+ fi
43
55
44
56
#Installing HElib
45
57
cd /vagrant
46
- if [ ! -d "HElib/src" ]; then
47
- echo "HElib/src not found; Building it again..."
48
- #rm -fr HElib
49
- git clone https://github.com/shaih/HElib.git
58
+ if [ ! -f "HElib/src/fhe.a" ]; then
59
+ if [ ! -d "HElib" ]; then
60
+ echo " ===== HBC ===== HElib not found; Downloading and building it..."
61
+ #rm -fr HElib
62
+ git clone https://github.com/shaih/HElib.git
63
+ else
64
+ echo " ===== HBC ===== HElib found but no compiled fhe.a found. Compiling it !"
65
+ fi
50
66
cd HElib/src
51
67
make
52
68
#make check
53
- #1 of the check of HElib fails for some reason
69
+ #1 of the check of HElib fails for some reason
54
70
#make test
55
71
cd ../..
72
+ else
73
+ echo " ===== HBC ===== HElib is present and is assumed to be compiled."
56
74
fi
57
75
58
76
#Building hbc
59
77
make hbc
60
- echo "hbc was successfully built ! Run it with: cd /vagrant && ./hbc"
61
- echo "colorscheme desert" > ~/.vimrc
78
+ echo " ===== HBC ===== hbc was successfully built ! Run it with: cd /vagrant && ./hbc"
62
79
SHELL
63
80
end
64
81
0 commit comments