Skip to content

Commit

Permalink
Added Vagrant build scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
fancycode committed Jul 20, 2015
1 parent 2017f16 commit 22cbbcf
Show file tree
Hide file tree
Showing 15 changed files with 293 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Expand Up @@ -8,3 +8,8 @@
/ipch
/bin_*
/common/includes/version_rev.h

/.vagrant
/build_result
/Vagrantfile
*.iso
43 changes: 43 additions & 0 deletions Vagrantfile.in
@@ -0,0 +1,43 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|

config.vm.define "build" do |build|
build.vm.box = "opentable/win-8.1-core-amd64-nocm"

build.vm.provision "shell", path: "scripts/vagrant/000_setup_powershell.cmd"
build.vm.provision "shell", path: "scripts/vagrant/001_disable_services.cmd"
build.vm.provision "shell", path: "scripts/vagrant/010_install_visual_studio.cmd"
build.vm.provision "shell", path: "scripts/vagrant/011_install_mingw.cmd"
build.vm.provision "shell", path: "scripts/vagrant/012_install_inno_setup.cmd"
build.vm.provision "shell", path: "scripts/vagrant/020_copy_code.cmd"
build.vm.provision "shell", path: "scripts/vagrant/030_compile.cmd"
build.vm.provision "shell", path: "scripts/vagrant/040_package.cmd"
end

# Spinning up boxes on OSX is slow, wait up to 15 minutes.
config.vm.boot_timeout = 900

# Wait for winrm responses for up to 2 hours.
config.winrm.timeout = 120*60

config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine.
vb.gui = true

# I/O APIC must be enabled to support more than 1 cpu on 32bit systems.
# http://makandracards.com/jan0sch/24843-vagrant-virtualbox-32bit-systems-and-more-than-one-cpu
vb.customize ["modifyvm", :id, "--ioapic", "on"]

# You can get the Visual Studio Community 2013 Update 4 ISO image from
# https://www.visualstudio.com/de-de/downloads/download-visual-studio-vs#DownloadFamilies_2
# http://download.microsoft.com/download/7/1/B/71BA74D8-B9A0-4E6C-9159-A8335D54437E/vs2013.4_ce_enu.iso
vb.customize ["storageattach", :id, "--storagectl", "IDE Controller", "--port", "1", "--device", "0", "--type", "dvddrive", "--medium", "__VISUAL_STUDIO_ISO__"]

# Use multiple cpus to speed up building.
vb.memory = 4096
vb.cpus = 4
end

end
63 changes: 63 additions & 0 deletions bootstrap.sh
@@ -0,0 +1,63 @@
#!/bin/bash
set -eu

command -v vagrant >/dev/null 2>&1 || {
echo >&2 "Please install vagrant from https://www.vagrantup.com/. Aborting.";
exit 1;
}

SHA256SUM=sha256sum
command -v ${SHA256SUM} >/dev/null 2>&1 || {
# OSX doesn't provide a "sha256sum" binary
SHA256SUM="shasum -a 256"
}

realpath() {
OURPWD=$PWD
cd "$(dirname "$1")"
LINK=$(readlink "$(basename "$1")")
while [ "$LINK" ]; do
cd "$(dirname "$LINK")"
LINK=$(readlink "$(basename "$1")")
done
REALPATH="$PWD/$(basename "$1")"
cd "$OURPWD"
echo "$REALPATH"
}

ROOT=$(dirname "${BASH_SOURCE[0]}")
if [ "${ROOT}" = "." ]; then
ROOT=
fi
ROOT=$(realpath "${ROOT}")

VISUAL_STUDIO_ISO="${ROOT}/vs2013.4_ce_enu.iso"
VISUAL_STUDIO_URL=http://download.microsoft.com/download/7/1/B/71BA74D8-B9A0-4E6C-9159-A8335D54437E/vs2013.4_ce_enu.iso

if [ ! -f "${VISUAL_STUDIO_ISO}" ]; then
echo "Downloading Visual Studio Community 2013 Update 4 ISO, this may take a while..."
curl -L -o "${VISUAL_STUDIO_ISO}" "${VISUAL_STUDIO_URL}"
else
echo "Checking available Visual Studio Community 2013 Update 4 ISO..."
if ! ${SHA256SUM} -c --status vs2013.4_ce_enu.iso.sha256; then
echo "Continuing download of Visual Studio Community 2013 Update 4 ISO, this may take a while..."
curl -C - -L -o "${VISUAL_STUDIO_ISO}" "${VISUAL_STUDIO_URL}"
fi
fi

echo "Checking for vagrant-windows plugin..."
if ! vagrant plugin list | grep --quiet vagrant-windows; then
vagrant plugin install vagrant-windows
fi

echo "Checking for the required Vagrant box..."
if ! vagrant box list | grep --quiet "opentable/win-8.1-core-amd64-nocm.*virtualbox"; then
vagrant box add --provider virtualbox --insecure opentable/win-8.1-core-amd64-nocm
fi

if [ ! -f "${ROOT}/Vagrantfile" ]; then
echo "Preparing Vagrantfile..."
sed "s|__VISUAL_STUDIO_ISO__|${VISUAL_STUDIO_ISO}|g" "${ROOT}/Vagrantfile.in" > "${ROOT}/Vagrantfile"
fi

