There is a language which aims to combine all the benefits of C, C++, C# and Java to one new language: D
Even there is a complete compiler at dlang.org there is also a project which builds a gcc frontend for D, the GDC project. The following section shows how to setup gcc to be able to compile D sources.
First, checkout the frontend sources. This step needs to be done only once as a tarball is created which contains all the sources. This is just to make playing with the frontend sources easier as they do not need to be checked out again and again:
git clone https://github.com/D-Programming-GDC/GDC.git && cd GDC && git checkout gdc-4.9 && rm -rf .git && rm .gitignore && cd .. && mv GDC gdc-4.9-<checkout-date> && tar -cJf gdc-4.9-<checkout-date>.tar.xz gdc-4.9-<checkout-date> rm -rf gdc-4.9-<checkout-date>
<checkout-date> by the current date, for example
gdc-4.9-20130119. Also, use whatever version of GCC you have available, instead of 4.9.
gdc-4.9-<checkout-date>.tar.xz for later use (if any).
Build the gcc with D frontend enabled by following commands (assuming the tarballs ar one directory level above):
tar -xf ../gdc-4.9-<checkout-date>.tar.xz && tar -xf ../gcc-4.9.0.tar.bz2 && cd gdc-4.9-<checkout-date> && ./setup-gcc.sh ../gcc-4.9.0 && cd ../gcc-4.9.0
The following instructions are nearly the same as the BLFS instructions to rebuild gcc. Add
d to the --enable-languages option. Then this reads for example
--enable-languages=c,c++,fortran,java,objc,obj-c++,d. Also add
# Apply patches as in the book mkdir ../gcc-build && cd ../gcc-build && ../gcc-4.9.0/configure --prefix=/usr \ --with-system-zlib \ --libdir=/usr/lib \ --enable-shared \ --enable-threads=posix \ --enable-__cxa_atexit \ --disable-multilib \ --enable-clocale=gnu \ --enable-languages=c,c++,fortran,d \ --with-bugurl="http://gdcproject.org/bugzilla" \ --disable-bootstrap \ --enable-checking=yes
I had to change the
--disable-bootstrap, otherwise the compilation breaks.
make && make -k check
Please test this in a save environment as the instructions will overwrite the current (working) gcc with a new one. In case there is a bug, either in the instructions above or somewhere else, you may no longer be able to compile any other package.
Wiki for the D Programming Language - Tons of content, updated by the masses.
So long, Thomas