Skip to content

Commit

Permalink
Use cygwin-bootstrap in buildenv/1.3.x/win32-static.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrautz committed Jan 8, 2017
1 parent b263366 commit d6012d9
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 15 deletions.
15 changes: 15 additions & 0 deletions buildenv/1.3.x/win32-static/setup.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,21 @@ set GIT_TARGET=%MUMBLE_PREFIX%\mumble-releng
if exist %GIT_TARGET% ( rd /s /q %GIT_TARGET% )
git clone --recursive "%MUMBLE_RELENG%" "%GIT_TARGET%" >NUL 2>NUL

:: Setup Cygwin for the build environment.
::
:: If you want to use your own Cygwin, feel
:: free to comment these lines out.
powershell -ExecutionPolicy bypass -File setup\earlyfetch.ps1 "%MUMBLE_PREFIX_BUILD%\cygwin-bootstrap.exe" "https://github.com/mumble-voip/cygwin-bootstrap/releases/download/v0.1/cygwin-bootstrap.exe" "e14dd1db65dbb7f0948abd7b2b607e36803329f05578aeaa9e62fcd29a658d84"
if not "%errorlevel%"=="0" (
echo "Unable to download cygwin-bootstrap"
exit /b
)
"%MUMBLE_PREFIX_BUILD%\cygwin-bootstrap.exe" -target "%MUMBLE_PREFIX%\cygwin"
if not "%errorlevel%"=="0" (
echo "Unable bootstrap cygwin"
exit /b
)

if not "%1"=="/noninteractive" (
echo.
echo Build environment successfully created.
Expand Down
37 changes: 22 additions & 15 deletions buildenv/1.3.x/win32-static/setup/cygwin.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,30 @@

@echo off

:: First, try to query the registry for a potential Cygwin
:: installation directory.
for /f "tokens=2* delims= " %%a in ('reg query "HKCU\Software\Cygwin\Installations" 2^>nul') do set MUMBLE_CYGWIN_ROOT=%%b

:: HKCU\Software\Cygwin\Installations has a weird prefix on the install dir,
:: so strip it if it's there.
if "%MUMBLE_CYGWIN_ROOT:~0,4%" == "\??\" (
set MUMBLE_CYGWIN_ROOT=%MUMBLE_CYGWIN_ROOT:~4%
:: First, check if we have a locally bootstrapped Cygwin
:: in %MUMBLE_PREFIX%.
set MUMBLE_CYGWIN_ROOT=%MUMBLE_PREFIX%\cygwin
if not exist %MUMBLE_CYGWIN_ROOT% (
set MUMBLE_CYGWIN_ROOT=
)

:: The registry query worked. Check if the directory actually
:: exists. If it doesn't, unset MUMBLE_CYGWIN_ROOT such that
:: the next check (the check below us) will fall back to
:: using standard Cygwin directories.
if defined MUMBLE_CYGWIN_ROOT (
if not exist "%MUMBLE_CYGWIN_ROOT%" (
set MUMBLE_CYGWIN_ROOT=
:: Try to query the registry for a potential Cygwin
:: installation directory.
if not defined MUMBLE_CYGWIN_ROOT (
for /f "tokens=2* delims= " %%a in ('reg query "HKCU\Software\Cygwin\Installations"') do set MUMBLE_CYGWIN_ROOT=%%b
:: Clear the output of reg.exe.
:: It write an error to stderr if it fails, and we seemingly
:: cannot redirect it within a "for in" block.
cls

:: The registry query worked. Check if the directory actually
:: exists. If it doesn't, unset MUMBLE_CYGWIN_ROOT such that
:: the next check (the check below us) will fall back to
:: using standard Cygwin directories.
if defined MUMBLE_CYGWIN_ROOT (
if not exist %MUMBLE_CYGWIN_ROOT% (
set MUMBLE_CYGWIN_ROOT=
)
)
)

Expand Down
19 changes: 19 additions & 0 deletions buildenv/1.3.x/win32-static/setup/earlyfetch.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env mumble-build
# Copyright 2013-2017 The 'mumble-releng' Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file in the source tree or at
# <http://mumble.info/mumble-releng/LICENSE>.

$target = $Args[0]
$url = $Args[1]
$sha256hash = $Args[2]

$client = New-Object System.Net.WebClient
$client.DownloadFile($url, $target)
$hash = Get-FileHash $target -Algorithm SHA256
if (($hash.Hash) -ne ($sha256hash)) {
Remove-Item $target
exit 1
}

exit 0

0 comments on commit d6012d9

Please sign in to comment.