File tree Expand file tree Collapse file tree 3 files changed +55
-0
lines changed
extension/BuildPhpExtension/private Expand file tree Collapse file tree 3 files changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ Function Add-BuildTools {
2
+ <#
3
+ . SYNOPSIS
4
+ Add build tools.
5
+ . PARAMETER Config
6
+ Configuration for the extension.
7
+ #>
8
+ [OutputType ()]
9
+ param (
10
+ [Parameter (Mandatory = $true , Position = 0 , HelpMessage = ' Configuration for the extension' )]
11
+ [PSCustomObject ] $Config
12
+ )
13
+ begin {
14
+ }
15
+ process {
16
+ $Config.build_tools | ForEach-Object {
17
+ if ($null -eq (Get-Command $_ - ErrorAction SilentlyContinue)) {
18
+ switch ($_ )
19
+ {
20
+ nasm {
21
+ choco install nasm - y -- force
22
+ Add-Path - Path " $env: ProgramFiles \NASM"
23
+ }
24
+ cmake {
25
+ choco install cmake -- installargs ' ADD_CMAKE_TO_PATH=User' - y -- force
26
+ }
27
+ cargo {
28
+ choco install rust - y -- force
29
+ Add-Path - Path " $env: USERPROFILE \.cargo\bin"
30
+ }
31
+ git {
32
+ choco install git.install -- params " '/GitAndUnixToolsOnPath /WindowsTerminal /NoAutoCrlf'" - y -- force
33
+ }
34
+ Default {
35
+ $resultLines = (choco search $_ -- limit-output ) -split " \`r ?\`n "
36
+ if ($resultLines | Where-Object { $_ -match " ^$_ \|" }) {
37
+ choco install $_ - y -- force
38
+ }
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
44
+ end {
45
+ }
46
+ }
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ Function Add-Dependencies {
19
19
process {
20
20
Add-PhpDependencies - Config $Config
21
21
Add-ExtensionDependencies - Config $Config
22
+ Add-BuildTools - Config $Config
22
23
Add-Extensions - Config $Config - Prefix $Prefix
23
24
}
24
25
end {
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ Function Get-ExtensionConfig {
72
72
options = @ ()
73
73
php_libraries = @ ()
74
74
extension_libraries = @ ()
75
+ build_tools = @ ()
75
76
extensions = @ ()
76
77
docs = @ ()
77
78
build_directory = " "
@@ -162,6 +163,13 @@ Function Get-ExtensionConfig {
162
163
}
163
164
}
164
165
166
+ $configW32Content = [string ](Get-Content - Path " config.w32" )
167
+ if ($configW32Content.contains (' PATH_PROG' )) {
168
+ [regex ]::Matches($configW32Content , ' PATH_PROG\((['' "])([^'' "]+)\1' ) | ForEach-Object {
169
+ $config.build_tools += $_.Groups [2 ].Value
170
+ }
171
+ }
172
+
165
173
$config.build_directory = if ($Arch -eq " x64" ) { " x64\" } else { " " }
166
174
$config.build_directory += " Release"
167
175
if ($Ts -eq " ts" ) { $config.build_directory += " _TS" }
You can’t perform that action at this time.
0 commit comments