diff --git a/build-setup.php b/build-setup.php index 0ab2f84cab..81fb745dcb 100644 --- a/build-setup.php +++ b/build-setup.php @@ -6,14 +6,22 @@

- This page is intended to help setup a development environment for PHP, if mistakes are found + This page is intended to help set up a development environment for PHP, if mistakes are found please report them.

'; -site_header("Operating System Preparation", ["current" => "community"]); +site_header( + "Operating System Preparation", + [ + "current" => "community", + "css" => [ + "code-syntax.css", + ], + ], +); ?>

Operating System Preparation

@@ -22,28 +30,30 @@ Improving PHP requires a working build environment to test changes, the following section deals with setting up a working build environment.

- Your build environment should have an appropriate toolchain that includes a working C compiler, - for those not working in Microsoft Windows, you will need a working, compatible autotools installation, and at the very least a shared copy of zlib. + Your build environment should have an appropriate toolchain that includes a working C compiler. + For those not working in Microsoft Windows, you will need a working, compatible autotools installation, and at the very least a shared copy of zlib.

For most *nix like operating systems, some external dependencies may be required to bring a build to completion; - if a build fails because of missing headers or libraries, issuing a variant of the following command should resolve those dependencies, allowing the build to continue: -

+ if a build fails because of missing headers or libraries, issuing a variant of the following command should resolve those dependencies, allowing the build to continue.

+
+
[sudo] yum|apt|port install package[-dev[el]]
+
+

+ For those working in Ubuntu Linux, you can run the following command to automate the installation of dependencies. +

+
+
sudo apt build-dep php
+

- For those working in Ubuntu Linux, you can run the following command to automate the installation of dependencies: -

- If the compilation of an extension should fail because of missing dependencies, Ubuntu Linux can attempt to automate the resolution of those dependencies by issuing: - + If the compilation of an extension fails because of missing dependencies, Ubuntu Linux can attempt to automate the resolution of those dependencies by issuing:

+
+
sudo apt build-dep php-<extname>
+

- The following table shows what is required for Microsoft Windows users to build PHP: + The following table shows what is required for Microsoft Windows users to build supported PHP versions:

@@ -54,35 +64,44 @@ - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - + + + - +
PHP SDK
5.3Visual Studio 20086.1x86here8.2Visual Studio 2019VS16 + x86, + x64 + tools
5.4Visual Studio 20086.1x86here8.3Visual Studio 2019VS16 + x86, + x64 + tools
5.5Visual Studio 20086.1x86here8.4Visual Studio 2022VS17 + x86, + x64 + tools
5.5Visual Studio 2012N/A8.5Visual Studio 2022VS17 - x86, - x64 + x86, + x64 heretools

Note: If a Windows SDK is required, it is advised to install the SDK before Visual Studio.

@@ -91,34 +110,34 @@

Workspace Preparation

- Windows users should now download and unzip the PHP SDK to their workspace and execute the following commands in an appropriate Visual Studio Console: + Windows users should now download and unzip the PHP SDK to their workspace and execute the following commands in an appropriate Visual Studio 2019/2022 Developer Command Prompt:

- Visual Studio 2008: -

- Visual Studio 2008 and 2012: - - Windows should now change to the directory C:\path-to-workspace\phpdev\VCXX\XARCH, and consider it the root of the workspace for the current build. + Visual Studio 2019 and 2022: +

+
+
cd C:\path-to-workspace
+bin\phpsdk_setvars.bat
+bin\phpsdk_buildtree.bat phpdev
+
+

+ Windows should now change to the directory C:\path-to-workspace\phpdev\VSXX\XARCH, and consider it the root of the workspace for the current build.

The next step for everyone is to obtain the versioned PHP sources via git: -

- BRANCH should be replaced with an appropriate branch name, for example PHP-5.5. +

+
+
git clone -b BRANCH https://github.com/php/php-src .
+
+

+ BRANCH should be replaced with an appropriate branch name, for example, PHP-8.5.

- At this point you have a working build environment and the vanilla sources for your chosen branch of PHP, it is a good idea, before you change anything at all, to create a new branch and switch to it, in preparation for your awesome changes to come: -

+ At this point you have a working build environment and the vanilla sources for your chosen branch of PHP, it is a good idea, before you change anything at all, to create a new branch and switch to it, in preparation for your awesome changes to come.

+
+
git checkout -b my-awesome-changes
+
@@ -126,50 +145,50 @@

All operating systems now converge on (near as makes no difference) the same solutions for the rest of the build process: -

-

- For Microsoft Windows operating systems, those commands looks like this: -

+ +

+ For Microsoft Windows operating systems, those commands look like this:

+
+
buildconf
+configure --with-prefix=C:\my-awesome-php
+nmake
+nmake test
+nmake install
+

While for the rest of us, those commands look like this: -

+
+
./buildconf
+./configure --prefix=/opt/my-awesome-php
+make
+make test
+make install
+

- The configure script has the ability to customize almost every aspect of PHP, to elicit help at the console pass --help + The configure script can customize almost every aspect of PHP, to elicit help at the console pass --help as the only argument to configure

When configure executes, it saves the options passed in to a re-usable config.nice which executes configure when invoked.

- Upon successful completion of a build, it is recommended to run the test suite, this will help you to identify regression problems in your work, + Upon successful completion of a build, it is recommended to run the test suite; this will help you to identify regression problems in your work, running the test suite can take a while; go out for a run, or a burger.

It is also possible to run a set (directory) of tests in the following way: -

+
+
[n]make test TESTS=sapi/cli
+
$SIDEBAR_DATA]); diff --git a/styles/code-syntax.css b/styles/code-syntax.css index 4f9e73177a..02f927911e 100644 --- a/styles/code-syntax.css +++ b/styles/code-syntax.css @@ -96,3 +96,11 @@ button.copy-to-clipboard-button:hover { .instructions .sha256 { word-break: break-all; } + +.content-box .code-toolbar { + margin: 0 0 1rem; +} + +.content-box .code-toolbar pre.small { + padding: 0.75rem; +}