Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 14th, 2011  |  syntax: Bash  |  size: 0.96 KB  |  views: 48  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #! /usr/bin/env bash
  2.  
  3. # Default to 'ldc' next to this file
  4. LDC=`dirname "$0"`/ldc
  5. if [ ! -x "$LDC" ]; then
  6.     # If that doesn't work, assume this script was called via $PATH
  7.     # and do the same for ldc
  8.     if which ldc &> /dev/null; then
  9.         LDC=ldc
  10.     else
  11.         echo 'ldc not found, check your installation' >/dev/stderr
  12.         exit 1
  13.     fi
  14. fi
  15.  
  16. declare -a ARGS
  17. IDX=0
  18. for arg; do
  19.     case "$arg" in
  20.     -C*)
  21.         # turn -Cfoo into -foo.
  22.         # Useful for passing -inline to ldc, for instance.
  23.         arg="-${arg:2}"
  24.         ;;
  25.     -debug|-debug=*|-version=*)
  26.         arg="-d$arg"
  27.         ;;
  28.     -inline)
  29.         arg="-enable-inlining"
  30.         ;;
  31.     -fPIC)
  32.         arg="-relocation-model=pic"
  33.         ;;
  34.     --a|--b|--c|--f|--r|--w|--x|--y)
  35.         # "Hidden debug switches"
  36.         # Are these ever used?
  37.         arg="-hidden-debug${arg:1}"
  38.         ;;
  39.     esac
  40.     ARGS[IDX++]="$arg"
  41. done
  42.  
  43. exec "$LDC" "${ARGS[@]}"
clone this paste RAW Paste Data