summarylogtreecommitdiffstats
path: root/matlab-support.install
diff options
context:
space:
mode:
Diffstat (limited to 'matlab-support.install')
-rw-r--r--matlab-support.install22
1 files changed, 22 insertions, 0 deletions
diff --git a/matlab-support.install b/matlab-support.install
new file mode 100644
index 000000000000..b48c0d294cfc
--- /dev/null
+++ b/matlab-support.install
@@ -0,0 +1,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"
+}