1. Software requirements
In case when the installer is provided for an appropriate tool, just install it. Otherwise
unpack provided archive into any directory, specified in your %PATH%
environment variable. If you are in trouble, just unpack archives to C:\WINDOWS,
in other words, in folder where you have Windows installed.
If you are using the latest version of MinGW, don't be surprised when
'undefined reference to __strtod' error message appears during the
compilation. This is because the following
patch
applied to MinGW is incompatible with msvcrt.dll library which is used by the Ultra
Defragmenter. We hope this mistake will be resolved in future by MinGW team.
 |
Why GCC is the best choice for us?
|
The best C compiler for Windows I ever seen is GCC (GNU C Compiler). It produces
a very stable code, strongly checks sources for stadards compatibility and also has
a huge number of optimization keys. Another compilers have no advantages over GCC,
therefore I strongly suggest to use it for UltraDefrag building.
GCC can be obtained as a part of MinGW project,
though it is recommended to download
MinGW Developer Studio
instead which is more compatible with UltraDefrag sources.
At this moment there is only one important disadvantage of GCC - it cannot produce correct
binaries for 64-bit targets. We have tested latest binaries provided by MinGW x64 project team,
but the result was unsuccessful.
You may ask, why not to use Microsoft C compiler to produce 64-bit binaries. Very reasonable question,
but unfortunately Microsoft C compiler produces wrong 64-bit binaries too, even the latest version included
in Windows 7 SDK. We have used Windows Server 2003 DDK for a long time until we had noticed that compiled
x64 binaries are wrong.
Also we have tested Pelles C compiler, but without any success, even in 32-bit mode.
Therefore at this moment we have no free C compiler which can produce right 64-bit binaries. We should wait
until it will be available for us. To partially resolve this problem, we will release a special Portable version
of the program which can be executed on 64-bit Windows under WOW64 emulator.
NOTE: When you build dynamic libraries from the MinGW
Developer Studio, the resulting *.a files are invalid. This is because I don't
know how to specify linker options properly in Developer Studio's project files.
 |
You may also use Microsoft Visual Studio 6.0
instead of the GCC, though this method of UltraDefrag building is much more complicated.
|
To use Microsoft Visual Studio 6.0 you will also need to obtain a copy of ReactOS source code
from ReactOS website for special header files
used to build the driver.
You will also need to download the following files:
ntdll.lib and
ntoskrnl.lib + hal.lib
(included in KmdKit package).
Put these files to lib subdirectory of your Visual Studio installation.
VERY IMPORTANT NOTE: The winnt.h file in visual studio 6.0
contains an incorrect definition of the NtCurrentTeb function. Therefore replace the
following lines:
#if defined(_M_ALPHA)
#define NtCurrentTeb() ((struct _TEB *)_rdteb())
#else
struct _TEB *
NtCurrentTeb(void);
#endif
with:
#if defined(_M_ALPHA)
#define NtCurrentTeb() ((struct _TEB *)_rdteb())
#else
struct _TEB *
__stdcall NtCurrentTeb(void);
#endif
Finally, edit ultradfg.dsp file (driver project file), and ensure that the
reactos header paths are properly set.
Note that currently only i386 binaries can be produced using this way.
As you can see, this way of compilation is much more complicated in comparison
with MinGW compilation, therefore it may be treated as obsolete and no particularly useful.
 |
There are also few optional tools which aren't
required for build purposes, but may be useful for debugging or better understanding program's internal structure.
|
2. Building and installation
First of all, download source archive and unpack it somewhere. Note that currently path must not
contain spaces. If you have some ideas how to fix that send your suggestion to the authors, please.
Configure build options by typing the following command:
lua configure.lua
Enter the paths to development tools and other options here. If you prefer to use MinGW, check also
box and click
to replace some libraries included in MinGW
(libntdll.a and libntoskrnl.a) with more adequate versions. Old libraries
will be saved in files with an additional suffix '.orig'.
The screenshot above represents only the actual options which gives us the best
compilation result. To configure all available options, including obsolete and experimental, type:
lua configure.lua --all
Though configure.pl script works fine too, it is obsolete. Lua
language gives us better performance and requires much less disk space itself.
There are four different build commands:
- BUILD for full-featured installer and sources package
- BUILD-MICRO for Micro Edition installer
- BUILD-PORTABLE for UltraDefrag Portable package
- BUILD-MICRO-PORTABLE for portable Micro Edition package
To build UltraDefrag type:
build
To display list of available build options type:
build --help
If you have any questions regarding details of the build process, just look at
appropriate script contents. Sure you'll find an answer.