@@ -4,10 +4,42 @@ order: 3
44---
55# PIE for Extension Maintainers
66
7+ ## The PIE build & install steps
8+
9+ ### Non-Windows (e.g. Linux, OSX, etc.)
10+
11+ PIE follows the usual [ PHP extension build and install process] ( https://www.php.net/manual/en/install.pecl.phpize.php ) ,
12+ namely:
13+
14+ * ` phpize ` to set up the PHP API parameters. The person installing the
15+ extension may specify ` --with-phpize-path ` if ` phpize ` is not in the path.
16+ * ` ./configure ` to configure the build parameters and libraries for the
17+ specific system. The person installing the extension may specify the
18+ configure options that you have specified in ` composer.json ` . See the
19+ [ Configure Options] ( #configure-options ) documentation for how to do this.
20+ * ` make ` to actually build the extension. This will try to detect the number
21+ of parallel processes to run automatically, but the person installing may
22+ override this with ` --make-parallel-jobs N ` or ` -jN ` options.
23+ * ` make install ` to install the extension to the configured PHP installation.
24+ If PIE does not have permissions to write to the installation location, it
25+ will attempt to elevate privileges with ` sudo ` .
26+
27+ Note that this does mean the systems you are running PIE on need to have the
28+ appropriate build tools installed. A useful resource for building extensions
29+ and how PHP's internal works is the [ PHP Internals Book] ( https://www.phpinternalsbook.com/ ) .
30+
31+ ### Windows
32+
33+ For Windows systems, extension maintainers must provide pre-built binaries. See
34+ the [ Windows Support] ( #windows-support ) section below for details on how to
35+ do this in the right way for PIE.
36+
37+ ## How to add PIE support for your extension
38+
739Adding PIE support for your extension is relatively straightforward, and the
840flow is quite similar to adding a regular PHP package into Packagist.
941
10- ## Add a ` composer.json ` to your extension
42+ ### Add a ` composer.json ` to your extension
1143
1244The first step to adding PIE support is adding a ` composer.json ` to your
1345extension repository. Most of the typical fields are the same, with a few
@@ -22,9 +54,9 @@ notable exceptions:
2254 cannot share the same Composer package name as a regular PHP package, even
2355 if they have different ` type ` fields.
2456
25- ### The ` php-ext ` definition
57+ #### The ` php-ext ` definition
2658
27- #### ` extension-name `
59+ ##### ` extension-name `
2860
2961The ` extension-name ` SHOULD be specified, and must conform to the usual extension
3062name regular expression, which is defined in
@@ -56,12 +88,12 @@ An example of `extension-name` being used:
5688}
5789```
5890
59- #### ` priority `
91+ ##### ` priority `
6092
6193` priority ` is currently not used, but will form part of the ` ini ` filename to
6294control ordering of extensions, if the target platform uses it.
6395
64- #### ` support-zts ` and ` support-nts `
96+ ##### ` support-zts ` and ` support-nts `
6597
6698Indicates whether the extension supports Zend Thread-Safe (ZTS) and non-Thread-
6799Safe (NTS) modes. Both these flags default to ` true ` if not specified, but if
@@ -72,7 +104,7 @@ Theoretically, it is possible to specify `false` for both `support-zts` and
72104` support-nts ` , but this will mean your package cannot be installed anywhere, so
73105is not advisable.
74106
75- #### ` configure-options `
107+ ##### ` configure-options `
76108
77109This is a list of parameters that may be passed to the ` ./configure ` command.
78110Each item of the list is a JSON object with:
@@ -132,7 +164,7 @@ If an end user does not specify a flag defined in the `configure-options`
132164definition, it will simply not be passed to ` ./configure ` . There is no way to
133165specify a default value in the ` configure-options ` definition.
134166
135- #### ` build-path `
167+ ##### ` build-path `
136168
137169The ` build-path ` setting may be used if your source code is not in the root
138170of your repository. For example, if your repository structure is like:
@@ -166,7 +198,7 @@ The `build-path` may contain some templated values which are replaced:
166198 with version 1.2.3 with a ` build-path ` of ` myext-{version} ` the actual build
167199 path would become ` myext-1.2.3 ` .
168200
169- #### ` download-url-method `
201+ ##### ` download-url-method `
170202
171203The ` download-url-method ` directive allows extension maintainers to
172204change the behaviour of downloading the source package.
@@ -180,7 +212,7 @@ change the behaviour of downloading the source package.
180212 * ` php_{ExtensionName}-{Version}-src.tgz ` (e.g. ` php_myext-1.20.1-src.tgz ` )
181213 * ` php_{ExtensionName}-{Version}-src.zip ` (e.g. ` php_myext-1.20.1-src.zip ` )
182214
183- ### Extension dependencies
215+ #### Extension dependencies
184216
185217Extension authors may define some dependencies in ` require ` , but practically,
186218most extensions would not need to define dependencies. Dependencies on other
@@ -193,15 +225,15 @@ dependency, this would prevent installation of the extension, and at the moment
193225the messaging around this is
194226[ not particularly clear] ( https://github.com/php/pie/issues/15 ) .
195227
196- ## Submit the extension to Packagist
228+ ### Submit the extension to Packagist
197229
198230Once you have committed your ` composer.json ` to your repository, you may then
199231submit it to Packagist in the same way as any other package.
200232
201233 * Head to [ https://packagist.org/packages/submit ] ( https://packagist.org/packages/submit )
202234 * Enter the URL of your repository, and follow the instructions.
203235
204- ## Windows Support
236+ ### Windows Support
205237
206238In order to support Windows users, you must publish pre-built DLLs, as PIE does
207239not currently support building DLLs on the fly. The expected workflow for
@@ -228,7 +260,7 @@ The descriptions of these items:
228260 * Windows: ` Architecture ` from ` php -i `
229261 * non-Windows: check ` PHP_INT_SIZE ` - 4 for 32-bit, 8 for 64-bit.
230262
231- ### Contents of the Windows ZIP
263+ #### Contents of the Windows ZIP
232264
233265The pre-built ZIP should contain at minimum a DLL named in the same way as the
234266ZIP itself, for example
@@ -243,7 +275,7 @@ additional resources, such as:
243275* Any other file, which would be moved
244276 into ` C:\path\to\php\extras\{extension-name}\. `
245277
246- ### Automation of the Windows publishing
278+ #### Automation of the Windows publishing
247279
248280PHP provides a [ set of GitHub Actions] ( https://github.com/php/php-windows-builder )
249281that enable extension maintainers to build and release the Windows compatible
0 commit comments