diff options
author | Simon Rozman <simon@rozman.si> | 2019-08-09 08:57:30 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-08-12 09:11:27 +0200 |
commit | 9b620929ea8ccc8ce38a5bc876a94ce23e1fb30f (patch) | |
tree | 6e4c5e64e7315a56f8e67d374eaa7926506cbb8c /installer | |
parent | installer: port custom actions from JScript to C (diff) | |
download | wireguard-windows-9b620929ea8ccc8ce38a5bc876a94ce23e1fb30f.tar.xz wireguard-windows-9b620929ea8ccc8ce38a5bc876a94ce23e1fb30f.zip |
build: use setlocal to keep build environment local
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'installer')
-rw-r--r-- | installer/build.bat | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/installer/build.bat b/installer/build.bat index a0a17c27..295ce437 100644 --- a/installer/build.bat +++ b/installer/build.bat @@ -2,11 +2,10 @@ rem SPDX-License-Identifier: MIT rem Copyright (C) 2019 WireGuard LLC. All Rights Reserved. -set OLDWIX=%WIX% -set OLDPATHEXT=%PATHEXT% +setlocal set PATHEXT=.exe set BUILDDIR=%~dp0 -pushd %BUILDDIR% || exit /b 1 +cd /d %BUILDDIR% || exit /b 1 for /f "tokens=3" %%a in ('findstr /r "WIREGUARD_WINDOWS_VERSION_STRING.*[0-9.]*" ..\version.h') do set WIREGUARD_VERSION=%%a set WIREGUARD_VERSION=%WIREGUARD_VERSION:"=% @@ -39,20 +38,18 @@ if exist .deps\prepared goto :build call :msi x86 i686 x86 || goto :error call :msi amd64 x86_64 x64 || goto :error if exist ..\sign.bat call ..\sign.bat - if "%SigningCertificate%"=="" goto :out - if "%TimestampServer%"=="" goto :out + if "%SigningCertificate%"=="" goto :success + if "%TimestampServer%"=="" goto :success echo [+] Signing signtool sign /sha1 "%SigningCertificate%" /fd sha256 /tr "%TimestampServer%" /td sha256 /d "WireGuard Setup" "dist\wireguard-*-%WIREGUARD_VERSION%.msi" || goto :error -:out - set WIX=%OLDWIX% - set PATHEXT=%OLDPATHEXT% - popd - exit /b %errorlevel% +:success + echo [+] Success. + exit /b 0 :error echo [-] Failed with error #%errorlevel%. - goto :out + exit /b %errorlevel% :download echo [+] Downloading %1 @@ -62,7 +59,6 @@ if exist .deps\prepared goto :build goto :eof :msi - set OLDPATH2=%PATH% set PATH=%BUILDDIR%..\.deps\%~2-w64-mingw32-native\bin;%PATH% set CC=%~2-w64-mingw32-gcc set CFLAGS=-O3 -Wall -std=gnu11 -DWINVER=0x0601 -municode -DUNICODE -D_UNICODE -DNDEBUG @@ -75,5 +71,4 @@ if exist .deps\prepared goto :build "%WIX%bin\candle" %WIX_CANDLE_FLAGS% -dWIREGUARD_PLATFORM="%~1" -out "%~1\wireguard.wixobj" -arch %3 wireguard.wxs || exit /b %errorlevel% echo [+] Linking %1 "%WIX%bin\light" %WIX_LIGHT_FLAGS% -out "dist\wireguard-%~1-%WIREGUARD_VERSION%.msi" "%~1\wireguard.wixobj" || exit /b %errorlevel% - set PATH=%OLDPATH2% goto :eof |