forked from McStasMcXtrace/McCode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getdeps_mac
executable file
·121 lines (113 loc) · 3.81 KB
/
getdeps_mac
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
#!/bin/sh
DLDIR=$PWD
# Check if we have cmake...
if [ ! -f cmake-3.12.1-Darwin-x86_64.tar.gz ]; then
# Get and install cmake
echo
echo Downloading CMake...
echo
curl -O https://cmake.org/files/v3.12/cmake-3.12.1-Darwin-x86_64.tar.gz
fi
echo
echo Unpacking Cmake ...
echo
tar xzf cmake-3.12.1-Darwin-x86_64.tar.gz
if [ ! -d /Applications/CMake.app/ ]; then
mv cmake-3.12.1-Darwin-x86_64/CMake.app /Applications
fi
cd /usr/local
echo
echo Please give your password to mkdir /usr/local/bin if needed:
echo
sudo mkdir -p bin
cd bin
echo
echo Please give your password to put cmake links in /usr/local/bin if needed:
echo
sudo ln -sf /Applications/CMake.app/Contents/bin/* .
cd $DLDIR
if [ ! -f gfortran-8.1-bin.tar.gz ]; then
echo
echo Downloading gfortran...
echo
curl -O https://datapacket.dl.sourceforge.net/project/hpc/hpc/g95/gfortran-8.1-bin.tar.gz
fi
cd /
echo
echo Please give your password for the installation of gfortran if needed:
echo
sudo tar zxf $DLDIR/gfortran-8.1-bin.tar.gz
echo
echo Spawning installation of xcode if needed...
echo
# Ensure that compilers, git etc. are in place
xcode-select --install
# Check if development headers are in place, especially math.h...
if [ ! -f /usr/include/math.h ]; then
echo "math.h header NOT found in /usr/include!"
echo "Attemping to locate installable package with headers "
HEADERS=`find /Library/Developer/CommandLineTools/Packages -name *pkg`
NUMHEADERS=`find /Library/Developer/CommandLineTools/Packages -name *pkg | wc -l | bc`
echo $NUMHEADERS
echo $HEADERS - i.e. $NUMHEADERS
if [[ "$NUMHEADERS" == "1" ]];
then
echo "Excellent, one header package found, attempting install!"
osascript -e "tell app \"System Events\" to display dialog \"Development headers were not installed in /usr/include and I found a matching package \n\n $HEADERS \n\n--> Suggesting to spawn installation. \n\n Please rerun this tool after installation completes !!\""
rc1=$?;
if [[ $rc1 == 0 ]];
then
echo
echo
echo "******************************************************"
echo "* Requesting installation of development headers! *"
echo "* *"
echo "* Please rerun dependency script after that install *"
echo "******************************************************"
echo
sleep 3
open $HEADERS
exit 0
else
echo
echo
echo "!! Not requesting header package install !!"
echo
echo
sleep 3
exit 1
fi
elif [[ "$NUMHEADERS" == "0" ]];
then
echo "Argh! No package found, inform user!"
osascript -e "tell app \"System Events\" to display dialog \"Development headers were not installed in /usr/include and I did NOT FIND a matching package to install! Please ask McCode Developers what to do with your given version of macOS and Xcode tools!!!\""
exit 1
else
echo "Argh! More than one package found, inform user!"
osascript -e "tell app \"System Events\" to display dialog \"Development headers were not installed in /usr/include and I found several possible packages install! Please try to pick one yourself from the folder that will now open...!!!\""
if [[ $rc1 == 0 ]];
then
echo
echo
echo "******************************************************"
echo "* Opening folder with possible header packages! *"
echo "* *"
echo "* Please rerun dependency script installing one... *"
echo "******************************************************"
echo
sleep 3
open /Library/Developer/CommandLineTools/Packages
exit 0
else
echo
echo
echo "!! Not opening package directory !!"
echo
echo
sleep 3
exit 1
fi
fi
else
echo Excellent, math.h header already found in /usr/include!
fi