echo "Ready"
16 changes: 16 additions & 0 deletions scripts/vagrant/000_setup_powershell.cmd
@@ -0,0 +1,16 @@
@echo off

echo Syncing time
tzutil /s "utc"
w32tm /config /syncfromflags:manual /manualpeerlist:0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org,3.pool.ntp.org

echo Increasing limits for remote shells
rem winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="0"}'
rem Increase limits for remote shells
PowerShell Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 8192
PowerShell Set-Item WSMan:\localhost\Plugin\Microsoft.PowerShell\Quotas\MaxMemoryPerShellMB 8192
PowerShell Set-Item WSMan:\localhost\Shell\MaxProcessesPerShell 512
PowerShell Set-Item WSMan:\localhost\Plugin\Microsoft.PowerShell\Quotas\MaxProcessesPerShell 512
PowerShell Set-Item WSMan:\localhost\Shell\MaxShellsPerUser 128
PowerShell Set-Item WSMan:\localhost\Plugin\Microsoft.PowerShell\Quotas\MaxShellsPerUser 128
rem PowerShell Restart-Service winrm
5 changes: 5 additions & 0 deletions scripts/vagrant/001_disable_services.cmd
@@ -0,0 +1,5 @@
@echo off

rem Disable search indexer
sc config wsearch start= disabled
net stop wsearch || set errorlevel = 0
12 changes: 12 additions & 0 deletions scripts/vagrant/010_install_visual_studio.cmd
@@ -0,0 +1,12 @@
@echo off
rem Install requirements in Vagrant box

rem Check Vagrantfile for information on how to obtain
rem Visual Studio Community 2013 Update 4
if not exist "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\cl.exe" (
echo Installing Visual Studio Community 2013 Update 4...
mkdir C:\Users\vagrant\logs\
PowerShell Start-Process -Wait -FilePath E:\vs_community.exe -ArgumentList /silent,/norestart,/Log,C:\Users\vagrant\logs\vs_setup.log,/adminfile,C:\vagrant\scripts\vagrant\AdminDeployment.xml
) else (
echo Visual Studio Community 2013 Update 4 already installed
)
14 changes: 14 additions & 0 deletions scripts/vagrant/011_install_mingw.cmd
@@ -0,0 +1,14 @@
@echo off

if not exist "C:\MSYS" (
echo Fetching MSYS/MinGW...
setlocal
set MSYS_FILENAME=MSYS_MinGW-w64_GCC_493_x86-x64.7z
PowerShell Invoke-WebRequest -Uri http://xhmikosr.1f0.de/tools/msys/%MSYS_FILENAME% -OutFile "C:\Users\vagrant\%MSYS_FILENAME%"
C:\vagrant\scripts\vagrant\7za.exe x -y -oC:\ "C:\Users\vagrant\%MSYS_FILENAME%" > NUL
endlocal
SETX PATH "%PATH%;C:\MSYS\bin;C:\MSYS\mingw\bin" > NUL
SET "PATH=%PATH%;C:\MSYS\bin;C:\MSYS\mingw\bin" > NUL
) else (
echo MSYS/MinGW already installed
)
13 changes: 13 additions & 0 deletions scripts/vagrant/012_install_inno_setup.cmd
@@ -0,0 +1,13 @@
@echo off
setlocal

set IS_FILENAME=isetup-5.5.6-unicode.exe

if not exist "C:\Program Files (x86)\Inno Setup 5\ISCC.exe" (
echo Fetching Inno Setup...
PowerShell Invoke-WebRequest -Uri http://files.jrsoftware.org/is/5/%IS_FILENAME% -OutFile "C:\Users\vagrant\%IS_FILENAME%"
echo Installing Inno Setup...
"C:\Users\vagrant\%IS_FILENAME%" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART
) else (
echo Inno Setup already installed
)
11 changes: 11 additions & 0 deletions scripts/vagrant/020_copy_code.cmd
@@ -0,0 +1,11 @@
@echo off
setlocal

if exist LAVFilters (
rmdir /q /s LAVFilters
IF %ERRORLEVEL% NEQ 0 EXIT /B 1
)

echo Copy contents of git repository...
robocopy c:\vagrant\ LAVFilters /e /xf *.iso libde265-*.exe *.mkv /np /nfl /ndl /njh /ns /nc /mt
IF %ERRORLEVEL% GEQ 8 EXIT /B 1
21 changes: 21 additions & 0 deletions scripts/vagrant/030_compile.cmd
@@ -0,0 +1,21 @@
@echo off
setlocal

cd LAVFilters
if exist "bin_Win32" (
rmdir /s /q bin_Win32
)
if exist "bin_Win32d" (
rmdir /s /q bin_Win32d
)
if exist "bin_x64" (
rmdir /s /q bin_x64
)
if exist "bin_x64d" (
rmdir /s /q bin_x64d
)

