diff bin/ldmd2 @ 1453:f35a9a77d256

More tweaks.
author Robert Clipsham <robert@octarineparrot.com>
date Mon, 01 Jun 2009 18:58:21 +0100
parents
children 593f99fddd2f
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/ldmd2	Mon Jun 01 18:58:21 2009 +0100
@@ -0,0 +1,43 @@
+#! /usr/bin/env bash
+
+# Default to 'ldc' next to this file
+LDC=`basename "$0"`/ldc2
+if [ ! -x "$LDC" ]; then
+    # If that doesn't work, assume this script was called via $PATH
+    # and do the same for ldc
+    if which ldc2 &> /dev/null; then
+        LDC=ldc2
+    else
+        echo 'ldc not found, check your installation' >/dev/stderr
+        exit 1
+    fi
+fi
+
+declare -a ARGS
+IDX=0
+for arg; do
+    case "$arg" in
+    -C*)
+        # turn -Cfoo into -foo.
+        # Useful for passing -inline to ldc, for instance.
+        arg="-${arg:2}"
+        ;;
+    -debug|-debug=*|-version=*)
+        arg="-d$arg"
+        ;;
+    -inline)
+        arg="-enable-inlining"
+        ;;
+    -fPIC)
+        arg="-relocation-model=pic"
+        ;;
+    --a|--b|--c|--f|--r|--w|--x|--y)
+        # "Hidden debug switches"
+        # Are these ever used?
+        arg="-hidden-debug${arg:1}"
+        ;;
+    esac
+    ARGS[IDX++]="$arg"
+done
+
+exec "$LDC" "${ARGS[@]}"