summarylogtreecommitdiffstats
path: root/matlab-support.install
blob: b48c0d294cfc5ed9223aa9cddc84ac2d82fcea5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
## 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.7'
    sed -i "s/CC='gcc'$/CC='gcc-4.7'/g" "$bin_path/mexopts.sh"
    sed -i "s/CXX='g++'$/CXX='g++-4.7'/g" "$bin_path/mexopts.sh"
    sed -i "s/FC='gfortran'$/FC='gfortran-4.7'/g" "$bin_path/mexopts.sh"
}

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