-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsynclibs.ps1
32 lines (26 loc) · 1.33 KB
/
synclibs.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
# Script that synchronizes the local library dependencies
#
# Version: 20150105
$GitUrlPrefix = "https://github.com/libyal"
$LocalLibs = @("libbfio","libcdata","libcerror","libcfile","libclocale","libcnotify","libcpath","libcsplit","libcstring","libcsystem","libcthreads","libfcache","libfdata","libfdatetime","libfguid","libfmapi","libfvalue","libfwnt","libuna")
foreach (${LocalLib} in ${LocalLibs})
{
# PowerShell will raise NativeCommandError if git writes to stdout or stderr
# therefore 2>&1 is added and the output is stored in a variable.
$Output = Invoke-Expression -Command "git clone ${GitUrlPrefix}/${LocalLib}.git ${LocalLib}-${pid} 2>&1"
if (Test-Path ${LocalLib}-${pid})
{
$LocalLibVersion = Get-Content -Path ${LocalLib}-${pid}\configure.ac | select -skip 4 -first 1 | % { $_ -Replace " \[","" } | % { $_ -Replace "\],","" }
if (Test-Path ${LocalLib})
{
Remove-Item -Path ${LocalLib} -Force -Recurse
}
New-Item -ItemType directory -Path ${LocalLib} -Force | Out-Null
if (Test-Path ${LocalLib})
{
Copy-Item -Path ${LocalLib}-${pid}\${LocalLib}\*.[ch] -Destination ${LocalLib}\
Get-Content -Path ${LocalLib}-${pid}\${LocalLib}\${LocalLib}_definitions.h.in | % { $_ -Replace "@VERSION@",${LocalLibVersion} } > ${LocalLib}\${LocalLib}_definitions.h
}
Remove-Item -Path ${LocalLib}-${pid} -Force -Recurse
}
}