echo Compiling LAVFilters...
rem Don't wait for keyboard input after compilation
sed -i 's/^PAUSE$//g' build.bat
call build.bat
18 changes: 18 additions & 0 deletions scripts/vagrant/040_package.cmd
@@ -0,0 +1,18 @@
@echo off
setlocal

cd LAVFilters
if exist libde265-*.exe (
del /q libde265-*.exe > NUL
)

"C:\Program Files (x86)\Inno Setup 5\ISCC.exe" LAVFilters.iss

set TODAY=
for /f "skip=1" %%d in ('wmic os get localdatetime') do if not defined TODAY set TODAY=%%d
if not exist "C:\vagrant\build_result\%TODAY:~0,8%-%TODAY:~8,6%" (
mkdir C:\vagrant\build_result\%TODAY:~0,8%-%TODAY:~8,6%
)
copy /y libde265-*.exe C:\vagrant\build_result\%TODAY:~0,8%-%TODAY:~8,6% >NUL

echo Done, installer copied to "build_result\%TODAY:~0,8%-%TODAY:~8,6%"
Binary file added scripts/vagrant/7za.exe
Binary file not shown.
29 changes: 29 additions & 0 deletions scripts/vagrant/7za_license.txt
@@ -0,0 +1,29 @@
7-Zip Command line version
~~~~~~~~~~~~~~~~~~~~~~~~~~
License for use and distribution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

7-Zip Copyright (C) 1999-2010 Igor Pavlov.

7za.exe is distributed under the GNU LGPL license

Notes:
You can use 7-Zip on any computer, including a computer in a commercial
organization. You don't need to register or pay for 7-Zip.


GNU LGPL information
--------------------

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You can receive a copy of the GNU Lesser General Public License from
http://www.gnu.org/
42 changes: 42 additions & 0 deletions scripts/vagrant/AdminDeployment.xml
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<AdminDeploymentCustomizations xmlns="http://schemas.microsoft.com/wix/2011/AdminDeployment">
<BundleCustomizations TargetDir="default" NoWeb="yes"/>

<SelectableItemCustomizations>
<SelectableItemCustomization Id="Blend" Hidden="no" Selected="no" />
<SelectableItemCustomization Id="VC_MFC_Libraries" Hidden="no" Selected="yes" />
<SelectableItemCustomization Id="SQL" Hidden="no" Selected="no" />
<SelectableItemCustomization Id="WebTools" Hidden="no" Selected="no" />
<SelectableItemCustomization Id="SilverLight_Developer_Kit" Hidden="no" Selected="no" />
<SelectableItemCustomization Id="Win8SDK" Hidden="no" Selected="yes" />
<SelectableItemCustomization Id="WindowsPhone80" Hidden="no" Selected="no" />

<SelectableItemCustomization Id="BlissHidden" Selected="no" />
<SelectableItemCustomization Id="HelpHidden" Selected="no" />
<SelectableItemCustomization Id="LocalDBHidden" Selected="no" />
<SelectableItemCustomization Id="NetFX4Hidden" Selected="no" />
<SelectableItemCustomization Id="NetFX45Hidden" Selected="no" />
<SelectableItemCustomization Id="PortableDTPHidden" Selected="no" />
<SelectableItemCustomization Id="PreEmptiveDotfuscatorHidden" Selected="no" />
<SelectableItemCustomization Id="PreEmptiveAnalyticsHidden" Selected="no" />
<SelectableItemCustomization Id="ProfilerHidden" Selected="no" />
<SelectableItemCustomization Id="ReportingHidden" Selected="no" />
<SelectableItemCustomization Id="SDKTools3Hidden" Selected="no" />
<SelectableItemCustomization Id="SDKTools4Hidden" Selected="no" />
<SelectableItemCustomization Id="Silverlight5DRTHidden" Selected="no" />
<SelectableItemCustomization Id="SQLCEHidden" Selected="no" />
<SelectableItemCustomization Id="SQLCLRTypesHidden" Selected="no" />
<SelectableItemCustomization Id="SQLDACHidden" Selected="no" />
<SelectableItemCustomization Id="SQLDOMHidden" Selected="no" />
<SelectableItemCustomization Id="SQLSharedManagementObjectsHidden" Selected="no" />
<SelectableItemCustomization Id="TSQLHidden" Selected="no" />
<SelectableItemCustomization Id="VCCompilerHidden" Selected="yes" />
<SelectableItemCustomization Id="VCCoreHidden" Selected="yes" />
<SelectableItemCustomization Id="VCDebugHidden" Selected="yes" />
<SelectableItemCustomization Id="VCDesigntimeHidden" Selected="yes" />
<SelectableItemCustomization Id="VCExtendedHidden" Selected="yes" />
<SelectableItemCustomization Id="WinJSHidden" Selected="no" />
<SelectableItemCustomization Id="WinSDKHidden" Selected="yes" />
</SelectableItemCustomizations>

</AdminDeploymentCustomizations>
1 change: 1 addition & 0 deletions vs2013.4_ce_enu.iso.sha256
@@ -0,0 +1 @@
36c0636ae6f96fe80e465f13797aa8048f1a923291e636f62746de7adfd7e520 vs2013.4_ce_enu.iso

0 comments on commit 22cbbcf

Please sign in to comment.