1
1
The Win32 Build System.
2
$Id: README.WIN32-BUILD-SYSTEM 242949 2007-09-26 15:44:16Z cvs2svn $
3
Wez Furlong <wez@thebrainroom.com>
5
If you need help with the build system, send mail to
6
internals@lists.php.net; please don't email me directly.
8
===========================================================
10
1. How to build PHP under windows
12
b. Opening a command prompt
13
c. Generating configure.js
17
g. Running the test suite
20
2. How to write config.w32 files
23
===========================================================
24
1. How to build PHP under windows
28
- Windows Scripting Host (cscript.exe)
29
- Microsoft Build Tools from:
30
Microsoft Visual Studio (VC6) or later
33
- bindlib_w32 [http://www.php.net/extra/bindlib_w32.zip]
34
- win32build [http://www.php.net/extra/win32build.zip]
36
b. Opening the Build Environment Command Prompt:
37
- Using Visual Studio (VC6)
39
2. If you have a VC++ Command Prompt icon on your start menu,
40
click on it to get a Command Prompt with the env vars
43
If not, create a new shortcut and set the Target to:
45
%comspec% /k "C:\Program Files\Microsoft Visual Studio\VC98\Bin\vcvars32.bat"
47
You might also want to set the prompt to start in
48
a convenient location (such as the root of your
51
- Using Visual Studio .Net
53
2. Under the Visual Studio .Net Tools sub menu of your start
54
menu, you should have a Visual Studio .Net Command Prompt
55
icon. If not, create a new shortcut and set the Target to:
57
%comspec% /k "C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\vsvars32.bat"
59
You might also want to set the prompt to start in
60
a convenient location (such as the root of your
63
- Using the Platform SDK tools
64
1. Download the Platform SDK:
65
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
67
- You need the Core SDK, which is approx 200MB to download
68
and requires approx 500MB of disk space.
69
- The other components of the SDK are not required by PHP
70
- You might be able to reduce the download size by downloading
71
the installer control component first and then selecting
72
only the Build Environment (around 30MB), but I haven't
75
** Note: it seems that MS don't include the 32 bit
76
build tools in the platform SDK any longer, so
77
you will probably have very limited luck if you
78
don't also have VC++ or VS.Net already installed.
80
2. Once installed, you will have an icon on your start menu
81
that will launch the build environment; the latest SDK's
82
install a number of different versions of this; you probably
83
want to choose the Windows 2000 Retail build environment.
84
Clicking on this will open a command prompt with its Path,
85
Include and Lib env vars set to point to the build tools
88
c. Generating configure
90
Change directory to where you have your PHP 5 sources.
95
cscript /nologo configure.js --help
97
Will give you a list of configuration options; these will
100
--enable-foo or --disable-foo or --with-foo or --without-foo.
102
--enable-foo will turn something on, and is equivalent to
103
specifying --enable-foo=yes
105
--disable-foo will turn something off, and is equivalent to
106
specifying --enable-foo=no
108
--enable-foo=shared will attempt to build that feature as
109
a shared, dynamically loadable module.
111
Sometimes a configure option needs additional information
112
about where to find headers and libraries; quite often
113
you can specify --enable-foo=option where option could be
114
the path to where to find those files. If you want to
115
specify a parameter and build it as shared, you can use
116
this syntax instead: --enable-foo=shared,option
118
The same rules all apply to --with-foo and --without-foo;
119
the only difference is the way the options are named;
120
the convention is that --enable-foo means that you are
121
switching on something that comes with PHP, whereas
122
--with-foo means that you want to build in something
127
Once you have successfully configured your build (make
128
sure you read the output from the command to make sure
129
it worked correctly), you can build the code; simply type
131
"nmake" at the command prompt, and it will build everthing
134
Once the build has completed, you will find your binaries
135
in the build dir determined by configure; this is typically
136
Release_TS for release builds or Debug_TS for debug builds.
137
If you build a non-thread-safe build, it will use Release
138
or Debug to store the files. Also in this build dir you
139
will find sub directories for each module that went into
140
your PHP build. The files you'll want to keep are the
141
.exe and .dll files directly in your build dir.
145
You can automatically delete everything that was built
146
by running "nmake clean". This will delete everything
147
that was put there when you ran nmake, including the
150
g. Running the test suite
152
You can verify that your build is working well by running
153
the regression test suite. You do this by typing
154
"nmake test". You can specify the tests you want to run
155
by defing the TESTS variable - if you wanted to run the
156
sqlite test suite only, you would type
157
"nmake /D TESTS=ext/sqlite/tests test"
161
If you want to set up an automated build that will tolerate
162
breakages in some of the modules, you can use the
163
--enable-snapshot-build configure option to generate a
164
makefile optimized for that purpose. A snapshot build will
165
switch the argument parser so that the default option for
166
configure switches that your don't specify will be set
167
to "shared". The effect of this is to turn on all options
168
unless you explicitly disable them. When you have configured
169
your snapshot build, you can use "nmake build-snap" to build
170
everything, ignoring build errors in individual extensions
3
See http://wiki.php.net/internals/windows/stepbystepbuild
173
5
vim:tw=78:sw=1:ts=1:et