aboutsummaryrefslogtreecommitdiff
path: root/w32/VS2013/gen_dll_res.ps1
diff options
context:
space:
mode:
Diffstat (limited to 'w32/VS2013/gen_dll_res.ps1')
-rw-r--r--w32/VS2013/gen_dll_res.ps138
1 files changed, 38 insertions, 0 deletions
diff --git a/w32/VS2013/gen_dll_res.ps1 b/w32/VS2013/gen_dll_res.ps1
new file mode 100644
index 00000000..e51d1034
--- /dev/null
+++ b/w32/VS2013/gen_dll_res.ps1
@@ -0,0 +1,38 @@
1param ([string]$BasePath = ".\")
2
3$Host.SetShouldExit(111) # Set non-zero return code until task successfully finished
4$ErrorActionPreference = "Stop" # Stop on any error
5
6Remove-Variable MHD_ver,MHD_ver_major,MHD_ver_minor,MHD_ver_patchlev -ErrorAction:SilentlyContinue
7
8Write-Output "Processing: ${BasePath}..\..\configure.ac"
9foreach($line in Get-Content "${BasePath}..\..\configure.ac")
10{
11 if ($line -match '^AC_INIT\(\[libmicrohttpd\],\[((\d+).(\d+).(\d+))\]')
12 {
13 [string]$MHD_ver = $Matches[1].ToString()
14 [string]$MHD_ver_major = $Matches[2].ToString()
15 [string]$MHD_ver_minor = $Matches[3].ToString()
16 [string]$MHD_ver_patchlev = $Matches[4].ToString()
17 break
18 }
19}
20if ("$MHD_ver" -eq "" -or "$MHD_ver_major" -eq "" -or "$MHD_ver_minor" -eq "" -or "$MHD_ver_patchlev" -eq "")
21{
22 Throw "Can't find MHD version in ${BasePath}..\..\configure.ac"
23}
24
25Write-Output "Detected MHD version: $MHD_ver"
26
27Write-Output "Generating ${BasePath}microhttpd_dll_res_vc.rc"
28Get-Content "${BasePath}microhttpd_dll_res_vc.rc.in" | ForEach-Object {
29 $_ -replace '@PACKAGE_VERSION_MAJOR@',"$MHD_ver_major" `
30 -replace '@PACKAGE_VERSION_MINOR@', "$MHD_ver_minor" `
31 -replace '@PACKAGE_VERSION_SUBMINOR@', "$MHD_ver_patchlev" `
32 -replace '@PACKAGE_VERSION@', "$MHD_ver"
33} | Out-File -FilePath "${BasePath}microhttpd_dll_res_vc.rc" -Force
34
35$Host.SetShouldExit(0) # Reset return code
36
37Write-Output "${BasePath}microhttpd_dll_res_vc.rc was generated "
38exit 0 # Exit with success code