-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmake.ps1
64 lines (60 loc) · 2.33 KB
/
make.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env pwsh
##############################################################################################################
Function PrivClipper {
Return "
Usage: pwsh -File $($PSCommandPath) [OPTIONS]
Options:
build Build program
"
}
Function PrivPrepare {
$VAR = @(
@{
Cmd = 'lazbuild'
Url = 'https://netix.dl.sourceforge.net/project/lazarus/Lazarus%20Windows%2064%20bits/Lazarus%203.6/lazarus-3.6-fpc-3.2.2-win64.exe?viasf=1'
Path = "C:\Lazarus"
}
)
ForEach ($REPLY in $VAR) {
If (-not (Get-Command $REPLY.Cmd -ea 'continue')) {
$params = @{
Uri = $REPLY.Url
OutFile = (Split-Path -Path $REPLY.Url -Leaf).Split('?')[0]
}
Invoke-WebRequest @params
Start-Process -PassThru -Wait -FilePath $params.OutFile -ArgumentList '/SP-', '/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART'
Remove-Item $params.OutFile
$env:PATH+=";$($REPLY.Path)"
Get-Command $REPLY.Cmd
}
}
}
Function PrivMain {
$ErrorActionPreference = 'stop'
Set-PSDebug -Strict -Trace 1
Invoke-ScriptAnalyzer -EnableExit -Path $PSCommandPath
If ($args.count -gt 0) {
Switch ($args[0]) {
'build' {
PrivPrepare
If (Test-Path -Path 'use') {
Start-Process -Wait -FilePath 'git' -ArgumentList 'submodule', 'update', '--recursive', '--init'
Start-Process -Wait -FilePath 'git' -ArgumentList 'submodule', 'update', '--recursive', '--remote'
Get-ChildItem -Filter '*.lpk' -Recurse -File –Path 'use' | ForEach-Object {
Start-Process -PassThru -Wait -FilePath 'lazbuild' -ArgumentList '--add-package-link', $_.Name
}
}
Get-ChildItem -Filter '*.lpi' -Recurse -File –Path 'src' | ForEach-Object {
Start-Process -Wait -FilePath 'lazbuild' -ArgumentList '--no-write-project', '--recursive', '--build-mode=release', $_.Name
}
}
Default {
PrivClipper
}
}
} Else {
PrivClipper
}
}
##############################################################################################################
PrivMain @args