Skip to content

Commit 22e444c

Browse files
authored
[skip ci] README: Add macos instruction + other tweaks (GH-18670)
1 parent 25e1674 commit 22e444c

File tree

1 file changed

+46
-14
lines changed

1 file changed

+46
-14
lines changed

README.md

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,28 +42,50 @@ a default build, you will additionally need libxml2 and libsqlite3.
4242

4343
On Ubuntu, you can install these using:
4444

45-
sudo apt install -y pkg-config build-essential autoconf bison re2c \
46-
libxml2-dev libsqlite3-dev
45+
```shell
46+
sudo apt install -y pkg-config build-essential autoconf bison re2c libxml2-dev libsqlite3-dev
47+
```
4748

4849
On Fedora, you can install these using:
4950

50-
sudo dnf install re2c bison autoconf make libtool ccache libxml2-devel sqlite-devel
51+
```shell
52+
sudo dnf install re2c bison autoconf make libtool ccache libxml2-devel sqlite-devel
53+
```
54+
55+
On MacOS, you can install these using `brew`:
56+
57+
```shell
58+
brew install autoconf bison re2c iconv libxml2 sqlite
59+
```
60+
61+
or with `MacPorts`:
62+
63+
```shell
64+
sudo port install autoconf bison re2c libiconv libxml2 sqlite3
65+
```
5166

5267
Generate configure:
5368

54-
./buildconf
69+
```shell
70+
./buildconf
71+
```
5572

5673
Configure your build. `--enable-debug` is recommended for development, see
5774
`./configure --help` for a full list of options.
5875

59-
# For development
60-
./configure --enable-debug
61-
# For production
62-
./configure
76+
```shell
77+
# For development
78+
./configure --enable-debug
79+
# For production
80+
./configure
81+
```
6382

64-
Build PHP. To speed up the build, specify the maximum number of jobs using `-j`:
83+
Build PHP. To speed up the build, specify the maximum number of jobs using the
84+
`-j` argument:
6585

66-
make -j4
86+
```shell
87+
make -j4
88+
```
6789

6890
The number of jobs should usually match the number of available cores, which
6991
can be determined using `nproc`.
@@ -74,23 +96,33 @@ PHP ships with an extensive test suite, the command `make test` is used after
7496
successful compilation of the sources to run this test suite.
7597

7698
It is possible to run tests using multiple cores by setting `-jN` in
77-
`TEST_PHP_ARGS`:
99+
`TEST_PHP_ARGS` or `TESTS`:
78100

79-
make TEST_PHP_ARGS=-j4 test
101+
```shell
102+
make TEST_PHP_ARGS=-j4 test
103+
```
80104

81105
Shall run `make test` with a maximum of 4 concurrent jobs: Generally the maximum
82106
number of jobs should not exceed the number of cores available.
83107

108+
Use the `TEST_PHP_ARGS` or `TESTS` variable to test only specific directories:
109+
110+
```shell
111+
make TESTS=tests/lang/ test
112+
```
113+
84114
The [qa.php.net](https://qa.php.net) site provides more detailed info about
85115
testing and quality assurance.
86116

87117
## Installing PHP built from source
88118

89119
After a successful build (and test), PHP may be installed with:
90120

91-
make install
121+
```shell
122+
make install
123+
```
92124

93-
Depending on your permissions and prefix, `make install` may need super user
125+
Depending on your permissions and prefix, `make install` may need superuser
94126
permissions.
95127

96128
## PHP extensions

0 commit comments

Comments
 (0)