-
Notifications
You must be signed in to change notification settings - Fork 1
/
install-dependencies-linux.sh
executable file
·157 lines (123 loc) · 4.67 KB
/
install-dependencies-linux.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File: install-dependencies.sh
# This file downloads and installs dependencies of the Morrigan project.
# It is designed to be run from the top directory of the project.
# If you got an error about verifying files, it probably means you don't
# have the gnu gpg keys installed. If you'd like to do this, you can download
# https://ftp.gnu.org/gnu/gnu-keyring.gpg and import it into your keyring with
# `gpg --import gnu-keyring.gpg`
set -euo pipefail
MORRIGAN_HOME=$(pwd)
# Tools will be installed at $PREFIX/
PREFIX=$MORRIGAN_HOME/install
# The following file will contain necessary environment variables
# after this script has run.
MORRIGAN_ENV_FILE=$MORRIGAN_HOME/morrigan-env.sh
rm -f $MORRIGAN_ENV_FILE
# Create a file for logging installation progress.
MORRIGAN_LOGS=$MORRIGAN_HOME/logs
LOGFILE=$MORRIGAN_LOGS/install-dependencies.out
mkdir -p $MORRIGAN_HOME/logs
rm -f $LOGFILE
# These versions are known to work with our project. Change them at your
# own risk.
M4_VERSION=1.4.18
AUTOCONF_VERSION=2.69
AUTOMAKE_VERSION=1.16.2
LIBTOOL_VERSION=2.4.6
CMAKEURL='https://github.com/Kitware/CMake/releases/download/v3.21.1/cmake-3.21.1-linux-x86_64.tar.gz'
PINURL='https://software.intel.com/sites/landingpage/pintool/downloads/pin-3.20-98437-gf02b61307-gcc-linux.tar.gz'
#########################################################
# You should not need to edit anything below this line! #
#########################################################
# Make necessesary directories
mkdir -p $MORRIGAN_HOME/deps
mkdir -p $MORRIGAN_HOME/install
#####################
# Install Autotools #
#####################
cd deps
# Get GNU GPG Keys if the file is not found - we do not include it in our git repo
# Download the specified versions, as well as the signatures
wget http://ftp.gnu.org/gnu/m4/m4-${M4_VERSION}.tar.gz
wget http://ftp.gnu.org/gnu/m4/m4-${M4_VERSION}.tar.gz.sig
wget http://ftp.gnu.org/gnu/autoconf/autoconf-${AUTOCONF_VERSION}.tar.gz
wget http://ftp.gnu.org/gnu/autoconf/autoconf-${AUTOCONF_VERSION}.tar.gz.sig
wget http://ftp.gnu.org/gnu/automake/automake-${AUTOMAKE_VERSION}.tar.gz
wget http://ftp.gnu.org/gnu/automake/automake-${AUTOMAKE_VERSION}.tar.gz.sig
wget http://ftp.gnu.org/gnu/libtool/libtool-${LIBTOOL_VERSION}.tar.gz
wget http://ftp.gnu.org/gnu/libtool/libtool-${LIBTOOL_VERSION}.tar.gz.sig
# Verify the downloaded files
gpg --verify m4-${M4_VERSION}.tar.gz.sig
if [ $? -ne 0 ];
then
echo "Warning: Error verifying m4. See comment at top of this file for more info"
sleep 1
fi
gpg --verify autoconf-${AUTOCONF_VERSION}.tar.gz.sig
if [ $? -ne 0 ];
then
echo "Warning: Error verifying autoconf. See comment at top of this file for more info"
sleep 1
fi
gpg --verify automake-${AUTOMAKE_VERSION}.tar.gz.sig
if [ $? -ne 0 ];
then
echo "Warning: Error verifying automake. See comment at top of this file for more info"
sleep 1
fi
gpg --verify libtool-${LIBTOOL_VERSION}.tar.gz.sig
if [ $? -ne 0 ];
then
echo "Warning: Error verifying libtool. See comment at top of this file for more info"
sleep 1
fi
# Decompress
gzip -dc m4-${M4_VERSION}.tar.gz | tar xvf -
gzip -dc autoconf-${AUTOCONF_VERSION}.tar.gz | tar xvf -
gzip -dc automake-${AUTOMAKE_VERSION}.tar.gz | tar xvf -
gzip -dc libtool-${LIBTOOL_VERSION}.tar.gz | tar xvf -
# Build and install
cd m4-${M4_VERSION}
./configure -C --prefix=$PREFIX && make && make install
cd ../autoconf-${AUTOCONF_VERSION}
./configure -C --prefix=$PREFIX && make && make install
cd ../automake-${AUTOMAKE_VERSION}
./configure -C --prefix=$PREFIX && make && make install
cd ../libtool-${LIBTOOL_VERSION}
./configure -C --prefix=$PREFIX && make && make install
cd $MORRIGAN_HOME
echo
echo "MORRIGAN: Autotools successfully installed." | tee -a $LOGFILE
echo
sleep 1
#################
# Install Cmake #
#################
mkdir -p deps/cmake
mkdir -p $PREFIX/bin
mkdir -p $PREFIX/share
cd deps/cmake
wget $CMAKEURL
tar xzf *.tar.gz
cd $(ls -d */)
cp bin/* $PREFIX/bin/
cp -r share/* $PREFIX/share/
cd $MORRIGAN_HOME
echo
echo "MORRIGAN: Cmake successfully installed." | tee -a $LOGFILE
echo
sleep 1
# Install Pin3
mkdir -p $MORRIGAN_HOME/install/packages/pin
cd $MORRIGAN_HOME/install/packages/pin
wget $PINURL
tar xvzf *.tar.gz
MORRIGAN_PIN_HOME=$PWD/$(ls -d */)
echo export PATH=$MORRIGAN_HOME/install/bin:'$PATH' >> $MORRIGAN_ENV_FILE
echo export MORRIGAN_PIN_HOME=$MORRIGAN_PIN_HOME >> $MORRIGAN_ENV_FILE
echo export MORRIGAN_HOME=$MORRIGAN_HOME >> $MORRIGAN_ENV_FILE
echo export MORRIGAN_LOGS=$MORRIGAN_LOGS >> $MORRIGAN_ENV_FILE
echo "MORRIGAN: Pin 3 successfully installed." >> $LOGFILE
echo
echo "MORRIGAN: Autotools, Cmake, and Pin3 have been installed."
echo "MORRIGAN: Update your path by running \"source $MORRIGAN_ENV_FILE\"" | tee -a $LOGFILE