Skip to content

Commit 4344255

Browse files
committed
Add inputs for args and libraries for local setup
1 parent ce4d00e commit 4344255

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,18 +297,17 @@ Then, you can build the PHP extension by using the `Invoke-PhpBuildExtension` co
297297
- To build the extension for a specific PHP version, use the `PhpVersion` input. It supports values in major.minor format, e.g., 7.4, 8.0, etc.
298298
- To build the extension for a 32-bit or a 64-bit version, use the `Arch` input. It supports values `x64` and `x86`.
299299
- To build the extension for a thread-safe or non-thread-safe version, use the `Ts` input. It supports values `ts` and `nts`.
300-
301-
If your extension requires additional libraries, you can set the Libraries environment variable to a list of libraries separated by comma.
302-
If your extension requires additional arguments to pass to the `configure` script, you can set the `Args` environment variable to the additional arguments.
300+
- To specify the libraries required for the extension, use the `Libraries` input. It supports a comma-separated list of library names.
301+
- To specify additional arguments to pass to the `configure` script, use the `Args` input. It supports a string value.
303302

304303
```powershell
305-
$env:LIBRARIES = 'zlib'
306-
$env:CONFIGURE_ARGS = '--with-xdebug'
307304
Invoke-PhpBuildExtension -ExtensionUrl https://github.com/xdebug/xdebug `
308305
-ExtensionRef 3.3.2 `
309306
-PhpVersion 8.4 `
310307
-Arch x64 `
311-
-Ts nts
308+
-Ts nts `
309+
-Libraries "zlib" `
310+
-Args "--with-xdebug"
312311
```
313312

314313
It should produce the extension builds in a directory named `artifacts` in the current directory.

extension/BuildPhpExtension/public/Invoke-PhpBuildExtension.ps1

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ function Invoke-PhpBuildExtension {
1414
Thread Safety
1515
.PARAMETER Libraries
1616
Libraries required by the extension
17+
.PARAMETER ConfigureArgs
18+
Additional arguments for the configure script
1719
#>
1820
[OutputType()]
1921
param (
@@ -32,7 +34,11 @@ function Invoke-PhpBuildExtension {
3234
[Parameter(Mandatory = $true, Position=4, HelpMessage='PHP Build Type')]
3335
[ValidateNotNull()]
3436
[ValidateSet('nts', 'ts')]
35-
[string] $Ts
37+
[string] $Ts,
38+
[Parameter(Mandatory = $false, Position=5, HelpMessage='Libraries required by the extension')]
39+
[string] $Libraries = '',
40+
[Parameter(Mandatory = $false, Position=6, HelpMessage='Additional arguments for the configure script')]
41+
[string] $Args = ''
3642
)
3743
begin {
3844
}
@@ -44,6 +50,14 @@ function Invoke-PhpBuildExtension {
4450
throw "PHP version $PhpVersion is not supported."
4551
}
4652

53+
if($null -ne $Libraries -and $Libraries -ne '') {
54+
$env:LIBRARIES = $Libraries
55+
}
56+
57+
if($null -ne $Args -and $Args -ne '') {
58+
$env:CONFIGURE_ARGS = $Args
59+
}
60+
4761
$currentDirectory = (Get-Location).Path
4862

4963
$buildDirectory = Get-BuildDirectory

0 commit comments

Comments
 (0)