-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_heasoft_mac.sh
59 lines (43 loc) · 1.6 KB
/
setup_heasoft_mac.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
#!/bin/bash
#Currently built for Mac OSX - Catalina 10.15.6 on 09/16/2020
#Arguments from command line
heasoftVersion=$1 #Heasoft verison to set up
destinationDir=$2 #Relative (or absolute) path directory where to place the HEASoft directory
zshrcFile=$3 #Path to .zshrc file
#Setting compilers as environmental variables
export CC=/usr/local/bin/gcc-10
export CXX=/usr/local/bin/g++-10
export FC=/usr/local/bin/gfortran-10
#System archetecture (current)
archName="x86_64-apple-darwin19.6.0"
#Finding absolute path to current location to return user after completed
originalLocation=$(pwd)
#HEASoft tar.gz (gzip tarball)
heasoftFile="heasoft-${heasoftVersion}src.tar.gz"
#URL for download for HEASoft with all moddern packages
heasoftUrl="https://heasarc.gsfc.nasa.gov/FTP/software/lheasoft/lheasoft${heasoftVersion}/${heasoftFile}"
#Going to directory
cd ${destinationDir}
#Finding absolute path of destination directory (useful for later)
absolutePathDestination=$(pwd)
#Downloading XSPEC tar.gz file
wget ${heasoftUrl}
#Unzipping tar.gz file
tar -xvf ${heasoftFile}
rm -f ${heasoftFile}
#Finding absolute path of destination directory (useful for later)
absolutePathDestination=$(pwd)
#Going to BUILD_DIR for installation
cd "heasoft-${heasoftVersion}"
cd BUILD_DIR
#Running configuration script
./configure
#Running makefile
make
make install
#Adding the necessary components to the .zshrc file
heaDir="${absolutePathDestination}/heasoft-${heasoftVersion}/${archName}"
echo "export HEADAS=${heaDir}" >> $zshrcFile
echo "alias heainit=\". \$HEADAS/headas-init.sh\"" >> $zshrcFile
#Returning user
cd ${originalLocation}