summaryrefslogtreecommitdiffstats
path: root/compat32-tools
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2014-01-16 09:32:24 +0000
committer Eric Hameleers <alien@slackware.com>2014-01-16 09:32:24 +0000
commit69b0f79bb5a506adf893e6dcc785fb5a11172c2a (patch)
treef8ba7a761170e1119dfdd4e05ed6d27fe5e7f262 /compat32-tools
parentfbc99a89326c951f4aaa88096414c1745f7bb7bd (diff)
downloadmultilib-69b0f79bb5a506adf893e6dcc785fb5a11172c2a.tar.gz
multilib-69b0f79bb5a506adf893e6dcc785fb5a11172c2a.tar.xz
Initial revision
Diffstat (limited to 'compat32-tools')
-rwxr-xr-xcompat32-tools/gfortranwrapper30
1 files changed, 30 insertions, 0 deletions
diff --git a/compat32-tools/gfortranwrapper b/compat32-tools/gfortranwrapper
new file mode 100755
index 0000000..b099405
--- /dev/null
+++ b/compat32-tools/gfortranwrapper
@@ -0,0 +1,30 @@
+#!/bin/bash
+# $Id$
+# Copyright 2014 Eric Hameleers, Eindhoven, NL
+
+# Distributed under the GNU General Public License, version 2, as
+# published by the Free Software Foundation.
+
+# Find the stub gfortran's directory:
+STUBPATH=$(cd $(dirname $0); pwd)
+
+# Now find the "real" gfortran
+REALFC=$(PATH="$(echo $PATH | sed "s#\(.*\):\?$STUBPATH/\?:\?#\1#")" which $(basename $0))
+
+# Filter out -m64 from $@ (this is sometimes added even though we specify -m32)
+declare -a Arguments
+for i; do
+ case "$i" in
+ -m64)
+ ;;
+ *)
+ Arguments[${#Arguments[@]}]="$i"
+ ;;
+ esac
+done
+
+# Compiling a 32bit program requires we call gfortran with -m32
+$REALFC -m32 "${Arguments[@]}"
+
+# Exit with $REALFC's exit code
+exit $?