summarylogtreecommitdiffstats
path: root/matlab-support.install
blob: 975835e23a18e8221a308377d726cf8a0b107ce7 (plain)
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
## This install script will find the currently installed version of MATLAB (via
## the PATH) and patch the mexopts.sh script to use GCC 4.7 from the AUR.  This
## is required as MATLAB does not currently support versions newer than 4.7.

post_install() {
    post_upgrade
}
post_upgrade() {
    bin_path=$(dirname $(readlink -f $(which matlab)))
    echo 'Patching MATLAB to use gcc-4.9'
    sed -i "s/CC='gcc-4.7'$/CC='gcc-4.9'/g" "$bin_path/mexopts.sh"
    sed -i "s/CXX='g++-4.7'$/CXX='g++-4.9'/g" "$bin_path/mexopts.sh"
    sed -i "s/FC='gfortran-4.7'$/FC='gfortran-4.9'/g" "$bin_path/mexopts.sh"
    sed -i "s/CC='gcc'$/CC='gcc-4.9'/g" "$bin_path/mexopts.sh"
    sed -i "s/CXX='g++'$/CXX='g++-4.9'/g" "$bin_path/mexopts.sh"
    sed -i "s/FC='gfortran'$/FC='gfortran-4.9'/g" "$bin_path/mexopts.sh"
}

post_remove() {
    bin_path=$(dirname $(readlink -f $(which matlab)))
    echo 'Removing gcc-4.9 patch'
    sed -i "s/CC='gcc-4.9'$/CC='gcc'/g" "$bin_path/mexopts.sh"
    sed -i "s/CXX='g++-4.9'$/CXX='g++'/g" "$bin_path/mexopts.sh"
    sed -i "s/FC='gfortran-4.9'$/FC='gfortran'/g" "$bin_path/mexopts.sh"
}