Skip to content
SiegeLord edited this page Mar 17, 2012 · 5 revisions

Table of Contents:

Installing on Linux

DMD

Step 1: Download and install a recent stable version of DMD (unstable versions usually can't compile Tango)

Step 2: Obtain the Tango D2 library. You can do this in two ways:

Step 3: Open up a terminal and navigate to the directory the Tango-D2 source is located at

Step 4: Build the library by running the following commands:

./build/bin/linux32/bob -u .

NOTE: If you don't plan on using Phobos, or you don't have Phobos, you should modify the build command like this:

./build/bin/linux32/bob -u -o="-release -version=NoPhobos" .

Run this to get more options to customize your build:

./build/bin/linux32/bob --help

Step 5: Install the library. Naturally this depends on where you prefer to install things, but in my case I install into the /usr/local/ hierarchy. You'll probably need to run these commands as root (e.g via sudo):

mkdir -p /usr/local/include/d
mkdir -p /usr/local/lib
cp -R tango /usr/local/include/d/
cp libtango*.a /usr/local/lib/

Step 6: Modify dmd.conf to be able to find Tango. What you do here depends on whether you want to use Tango alongside Phobos, or use Phobos exclusively.

  • If you want to use Tango alongside Phobos, just modify dmd.conf to be able to find where you installed Tango. If you used the above directories you'll need to add these things to DFLAGS variable in dmd.conf:

      -I/usr/local/include/d/ -L-L/usr/local/lib
    
  • If you want to use Tango instead of Phobos, you'll need to modify things a bit more. You'll want to remove the Phobos include path and then add these things:

      -I/usr/local/include/d/ -L-L/usr/local/lib -defaultlibname=tango-dmd -debuglib=tango-dmd
    

Step 7: Try it out by compiling a Hello World application:

import tango.io.Stdout;

void main()
{
    Stdout("Hello from Tango!").nl;
}

Compile it using this command if you are using it alongside Phobos:

dmd hello.d -L-ltango-dmd

Compile it using this command if you are using it instead of Phobos:

dmd hello.d

LDC

You can use the same steps as the DMD guide except for the following steps:

Step 1: Download and install the unstable version of LDC (from here https://github.com/ldc-developers/ldc )

Step 4: Build the library by running the following commands:

./build/bin/linux32/bob -u -c=ldc2 .

NOTE: If you don't plan on using Phobos, or you don't have Phobos, you should modify the build command like this:

./build/bin/linux32/bob -u -c=ldc2 -o="-release -version=NoPhobos" .

Run this to get more options to customize your build:

./build/bin/linux32/bob --help

Step 6: Modify ldc2.conf to be able to find Tango. What you do here depends on whether you want to use Tango alongside Phobos, or use Phobos exclusively.

  • If you want to use Tango alongside Phobos, just modify dmd.conf to be able to find where you installed Tango. If you used the above directories you'll need to add these strings to the switches array in ldc2.conf:

      "-I/usr/local/include/d/"
      "-L-L/usr/local/lib"
    
  • If you want to use Tango instead of Phobos, you'll need to modify things a bit more. You'll want to remove the Phobos include path and linking switches and then add these things:

      "-I/usr/local/include/d/"
      "-L-L/usr/local/lib"
      "-defaultlibname=tango-ldc"
      "-debuglib=tango-ldc"
    

Step 7: Try it out by compiling a Hello World application:

import tango.io.Stdout;

void main()
{
    Stdout("Hello from Tango!").nl;
}

Compile it using this command if you are using it alongside Phobos:

ldc2 hello.d -L-ltango-ldc

Compile it using this command if you are using it instead of Phobos:

ldc2 hello.d

GDC

Building on GDC is not supported yet.

Installing on Windows

TODO

Installing on OSX

You may be able to follow the Linux guide for this. TODO

Clone this wiki locally