Skip to content

Commit 461fd8d

Browse files
committed
Update docs
1 parent 98fe668 commit 461fd8d

File tree

102 files changed

+256
-39
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+256
-39
lines changed

bin/make-docs.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
function generateModuleDocs(
1515
string $file,
1616
string $namespace,
17-
string $destination
17+
string $destination,
18+
string $url = '',
1819
): void {
1920
$content = file_get_contents($file);
2021
preg_match('/^#\[===+\[\s*(.*?)\s*#\]===+\]/s', $content, $matches);
@@ -24,6 +25,10 @@ function generateModuleDocs(
2425

2526
$content = '';
2627
$content .= "# $namespace" . "$moduleName\n\n";
28+
if ($url === '') {
29+
$url = 'https://github.com/petk/php-build-system/tree/master/cmake/cmake/modules/' . $namespace . $moduleName . '.cmake';
30+
}
31+
$content .= "See: [$moduleName.cmake]($url)\n\n";
2732
$content .= $matches[1];
2833
$content .= "\n";
2934

@@ -64,8 +69,10 @@ function generateModuleDocs(
6469
}
6570

6671
// Add ext/skeleton/cmake/modules/FindPHP.cmake.
72+
echo "Processing ext/skeleton/cmake/modules/FindPHP.cmake\n";
6773
generateModuleDocs(
6874
__DIR__ . '/../cmake/ext/skeleton/cmake/modules/FindPHP.cmake',
6975
'',
70-
$docs
76+
$docs,
77+
'https://github.com/petk/php-build-system/blob/master/cmake/ext/skeleton/cmake/modules/FindPHP.cmake',
7178
);

docs/autotools.md

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,23 @@ system.
55

66
## Index
77

8-
* [1. Directory structure](#1-directory-structure)
9-
* [2. Build system diagram](#2-build-system-diagram)
10-
* [3. Build requirements](#3-build-requirements)
11-
* [4. The configure command-line options](#4-the-configure-command-line-options)
12-
* [5. Determining platform](#5-determining-platform)
13-
* [6. Common checks](#6-common-checks)
14-
* [6.1. Testing if program works](#61-testing-if-program-works)
15-
* [6.1.1. AC\_COMPILE\_IFELSE](#611-ac_compile_ifelse)
16-
* [6.1.2. AC\_LINK\_IFELSE](#612-ac_link_ifelse)
17-
* [6.1.3. AC\_RUN\_IFELSE](#613-ac_run_ifelse)
18-
* [6.2. Functions](#62-functions)
19-
* [7. GNU Autoconf Archive](#7-gnu-autoconf-archive)
20-
* [8. Parser and lexer files](#8-parser-and-lexer-files)
21-
* [9. See more](#9-see-more)
8+
* [1. Introduction](#1-introduction)
9+
* [2. Directory structure](#2-directory-structure)
10+
* [3. Build system diagram](#3-build-system-diagram)
11+
* [4. Build requirements](#4-build-requirements)
12+
* [5. The configure command-line options](#5-the-configure-command-line-options)
13+
* [6. Determining platform](#6-determining-platform)
14+
* [7. Common checks](#7-common-checks)
15+
* [7.1. Testing if program works](#71-testing-if-program-works)
16+
* [7.1.1. AC\_COMPILE\_IFELSE](#711-ac_compile_ifelse)
17+
* [7.1.2. AC\_LINK\_IFELSE](#712-ac_link_ifelse)
18+
* [7.1.3. AC\_RUN\_IFELSE](#713-ac_run_ifelse)
19+
* [7.2. Functions](#72-functions)
20+
* [8. GNU Autoconf Archive](#8-gnu-autoconf-archive)
21+
* [9. Parser and lexer files](#9-parser-and-lexer-files)
22+
* [10. See more](#10-see-more)
23+
24+
## 1. Introduction
2225

2326
\*nix build system (Linux, macOS, FreeBSD, OpenBSD, Solaris, Haiku, etc.) in PHP
2427
uses [Autoconf](https://www.gnu.org/software/autoconf/) to build a `configure`
@@ -74,7 +77,7 @@ installation dependencies. Autotools is a veteran build system present since
7477
early C/C++ days. It is used for most Linux ecosystem out there and it might
7578
cause issues for C developers today.
7679
77-
## 1. Directory structure
80+
## 2. Directory structure
7881
7982
PHP build system is a collection of various files across the php-src repository:
8083
@@ -126,11 +129,11 @@ PHP build system is a collection of various files across the php-src repository:
126129
└─ configure.ac # Autoconf main input file for creating configure script
127130
```
128131
129-
## 2. Build system diagram
132+
## 3. Build system diagram
130133
131134
![PHP *nix build system using Autotools](/docs/images/autotools.svg)
132135
133-
## 3. Build requirements
136+
## 4. Build requirements
134137
135138
Before you can build PHP on Linux and other Unix-like systems, you must first
136139
install certain third-party requirements. It's important to note that the names
@@ -156,7 +159,7 @@ Additionally required when building from Git repository source code:
156159
* bison
157160
* re2c
158161
159-
## 4. The configure command-line options
162+
## 5. The configure command-line options
160163
161164
Configuration can be passed on the command line at the configuration phase:
162165
@@ -194,7 +197,7 @@ Some common arguments can be passed to command-line options:
194197
* Some options accept multiple arguments separated by comma (`,`). For example,
195198
passing the library location and similar: `--with-EXT=shared,/usr`
196199
197-
## 5. Determining platform
200+
## 6. Determining platform
198201
199202
With Autotools there are several shell variables that help determine the
200203
platform characteristics such as CPU, operating system and vendor name. When
@@ -214,9 +217,9 @@ AS_CASE([$host_alias], [*freebsd*|*openbsd*],
214217
[AC_MSG_NOTICE([Action that is run only on FreeBSD and OpenBSD systems.])])
215218
```
216219
217-
## 6. Common checks
220+
## 7. Common checks
218221
219-
### 6.1. Testing if program works
222+
### 7.1. Testing if program works
220223
221224
There are 3 main Autoconf macros that check if certain test code is successful.
222225
@@ -225,14 +228,15 @@ Let's check a simple C program:
225228
```c
226229
#include <stdio.h>
227230
228-
int main(void) {
231+
int main(void)
232+
{
229233
printf("Hello World");
230234
231235
return 0;
232236
}
233237
```
234238
235-
#### 6.1.1. AC_COMPILE_IFELSE
239+
#### 7.1.1. AC_COMPILE_IFELSE
236240
237241
```m4
238242
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>],
@@ -241,12 +245,13 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>],
241245
[php_cv_func_printf_works=no])
242246
```
243247
244-
The `AC_LANG_PROGRAM` macro will expand this into:
248+
The `AC_LANG_PROGRAM` macro will expand this into something like this:
245249
246250
```c
247251
#include <stdio.h>
248252
249-
int main(void) {
253+
int main(void)
254+
{
250255
printf("Hello World")
251256
;
252257
return 0;
@@ -259,7 +264,7 @@ The `AC_COMPILE_IFELSE` will run the compilation step, for example:
259264
gcc -o out -c hello_world.c
260265
```
261266
262-
#### 6.1.2. AC_LINK_IFELSE
267+
#### 7.1.2. AC_LINK_IFELSE
263268
264269
```m4
265270
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>],
@@ -274,7 +279,7 @@ This will run compilation and linking:
274279
gcc -o out hello_world.c
275280
```
276281
277-
#### 6.1.3. AC_RUN_IFELSE
282+
#### 7.1.3. AC_RUN_IFELSE
278283
279284
This will compile, link and also run the program to check if the return code is
280285
0.
@@ -299,7 +304,7 @@ gcc -o out hello_world.c
299304
./out
300305
```
301306
302-
### 6.2. Functions
307+
### 7.2. Functions
303308
304309
Testing if function exists within the given header.
305310
@@ -331,7 +336,7 @@ sees the function. They can be used like this:
331336
#endif
332337
```
333338
334-
## 7. GNU Autoconf Archive
339+
## 8. GNU Autoconf Archive
335340
336341
To reuse the code there is a community collection of Autoconf macros available
337342
at [autoconf-archive](https://github.com/autoconf-archive/autoconf-archive).
@@ -358,13 +363,14 @@ AC_CONFIG_MACRO_DIR([path/to/m4/dir])
358363
359364
However, the `aclocal` from Automake is needed for this to work.
360365
361-
## 8. Parser and lexer files
366+
## 9. Parser and lexer files
362367
363368
Parser and lexer files are generated upon the build step (`make`) with `bison`
364369
and `re2c` tools based on the targets in `Makefile.frag` files.
365370
366371
There is also a helper shell script available that generates these files when
367-
developing or releasing PHP source code, otherwise they.
372+
developing or releasing PHP source code, otherwise they are generated during the
373+
build phase upon the `make` invocation.
368374
369375
```sh
370376
./scripts/dev/genfiles
@@ -381,6 +387,12 @@ Autotools-based PHP build system files related to `bison` and `re2c`:
381387
└─ Makefile.frag # Makefile fragment
382388
└─ pdo/
383389
└─ Makefile.frag # Makefile fragment
390+
└─ pdo_mysql/
391+
└─ Makefile.frag # Makefile fragment
392+
└─ pdo_pgsql/
393+
└─ Makefile.frag # Makefile fragment
394+
└─ pdo_sqlite/
395+
└─ Makefile.frag # Makefile fragment
384396
└─ phar/
385397
└─ Makefile.frag # Makefile fragment
386398
└─ standard/
@@ -396,7 +408,7 @@ Autotools-based PHP build system files related to `bison` and `re2c`:
396408
└─ configure.ac # Minimum re2c and bison versions settings
397409
```
398410
399-
## 9. See more
411+
## 10. See more
400412
401413
Useful resources to learn more about Autoconf and Autotools in general:
402414

docs/c.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ program `main.c`:
2323
* The main function in C is a special entry point of a program where the
2424
* execution begins.
2525
*/
26-
int main(void) {
26+
int main(void)
27+
{
2728
printf("%s\n", MY_NAME);
2829

2930
return 0;

docs/cmake-intro.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,8 @@ during program runtime. For example:
357357
/* main.c */
358358
#include <dlfcn.h>
359359

360-
int main(void) {
360+
int main(void)
361+
{
361362
void *handle = dlopen("extension.so", RTLD_LAZY);
362363
void (*extension_function_ptr)() = dlsym(handle, "extension_function");
363364
extension_function_ptr();
@@ -507,10 +508,11 @@ behaves correctly across various environments.
507508
#include "config.h"
508509
509510
#ifdef HAVE_SYS_TYPES_H
510-
#include <sys/types.h>
511+
# include <sys/types.h>
511512
#endif
512513
513-
int main(void) {
514+
int main(void)
515+
{
514516
return 0;
515517
}
516518
```

docs/cmake-modules/FindACL.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# FindACL
22

3+
See: [FindACL.cmake](https://github.com/petk/php-build-system/tree/master/cmake/cmake/modules/FindACL.cmake)
4+
35
Find the ACL library.
46

57
Module defines the following `IMPORTED` target(s):

docs/cmake-modules/FindApache.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# FindApache
22

3+
See: [FindApache.cmake](https://github.com/petk/php-build-system/tree/master/cmake/cmake/modules/FindApache.cmake)
4+
35
Find the Apache packages and tools.
46

57
The Apache development package usually contains Apache header files, the `apr`

docs/cmake-modules/FindAppArmor.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# FindAppArmor
22

3+
See: [FindAppArmor.cmake](https://github.com/petk/php-build-system/tree/master/cmake/cmake/modules/FindAppArmor.cmake)
4+
35
Find the AppArmor library.
46

57
Module defines the following `IMPORTED` target(s):

docs/cmake-modules/FindArgon2.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# FindArgon2
22

3+
See: [FindArgon2.cmake](https://github.com/petk/php-build-system/tree/master/cmake/cmake/modules/FindArgon2.cmake)
4+
35
Find the Argon2 library.
46

57
Module defines the following `IMPORTED` target(s):

docs/cmake-modules/FindAtomic.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# FindAtomic
22

3+
See: [FindAtomic.cmake](https://github.com/petk/php-build-system/tree/master/cmake/cmake/modules/FindAtomic.cmake)
4+
35
Find the atomic instructions.
46

57
Module defines the following `IMPORTED` target(s):

docs/cmake-modules/FindBerkeleyDB.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# FindBerkeleyDB
22

3+
See: [FindBerkeleyDB.cmake](https://github.com/petk/php-build-system/tree/master/cmake/cmake/modules/FindBerkeleyDB.cmake)
4+
35
Find the Berkeley DB library.
46

57
Module defines the following `IMPORTED` target(s):

0 commit comments

Comments
 (0)