Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changes between Version 58 and Version 59 of WindowsInstall

Show
Ignore:
Author:
DRK (IP: 121.44.5.158)
Timestamp:
08/24/09 15:18:22 (15 years ago)
Comment:

Rewrote manual install and build instructions

Legend:

Unmodified
Added
Removed
Modified
  • WindowsInstall

    v58 v59  
    5757== Manual Build and Install == 
    5858 
    59  1. [wiki:SourceDownloads Download or check out] Tango sources. 
    60  2. In what follows we assume you've checked out tango into `C:\dmd\import`. If you chose another path, consider avoiding names that contain spaces or parenthesis as these cause problems with some windows command line tools. 
    61  3. Edit `C:\dmd\bin\sc.ini` as in point 3 of previous section. 
    62  4. Build ''tango-base-dmd.lib'' by running ''build-dmd.bat'' in the lib folder.  This requires the Digital Mars C compiler and the Digital Mars ''make'' utility located in `/dm/bin` which must be the first 'make' executable encountered in the search path. These tools are both provided by the dmc.zip package linked off the DMD download page: http://www.digitalmars.com/d/dcompiler.html 
    63  5. In the same folder, also run ''build-win32.bat'' to create the ''tango-win32-dmd.lib''. 
    64  6. In the same folder, finish building Tango by running ''build-tango.bat'' to create the ''tango-user-dmd.lib''. 
    65  7. If you have ''tango-base-dmd.lib'' already in your dmd/lib (or where your DMD looks for libraries) directory, it is recommended to back this up (or any other former runtime .lib files that might be replaced). 
    66  8. Place the ''tango-base-dmd.lib'' ''tango-user-dmd.lib'' and ''tango-win32-dmd.lib'' libraries into dmd/lib for the D compiler. 
    67  9. Please note that while ''tango-base-dmd.lib'' and ''tango-win32-dmd.lib'' will be automatically linked, ''tango-user-dmd.lib'' will not. This is to allow for configurations where ''tango-user-dmd.lib'' does not exist (such as when using Bud or Rebuild). To ensure that ''tango-user-dmd.lib'' is linked to an application, either of the following two methods should work. 
    68    * a. Add ''-L+tango-user-dmd.lib'' to the end of the DFLAGS line in ''sc.ini''. 
    69    * b. Add the following to files being compiled: 
    70 {{{ 
    71 pragma(lib, "tango-user-dmd.lib"); 
    72 }}} 
    73    * c. Include ''tango-user-dmd.lib'' in the list of files to be compiled when using dmd.exe. 
     59Note that these instructions are applicable to the current trunk (post-0.99.8 
     60release) and DMD 1.046 or higher.  They may not apply to older releases of 
     61Tango and/or DMD. 
     62 
     63Also note that these instructions assume a pristine environment.  If you wish 
     64to install Tango into an already configured compiler, make sure you follow the 
     65instructions for "Manual Install" in the section on Compiling. 
     66 
     67=== Prerequisites === 
     68 
     69You will need both the DigitalMars D and C compilers.  You can download DMD 
     70from the 
     71[http://www.digitalmars.com/d/download.html DigitalMars D download page]. 
     72If you are compiling trunk, you will need DMD version 1.045 or higher. 
     73Note that Tango is not currently compatible with D 2.x. 
     74 
     75You can download DMC from the same link; specifically, you want `dmc.zip`. 
     76 
     77Next, extract the DMD and DMC compilers somewhere.  For our purposes, we will 
     78assume both were extracted to the same directory.  You should have a dm 
     79directory and a dmd directory.  Most paths in this guide are relative to the 
     80directory where you extracted them. 
     81 
     82Finally, you will need the Tango source.  You can obtain this from 
     83[wiki:SourceDownloads].  Whether you download a snapshot or check out from 
     84source control, you should ensure the `tango` directory (containing 
     85`README.txt`) is located at `dmd\windows\tango`. 
     86 
     87=== Bootstrap Tango === 
     88 
     89This only needs to be done once; once you have compiled Tango at least once, 
     90this step is unnecessary. 
     91 
     92Firstly, delete (or rename) the `dmd\src\phobos` directory, then create a new, 
     93empty `dmd\src\phobos` directory.  Copy the `dmd\windows\tango\user\object.di` 
     94file to `dmd\src\phobos\object.di`. 
     95 
     96Once Tango has been installed, your temporary bootstrap `dmd\src\phobos` 
     97directory can be removed. 
     98 
     99=== Compile === 
     100 
     101First, ensure that the D compiler you are installing Tango into is the first D 
     102compiler on your system `PATH`.  If you do not have any other copies of DMD 
     103installed on your system, you don't need to worry about this. 
     104 
     105You also need to ensure that `dm\bin` is on your `PATH`. 
     106 
     107If you are unsure as to what your PATH should look like, the following 
     108batch file configures a minimal PATH for a Windows XP system, and opens a 
     109command prompt: 
     110 
     111{{{ 
     112SET DMD=\PATH\TO\DMD 
     113SET DMC=\PATH\TO\DMC 
     114 
     115SET PATH=%DMD%\windows\bin;%DMC%\bin;%SYSTEMROOT%\system32;%SYSTEMROOT%;%SYSTEMROOT%\system32\Wbem 
     116 
     117START CMD 
     118}}} 
     119 
     120Note that you will have to change the first two lines to reference the correct 
     121directories. 
     122 
     123==== Automated Build and Install ==== 
     124 
     125This is recommended for end users who are installing into a pristine 
     126environment.  Note that this will overwrite your `sc.ini` file.  See the 
     127next section for details on how to do this manually. 
     128 
     129Go to `dmd\windows\tango\build` and execute `build.bat`.  DO NOT 
     130execute this batch file from a different working directory, or compilation 
     131will fail. 
     132 
     133Once this is done, proceed to the Test section to verify the install worked. 
     134 
     135Note that if you need to see it, the original unmodified `sc.ini` is available 
     136as `sc.ini.phobos`. 
     137 
     138==== Manually Build and Install ==== 
     139 
     140This is recommended for end users who are installing into an existing 
     141compiler, and for developers who wish to work on Tango itself. 
     142 
     143The first step is to go to `dmd\windows\tango\build` and execute 
     144`build-dmd.bat`.  This will build the Tango runtime for DMD.  This will 
     145produce the following files (relative to the `build` directory): 
     146 
     147 * `libs\tango-base-dmd.lib` 
     148 * `libs\tango-base-dmd-dbg.lib` 
     149 
     150These should be copied into `dmd\windows\lib`. 
     151 
     152Second, you can optionally build the Tango user library as a static library. 
     153This will speed compilation of programs.  If you want to do this, again go to 
     154`dmd\windows\tango\build` and execute `build-tango.bat`.  Do not be alarmed if 
     155you do not see any output for some time; the program just has a surprisingly 
     156large output buffer! 
     157 
     158The result of this, `libs\tango-user-dmd.lib` should be copied to 
     159`dmd\windows\lib`. 
     160 
     161Finally, you need to configure DMD to use Tango.  To do this, open the 
     162`dmd\windows\bin\sc.ini` file in a text editor.  One line of this file will 
     163look like this: 
     164 
     165{{{ 
     166DFLAGS="-I%@P%\..\..\src\phobos" 
     167}}} 
     168 
     169You want to delete `"-I%@P%\..\..\src\phobos"` and replace it with 
     170`"-I%@P%\..\tango\user"`. 
     171 
     172You will also want to add the following to the `DFLAGS` setting (note: you do 
     173not need to insert these within quotes; the quotes surround the `-I` flag to 
     174guard against spaces in the path.) 
     175 
     176{{{ 
     177-version=Tango -defaultlib=tango-base-dmd.lib -debuglib=tango-base-dmd-dbg.lib 
     178}}} 
     179 
     180If you compiled the user library to a static library, you can add the 
     181following to `DFLAGS` as well.  Please note that this can conflict with 
     182automated build tools if you intend to modify Tango itself. 
     183 
     184{{{ 
     185-L+tango-user-dmd.lib 
     186}}} 
     187 
     188=== Test === 
     189 
     190Create a file called `happy.d` (in `dmd\windows` is fine) with the 
     191following contents: 
     192 
     193{{{ 
     194#!d 
     195import tango.io.Stdout; 
     196 
     197void main() 
     198
     199    Stdout("Don't Worry, Be Happy!").newline; 
     200
     201}}} 
     202 
     203Compile with the command `dmd happy` and run it to ensure it correctly 
     204outputs "Don't Worry, Be Happy!" and terminates without error. 
     205 
     206If you installed manually and chose not to add the `-L+tango-user-dmd.lib` 
     207switch to `DFLAGS`, you will need to compile with 
     208`dmd -L+tango-user-dmd.lib happy`. 
     209 
     210=== Clean-Up === 
     211 
     212You can now remove the following superfluous files and directories if you desire: 
     213 
     214 * `dmd\freebsd` 
     215 * `dmd\linux` 
     216 * `dmd\man` 
     217 * `dmd\osx` 
     218 * `dmd\src\phobos` (the temporary bootstrap directory you created) 
     219 
     220With that, you are done!  You can update to the latest trunk version of Tango 
     221by updating the `dmd\windows\tango` directory, and then following the 
     222instructions for compilation. 
    74223 
    75224== Trouble Shooting ==