diff options
author | Marco Leise (mleise) <marco.leise@gmx.de> | 2011-09-06 19:18:59 +0000 |
---|---|---|
committer | Marco Leise (mleise) <marco.leise@gmx.de> | 2011-09-06 19:18:59 +0000 |
commit | 47610a68d96844cf510db99a88a79050175d1947 (patch) | |
tree | 378cca3357c76fe05b5c47d03644a404ad208a6f /dev-lang/dmd/files/dmd.bashcomp | |
parent | sci-electronics/gerbmerge: Remove old v1.6. (diff) | |
download | sunrise-47610a68d96844cf510db99a88a79050175d1947.tar.gz sunrise-47610a68d96844cf510db99a88a79050175d1947.tar.bz2 sunrise-47610a68d96844cf510db99a88a79050175d1947.zip |
dev-lang/dmd: New Ebuild for bug 376519, builds dmd from source, 64-bit support. Thanks to kahrl for the patch regarding the QA notices about executable stacks!
Reviewed by: binki, mgorny, Tommy
svn path=/sunrise/; revision=12364
Diffstat (limited to 'dev-lang/dmd/files/dmd.bashcomp')
-rw-r--r-- | dev-lang/dmd/files/dmd.bashcomp | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/dev-lang/dmd/files/dmd.bashcomp b/dev-lang/dmd/files/dmd.bashcomp new file mode 100644 index 000000000..f96437a97 --- /dev/null +++ b/dev-lang/dmd/files/dmd.bashcomp @@ -0,0 +1,128 @@ +_dmd_opts="$(dmd --help 2>&1 | sed -n 's/^\s*\(-\+\w*=*-*\).*/\1/p' | \ + sed 's/filename\|docdir\|directory\|path\|linkerflag\|objdir//g')" +_ld_opts_dmd="$(ld --help 2>&1 | sed -n 's/.*\(--[-a-z0-9]\{1,\}\).*/-L\1/p')" +_env_vars_dmd="$(printenv | cut -d = -f 1 | sort -u)" + + +_filedir_dmd() +{ + cur=$(echo "${cur}" | sed 's:^'${1}'::') + if test "${2}" == "(*)" ;then + _filedir + else + _filedir '@'${2} + fi + cur="${1}${cur}" + J=0 + F=0 + for I in ${COMPREPLY[@]} + do + if test -d ${I} ;then + COMPREPLY[${J}]="${1}${I}/" + else + COMPREPLY[${J}]="${1}${I}" + F=1 + fi + J=$((J + 1)) + done + if test ${F} -eq 1 -a ${J} -eq 1 ;then + compopt +o nospace + fi +} + + +_dmd() +{ + COMPREPLY=() + local cur + _get_comp_words_by_ref -n = cur + local IFS=$'\t\n' + + case "${cur}" in + -L-L*) # match linker paths + compopt -o nospace + _filedir_dmd "-L-L" "(/)" + ;; + -L--*) # match linker options + COMPREPLY=( $( compgen -W "${_ld_opts_dmd}" -- ${cur} ) ) + ;; + -L*) # match linker options + local opts=$(echo -e "-L-L\n-L--") + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + ;; + -*) # match dmd options + compopt -o nospace + if [[ "${cur}" == "-Dd"* ]] ;then + _filedir_dmd "-Dd" "(/)" + elif [[ "${cur}" == "-Df"* ]] ;then + _filedir_dmd "-Df" "(*)" + elif [[ "${cur}" == "-debug="* ]] ;then + cur=${cur#*=} + elif [[ "${cur}" == "-debuglib="* ]] ;then + cur=${cur#*=} + _filedir + if [ ${#COMPREPLY[@]} -eq 1 ] && [ -f ${COMPREPLY[@]} ] ;then + compopt +o nospace + fi + elif [[ "${cur}" == "-defaultlib="* ]] ;then + cur=${cur#*=} + _filedir + if [ ${#COMPREPLY[@]} -eq 1 ] && [ -f ${COMPREPLY[@]} ] ;then + compopt +o nospace + fi + elif [[ "${cur}" == "-deps="* ]] ;then + cur=${cur#*=} + _filedir + if [ ${#COMPREPLY[@]} -eq 1 ] && [ -f ${COMPREPLY[@]} ] ;then + compopt +o nospace + fi + elif [[ "${cur}" == "-Hd"* ]] ;then + _filedir_dmd "-Hd" "(/)" + elif [[ "${cur}" == "-Hf"* ]] ;then + _filedir_dmd "-Hf" "(*)" + elif [[ "${cur}" == "-I"* ]] ;then + _filedir_dmd "-I" "(/)" + elif [[ "${cur}" == "-J"* ]] ;then + _filedir_dmd "-J" "(/)" + elif [[ "${cur}" == "-od"* ]] ;then + _filedir_dmd "-od" "(/)" + elif [[ "${cur}" == "-of"* ]] ;then + _filedir_dmd "-of" "(*)" + elif [[ "${cur}" == "-version="* ]] ;then + cur=${cur#*=} + elif [[ "${cur}" == "-Xf"* ]] ;then + _filedir_dmd "-Xf" "(*)" + else + COMPREPLY=( $(compgen -W "${_dmd_opts}" -- ${cur}) ) + C='\n' + L=$(echo -e "-cov${C}-fPIC${C}-gc${C}--help${C}-ignore\ + ${C}-inline${C}-lib${C}-m32${C}-m64${C}-man${C}-map\ + ${C}-noboundscheck${C}-nofloat${C}-O${C}-o-${C}-op\ + ${C}-profile${C}-property${C}-quiet${C}-release\ + ${C}-run${C}-unittest${C}-vtls${C}-wi" | sed 's: ::g') + if test ${#COMPREPLY[@]} -eq 1 ;then + for I in ${L} + do + if test "${COMPREPLY[@]}" == "$I" ; then + compopt +o nospace + fi + done + fi + fi + ;; + @*) # match arguments variable/file + compopt -o nospace + TMP=( $(compgen -W "${_env_vars_dmd}" -P "@" -- ${cur#@}) ) + _filedir_dmd "@" "(*)" + COMPREPLY=( "${TMP[@]}" "${COMPREPLY[@]}" ) + if test ${#COMPREPLY[@]} -eq 1 ;then compopt +o nospace ; fi + ;; + *) # match d files + _filedir '@(d|dd|di|o|a|/)' + ;; + esac + return 0 +} + + +complete -F _dmd dmd |