]> Pileus Git - ~andy/sunrise/commitdiff
dev-lang/dmd: New Ebuild for bug 376519, builds dmd from source, 64-bit support....
authorMarco Leise (mleise) <marco.leise@gmx.de>
Tue, 6 Sep 2011 19:18:59 +0000 (19:18 +0000)
committerMarco Leise (mleise) <marco.leise@gmx.de>
Tue, 6 Sep 2011 19:18:59 +0000 (19:18 +0000)
Reviewed by: binki, mgorny, Tommy

svn path=/sunrise/; revision=12364

dev-lang/dmd/ChangeLog [new file with mode: 0644]
dev-lang/dmd/Manifest [new file with mode: 0644]
dev-lang/dmd/dmd-2.054.ebuild [new file with mode: 0644]
dev-lang/dmd/files/dmd-2.054-makefile.patch [new file with mode: 0644]
dev-lang/dmd/files/dmd-2.054-no-execstack.patch [new file with mode: 0644]
dev-lang/dmd/files/dmd.bashcomp [new file with mode: 0644]
dev-lang/dmd/metadata.xml [new file with mode: 0644]

diff --git a/dev-lang/dmd/ChangeLog b/dev-lang/dmd/ChangeLog
new file mode 100644 (file)
index 0000000..f4b8d2b
--- /dev/null
@@ -0,0 +1,11 @@
+# ChangeLog for dev-lang/dmd
+# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
+# $Header: $
+
+  06 Sep 2011; Marco Leise (mleise) <marco.leise@gmx.de> +dmd-2.054.ebuild,
+  +files/dmd-2.054-makefile.patch, +files/dmd-2.054-no-execstack.patch,
+  +files/dmd.bashcomp, +metadata.xml:
+  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
+
diff --git a/dev-lang/dmd/Manifest b/dev-lang/dmd/Manifest
new file mode 100644 (file)
index 0000000..d7c1333
--- /dev/null
@@ -0,0 +1,7 @@
+AUX dmd-2.054-makefile.patch 2709 RMD160 dbfb8a0c7a03f91a51a5f2d895e77b9a0eea79a3 SHA1 48ccddc733c144e84f1f3a7f59c8fa07f64f371e SHA256 7fa7b876ebfa01dcc1da4d945bbeacb922a29a63806a9790bebf52fa427d16bf
+AUX dmd-2.054-no-execstack.patch 3962 RMD160 849f59f9921dea1b9a9b78d6d54fdeba9df29f38 SHA1 94268fb2653cc6813ffdff7406d394bafcd1bee3 SHA256 6603dfb05beff79039f0e63a409e8237c6a271ae73ce7ec752fef3c164073423
+AUX dmd.bashcomp 4304 RMD160 1907b62c150f074088084141a0f10b92de17f1a0 SHA1 2bea8aef8cba4d4817b7070e7f5c8e2e0628f51e SHA256 11c1b7007ea713c60e2f65a7c25bb38fb0b88c263c064a42bf4da1250480245f
+DIST dmd.2.054.zip 16114301 RMD160 1764ed7c64ee63857a30633c935eaceb99dc1dc5 SHA1 05dfd83c1083bb93ae43c10e3846ee7120b462fe SHA256 3347dee91d8884b2f105666f085ba0b2c27b989967cf0001b284f3da922ca0c2
+EBUILD dmd-2.054.ebuild 4135 RMD160 5d08e557de2638fdd7d1388e49a558ab5bbf90ce SHA1 ba72afc1d6908cd8b399b43f38b3381c36732b60 SHA256 c2cc9d534057c8777bfb3ce7d7744c1a0e8205d59d5c03accec6d714689be892
+MISC ChangeLog 487 RMD160 e55f9a569e7211bc3bde9a949f8802c038a07ec1 SHA1 84dd75262ca485de13a3197e04f07ad885cbcc67 SHA256 b0593d5c40c708544a8d65879a1c6ae4a80a785551bfe103602cc6cb0c46ab44
+MISC metadata.xml 229 RMD160 f0f6417bec31ce8baba6d476664f7210c8c84c98 SHA1 e5f94f5caadc6f843fc90bb7959570cd503676fd SHA256 3b08fca3c878bdfc4e7639f477dd542d55a4ab5dce39a475e82633071d13eb3f
diff --git a/dev-lang/dmd/dmd-2.054.ebuild b/dev-lang/dmd/dmd-2.054.ebuild
new file mode 100644 (file)
index 0000000..1e499eb
--- /dev/null
@@ -0,0 +1,155 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+
+inherit eutils multilib bash-completion
+
+DESCRIPTION="Reference compiler for the D programming language"
+HOMEPAGE="http://www.digitalmars.com/d/"
+SRC_URI="http://ftp.digitalmars.com/${PN}.${PV}.zip"
+
+# DMD supports amd64/x86 exclusively
+KEYWORDS="-* ~amd64 ~x86"
+SLOT="2"
+IUSE="multilib doc examples"
+
+# License doesn't allow redistribution
+LICENSE="DMD"
+RESTRICT="mirror"
+
+DEPEND="sys-apps/findutils
+       app-arch/unzip"
+RDEPEND="!dev-lang/dmd-bin"
+
+S="${WORKDIR}/${PN}2/src"
+
+rdos2unix() {
+       edos2unix $(find . -name '*'.$1 -type f) || die "Failed to convert line-endings of all .$1 files"
+}
+
+src_prepare() {
+       cd .. || die
+
+       rm -r osx linux windows freebsd README.TXT || die "Failed to remove included binaries"
+
+       # convert line-endings of file-types that start as cr-lf and are
+       # patched or installed later on
+       rdos2unix c
+       rdos2unix d
+       rdos2unix txt
+       rdos2unix css
+
+       # misc patches for the build process
+       epatch "${FILESDIR}/${P}-makefile.patch"
+
+       # fix the compile of an assembly file in druntime and the output of 
+       # DMD to produce binaries with no executable stack
+       epatch "${FILESDIR}/${P}-no-execstack.patch"
+}
+
+src_compile() {
+       # DMD
+       ln -s . "dmd/mars" || die "Failed to add recursive symbolic link to DMD sources."
+       if use x86; then
+               einfo 'Building DMD for x86 ...'
+               emake -C dmd -f posix.mak MODEL=32
+       elif use amd64; then
+               einfo 'Building DMD for amd64 ...'
+               emake -C dmd -f posix.mak MODEL=64
+       fi
+
+       # druntime & Phobos
+       if use x86 || (use amd64 && use multilib); then
+               einfo 'Building druntime for x86 ...'
+               emake -C druntime -f posix.mak MODEL=32 "DMD=../dmd/dmd"
+               einfo 'Building Phobos for x86 ...'
+               emake -C phobos -f posix.mak MODEL=32 "DMD=../dmd/dmd"
+       fi
+       if use amd64; then
+               einfo 'Building druntime for amd64 ...'
+               emake -C druntime -f posix.mak MODEL=64 "DMD=../dmd/dmd"
+               einfo 'Building Phobos for amd64 ...'
+               emake -C phobos -f posix.mak MODEL=64 "DMD=../dmd/dmd"
+       fi
+}
+
+src_test() {
+       local DFLAGS="-Iphobos -Idruntime/import -L-lrt"
+       local DMD="dmd/dmd"
+       if use x86 || (use amd64 && use multilib); then
+               ${DMD} -m32 ${DFLAGS} -Lphobos/generated/linux/release32/libphobos2.a ../samples/d/hello.d || die "Failed to build hello.d (32bit)"
+               ./hello 32bit || die "Failed to run test sample (32bit)"
+       fi
+       if use amd64; then
+               ${DMD} -m64 ${DFLAGS} -Lphobos/generated/linux/release64/libphobos2.a ../samples/d/hello.d || die "Failed to build hello.d (64bit)"
+               ./hello 64bit || die "Failed to run test sample (64bit)"
+       fi
+       rm hello.o hello
+}
+
+src_install() {
+       # prepeare and install config
+       cd "dmd" || die
+       cat > dmd.conf << EOF
+[Environment]
+DFLAGS=-I/usr/include/phobos2 -I/usr/include/druntime -L-L--no-warn-search-mismatch -L--export-dynamic -L-lrt
+EOF
+       insinto /etc
+       doins dmd.conf
+       dobashcompletion "${FILESDIR}/${PN}.bashcomp"
+
+       # Compiler
+       dobin "dmd"
+
+       # Man pages, docs and samples
+       cd ".." || die
+       doman ../man/man1/dmd.1
+       doman ../man/man1/dmd.conf.5
+
+       use doc && dohtml -r ../html/*
+
+       docompress -x /usr/share/doc/${PF}/samples/
+       insinto /usr/share/doc/${PF}/samples/
+       if use examples; then
+               doins -r ../samples/d/*
+       fi
+
+       # druntime & Phobos
+       if use amd64; then
+               dolib.a "druntime/lib64/libdruntime.a"
+               dolib.a "phobos/generated/linux/release64/libphobos2.a"
+       fi
+       if use x86 || (use amd64 && use multilib); then
+               use amd64 && multilib_toolchain_setup x86
+               dolib.a "druntime/lib32/libdruntime.a"
+               dolib.a "phobos/generated/linux/release32/libphobos2.a"
+               # TODO: restore target architecture
+       fi
+
+       # cleanup builds
+       rm -r "druntime/obj"* "druntime/lib"* || die
+       rm -r "phobos/generated" || die
+
+       # remove files that are not required
+       rm "phobos/posix.mak" || die
+       rm "phobos/win32.mak" || die
+       rm "phobos/std.ddoc" || die
+       rm "phobos/index.d" || die
+       rm -r "phobos/etc/c/zlib" || die
+
+       # imports
+       insinto /usr/include/druntime/
+       doins -r druntime/import/*
+
+       insinto /usr/include/phobos2
+       doins -r phobos/*
+}
+
+pkg_postinst() {
+       if use doc || use examples; then
+               elog "The bundled docs and/or samples may be found in"
+               elog "/usr/share/doc/${PF}"
+       fi
+}
diff --git a/dev-lang/dmd/files/dmd-2.054-makefile.patch b/dev-lang/dmd/files/dmd-2.054-makefile.patch
new file mode 100644 (file)
index 0000000..9aed215
--- /dev/null
@@ -0,0 +1,106 @@
+--- dmd2.054/src/dmd/posix.mak.orig    2011-07-10 22:19:30.000000000 +0200
++++ dmd2.054/src/dmd/posix.mak 2011-07-22 19:39:07.797180890 +0200
+@@ -28,7 +28,7 @@ C=backend
+ TK=tk
+ ROOT=root
+
+-MODEL=32
++MODEL?=32
+
+ ifeq (OSX,$(TARGET))
+     ## See: http://developer.apple.com/documentation/developertools/conceptual/cross_development/Using/chapter_3_section_2.html#//apple_ref/doc/uid/20002000-1114311-BABGCAAB
+--- dmd2/src/druntime/posix.mak.orig   2011-06-25 02:39:28.000000000 +0200
++++ dmd2/src/druntime/posix.mak        2011-07-22 17:42:40.570533111 +0200
+@@ -20,21 +20,21 @@ ifeq (,$(OS))
+     endif
+ endif
+-DMD=dmd
++DMD?=dmd
+ DOCDIR=doc
+ IMPDIR=import
+-MODEL=32
++MODEL?=32
+ DFLAGS=-m$(MODEL) -O -release -inline -nofloat -w -d -Isrc -Iimport
+ UDFLAGS=-m$(MODEL) -O -release -nofloat -w -d -Isrc -Iimport
+ CFLAGS=-m$(MODEL) -O
+-OBJDIR=obj
++OBJDIR=obj$(MODEL)
+ DRUNTIME_BASE=druntime
+-DRUNTIME=lib/lib$(DRUNTIME_BASE).a
++DRUNTIME=lib$(MODEL)/lib$(DRUNTIME_BASE).a
+ DOCFMT=
+--- dmd2/src/phobos/etc/c/zlib/gzio.c.orig     2011-07-26 23:58:57.240222466 +0200
++++ dmd2/src/phobos/etc/c/zlib/gzio.c  2011-07-26 23:59:20.136336207 +0200
+@@ -8,6 +8,7 @@
+ /* @(#) $Id$ */
+ #include <stdio.h>
++#include <errno.h>
+ #include "zutil.h"
+--- dmd2/src/phobos/posix.mak.orig     2011-07-10 22:19:30.000000000 +0200
++++ dmd2/src/phobos/posix.mak  2011-07-22 17:51:00.901014107 +0200
+@@ -48,7 +48,7 @@ endif
+ DRUNTIME_PATH = ../druntime
+ ZIPFILE = phobos.zip
+ ROOT_OF_THEM_ALL = generated
+-ROOT = $(ROOT_OF_THEM_ALL)/$(OS)/$(BUILD)/$(MODEL)
++ROOT = $(ROOT_OF_THEM_ALL)/$(OS)/$(BUILD)$(MODEL)
+ # Documentation-related stuff
+ DOCSRC = ../d-programming-language.org
+ WEBSITE_DIR = ../web
+@@ -61,8 +61,6 @@ DDOCFLAGS=-m$(MODEL) -d -c -o- -version=
+
+ # Variable defined in an OS-dependent manner (see below)
+ CC =
+-DMD =
+-DDOC =
+ CFLAGS =
+ DFLAGS =
+
+@@ -75,7 +73,7 @@ MAKEFILE:=$(lastword $(MAKEFILE_LIST))
+
+ # Set DRUNTIME name and full path
+ ifeq (,$(findstring win,$(OS)))
+-      DRUNTIME = $(DRUNTIME_PATH)/lib/libdruntime.a
++      DRUNTIME = $(DRUNTIME_PATH)/lib$(MODEL)/libdruntime.a
+ else
+       DRUNTIME = $(DRUNTIME_PATH)/lib/druntime.lib
+ endif
+@@ -83,14 +81,14 @@ endif
+ # Set CC and DMD
+ ifeq ($(OS),win32wine)
+       CC = wine dmc.exe
+-      DMD = wine dmd.exe
++      DMD ?= wine dmd.exe
+       RUN = wine
+ else
+       ifeq ($(OS),win32remote)
+-              DMD = ssh 206.125.170.138 "cd code/dmd/phobos && dmd"
++              DMD ?= ssh 206.125.170.138 "cd code/dmd/phobos && dmd"
+               CC = ssh 206.125.170.138 "cd code/dmd/phobos && dmc"
+       else
+-              DMD = dmd
++              DMD ?= dmd
+               ifeq ($(OS),win32)
+                       CC = dmc
+               else
+@@ -141,7 +139,7 @@ else
+ endif
+
+ # Set DDOC, the documentation generator
+-DDOC=dmd
++DDOC?=$(DMD)
+
+ # Set LIB, the ultimate target
+ ifeq (,$(findstring win,$(OS)))
+
diff --git a/dev-lang/dmd/files/dmd-2.054-no-execstack.patch b/dev-lang/dmd/files/dmd-2.054-no-execstack.patch
new file mode 100644 (file)
index 0000000..5f25a4e
--- /dev/null
@@ -0,0 +1,75 @@
+--- dmd2/src/druntime/posix.mak.orig   2011-06-25 02:39:28.000000000 +0200
++++ dmd2/src/druntime/posix.mak        2011-07-22 17:42:40.570533111 +0200
+@@ -518,7 +518,7 @@ $(OBJDIR)/errno_c.o : src/core/stdc/errn
+ $(OBJDIR)/threadasm.o : src/core/threadasm.S
+       @mkdir -p $(OBJDIR)
+-      $(CC) -c $(CFLAGS) $< -o$@
++      $(CC) -Wa,-noexecstack -c $(CFLAGS) $< -o$@
+ ################### Library generation #########################
+--- dmd2/src/dmd/backend/elfobj.c.orig 2011-07-27 02:34:47.270542457 +0200
++++ dmd2/src/dmd/backend/elfobj.c      2011-07-27 02:37:47.290542532 +0200
+@@ -652,7 +652,7 @@
+     if (I64)
+     {
+         static char section_names_init64[] =
+-          "\0.symtab\0.strtab\0.shstrtab\0.text\0.data\0.bss\0.note\0.comment\0.rodata\0.rela.text\0.rela.data";
++          "\0.symtab\0.strtab\0.shstrtab\0.text\0.data\0.bss\0.note\0.comment\0.rodata\0.note.GNU-stack\0.rela.text\0.rela.data";
+         #define NAMIDX_NONE      0
+         #define NAMIDX_SYMTAB    1       // .symtab
+         #define NAMIDX_STRTAB    9       // .strtab
+@@ -663,9 +663,10 @@
+         #define NAMIDX_NOTE     44      // .note
+         #define NAMIDX_COMMENT  50      // .comment
+         #define NAMIDX_RODATA   59      // .rodata
+-        #define NAMIDX_RELTEXT  67      // .rel.text and .rela.text
+-        #define NAMIDX_RELDATA  77      // .rel.data
+-        #define NAMIDX_RELDATA64 78      // .rela.data
++        #define NAMIDX_GNUSTACK 67      // .note.GNU-stack
++        #define NAMIDX_RELTEXT  83      // .rel.text and .rela.text
++        #define NAMIDX_RELDATA  93      // .rel.data
++        #define NAMIDX_RELDATA64 94      // .rela.data
+         if (section_names)
+             section_names->setsize(sizeof(section_names_init64));
+@@ -692,6 +693,7 @@
+         elf_newsection2(NAMIDX_SHSTRTAB,SHT_STRTAB, 0,                  0,0,0,0,0, 1,0);
+         elf_newsection2(NAMIDX_COMMENT, SHT_PROGDEF,0,                  0,0,0,0,0, 1,0);
+         elf_newsection2(NAMIDX_NOTE,SHT_NOTE,   0,                      0,0,0,0,0, 1,0);
++        elf_newsection2(NAMIDX_GNUSTACK,SHT_PROGDEF,0,                  0,0,0,0,0, 1,0);
+         IDXSTR namidx;
+         namidx = NAMIDX_TEXT;      *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx;
+@@ -705,11 +707,12 @@
+         namidx = NAMIDX_SHSTRTAB;  *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx;
+         namidx = NAMIDX_COMMENT;   *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx;
+         namidx = NAMIDX_NOTE;      *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx;
++        namidx = NAMIDX_GNUSTACK;  *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx;
+     }
+     else
+     {
+         static char section_names_init[] =
+-          "\0.symtab\0.strtab\0.shstrtab\0.text\0.data\0.bss\0.note\0.comment\0.rodata\0.rel.text\0.rel.data";
++          "\0.symtab\0.strtab\0.shstrtab\0.text\0.data\0.bss\0.note\0.comment\0.rodata\0.note.GNU-stack\0.rel.text\0.rel.data";
+         if (section_names)
+             section_names->setsize(sizeof(section_names_init));
+@@ -736,6 +739,7 @@
+         elf_newsection2(NAMIDX_SHSTRTAB,SHT_STRTAB, 0,                  0,0,0,0,0, 1,0);
+         elf_newsection2(NAMIDX_COMMENT, SHT_PROGDEF,0,                  0,0,0,0,0, 1,0);
+         elf_newsection2(NAMIDX_NOTE,SHT_NOTE,   0,                      0,0,0,0,0, 1,0);
++        elf_newsection2(NAMIDX_GNUSTACK,SHT_PROGDEF,0,                  0,0,0,0,0, 1,0);
+         IDXSTR namidx;
+         namidx = NAMIDX_TEXT;      *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx;
+@@ -749,6 +753,7 @@
+         namidx = NAMIDX_SHSTRTAB;  *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx;
+         namidx = NAMIDX_COMMENT;   *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx;
+         namidx = NAMIDX_NOTE;      *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx;
++        namidx = NAMIDX_GNUSTACK;  *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx;
+     }
+     if (SYMbuf)
+
diff --git a/dev-lang/dmd/files/dmd.bashcomp b/dev-lang/dmd/files/dmd.bashcomp
new file mode 100644 (file)
index 0000000..f96437a
--- /dev/null
@@ -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
diff --git a/dev-lang/dmd/metadata.xml b/dev-lang/dmd/metadata.xml
new file mode 100644 (file)
index 0000000..e6233b5
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>no-herd</herd>
+<maintainer><email>maintainer-wanted@gentoo.org</email></maintainer>
+</pkgmetadata>