-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall-dependencies-macos.sh
executable file
·121 lines (92 loc) · 3.6 KB
/
install-dependencies-macos.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
# File: install-dependencies-macos.sh
# This file downloads and installs dependencies of the Morrigan project.
# It is designed to be run from the top directory of the project.
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.4/cmake-3.21.4-macos-universal.tar.gz'
PINURL='https://software.intel.com/sites/landingpage/pintool/downloads/pin-3.20-98437-gf02b61307-clang-mac.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
curl -L http://ftp.gnu.org/gnu/m4/m4-${M4_VERSION}.tar.gz > m4-${M4_VERSION}.tar.gz
curl -L http://ftp.gnu.org/gnu/autoconf/autoconf-${AUTOCONF_VERSION}.tar.gz > autoconf-${AUTOCONF_VERSION}.tar.gz
curl -L http://ftp.gnu.org/gnu/automake/automake-${AUTOMAKE_VERSION}.tar.gz > automake-${AUTOMAKE_VERSION}.tar.gz
curl -L http://ftp.gnu.org/gnu/libtool/libtool-${LIBTOOL_VERSION}.tar.gz > libtool-${LIBTOOL_VERSION}.tar.gz
# 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
echo "MORRIGAN: Downloading Cmake." | tee -a $LOGFILE
cd deps/cmake
curl -L $CMAKEURL > cmake.tar.gz
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 #
################
echo "MORRIGAN: Downloading Pin 3." | tee -a $LOGFILE
mkdir -p $MORRIGAN_HOME/install/packages/pin
cd $MORRIGAN_HOME/install/packages/pin
curl -L $PINURL > pin-3.tar.gz
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