Prosody installation guide: first time build

If you are using Windows with Visual Studio, you can use the Visual Studio project files, or you can build from the command line as described here.

Go to the $(TiNG)/libutil directory and build the program 't0'. For example, run:

	$ make gen-$TiNGTARGET/t0

Note: unlike everything else which gets built, the t0 program is run while building parts of Prosody. If you are cross-compiling (common with QNX), you need to build t0 for your host system - not for the target on which you intend to run Prosody. For example, if you are running on Linux but building for QNX you need to use:

	$ TiNGTARGET=LINUX_V6 make gen-LINUX_V6/t0

If you don't want to use 'make', build as described in Prosody installation guide: building without using the Makefiles.

If make complains that /Makefile cannot be found, for example, like this:

	Makefile:12: /Makefile: No such file or directory
	find: gen-: No such file or directory
	Makefile:19: no file name for `-include'
	make: *** No rule to make target `/Makefile'.  Stop.

then the environment variable TiNGTARGET has not been set as described in set up the build environment. Check that it has a lower case 'i'.

The errors:

	Makefile:19: no file name for `-include'

is normal and can be ignored. On QNX, there may be further errors, which can also be ignored as long as the t0 program is built.

All generated files (i.e. object files, executables and suchlike) are put in subdirectories. Directories with names like 'gen-WINNT_V6' and 'gen-LINUX_V6' are used for files generated for specific builds, while 'gen' holds files which are used by all builds. Any errors produced while generating a file are saved under 'errs'. For example, when making the file gen-WINNT_V6/foo.x any errors are put into errs/gen-WINNT_V6/foo.x. The layout is described in detail in Prosody: layout of the distribution.

For Windows: note that the above command will build using the gcc compiler - not the Microsoft one. To build using the Microsoft compiler use:
	$ make gen-$TiNGTARGET/t0.exe

When the t0 program has been built, copy it into a directory in your path. For example:

For Linux:
	cp gen-LINUX_V6/t0 /usr/local/bin/
For Windows:
	cp gen-WINNT_V6/t0.exe /bin/

Later stages of building will use this program, so it is important that it is put in a suitable directory. Check this with:

	echo hello | t0 foo

This should print hello and create a file called foo which also contains hello.

If you install another version of the package, you need not worry about which version of t0 to use as they're all the same.

If you cannot build t0, it is possible to replace it with the standard utility tee (which reads input and writes one copy to the specified file and another to its output). The difference is that when the input is empty, t0 removes the output file while tee leaves a zero- length file. However if you can't build t0 it is highly unlikely that you'll be able to build anything else, so it's better to fix any problem at this point. The only circumstance in which it's worth using tee is if you're using a cross-compiler and cannot run programs on the system which is doing the build.

You are now ready to finish building software components.