forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
76 lines (69 loc) · 3.24 KB
/
Vagrantfile
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Vagrantfile for building Windows Julia via MSYS2 or Cygwin
$script_cygwin = <<SCRIPT
# change the following to 32 for 32 bit Julia
$bits = "64"
$arch = "x86_$bits".Replace("x86_32", "i686")
$setup = "setup-$arch.exe".Replace("i686", "x86")
$cyginstall = "C:\\cygwin$bits"
mkdir -Force $cyginstall | Out-Null
(new-object net.webclient).DownloadFile(
"http://cygwin.com/$setup", "$cyginstall\\$setup")
foreach ($pkg in @("git,make,curl,patch,python,gcc-g++,m4,cmake,p7zip",
"mingw64-$arch-gcc-g++,mingw64-$arch-gcc-fortran")) {
& "$cyginstall\\$setup" -q -n -R $cyginstall -l $cyginstall\\packages `
-s http://mirrors.mit.edu/cygwin -g -P $pkg | Where-Object `
-FilterScript {$_ -notlike "Installing file *"} | Write-Output
}
& "$cyginstall\\bin\\sh" -lc "if ! [ -e julia$bits ]; then git clone \\
git://github.com/JuliaLang/julia.git julia$bits; fi && cd julia$bits && git pull && \\
echo 'XC_HOST = $arch-w64-mingw32' > Make.user && make cleanall && \\
make -j2 testall && make win-extras binary-dist"
SCRIPT
$script_msys2 = <<SCRIPT
# change the following to 32 for 32 bit Julia
$bits = "64"
$arch = "x86_$bits".Replace("x86_32", "i686")
# change the date in the following for future msys2 releases
$msys2tarball = "msys2-base-$arch-20150916.tar"
$msys2install = "C:\\msys$bits"
# install chocolatey, cmake, and python2
iex ((new-object net.webclient).DownloadString("https://chocolatey.org/install.ps1"))
choco install -y cmake
choco install -y python2
# pacman is picky, reinstall msys2 from scratch
foreach ($dir in @("etc", "usr", "var")) {
if (Test-Path "$msys2install\\$dir") {
rm -Recurse -Force $msys2install\\$dir
}
}
mkdir -Force $msys2install | Out-Null
(new-object net.webclient).DownloadFile(
"https://chocolatey.org/7za.exe",
"$msys2install\\7za.exe")
(new-object net.webclient).DownloadFile(
"http://sourceforge.net/projects/msys2/files/Base/$arch/$msys2tarball.xz",
"$msys2install\\$msys2tarball.xz")
cd C:\\
& "msys$bits\\7za.exe" x -y msys$bits\\$msys2tarball.xz
& "msys$bits\\7za.exe" x -y $msys2tarball | Out-Null
rm $msys2tarball, msys$bits\\$msys2tarball.xz, msys$bits\\7za.exe
& "$msys2install\\usr\\bin\\sh" -lc "pacman --noconfirm --force --needed -Sy \\
bash pacman pacman-mirrors msys2-runtime"
& "$msys2install\\usr\\bin\\sh" -lc "pacman --noconfirm -Syu && \\
pacman --noconfirm -S diffutils git m4 make patch tar p7zip msys/openssh"
& "$msys2install\\usr\\bin\\sh" -lc "if ! [ -e julia$bits ]; then
git clone git://github.com/JuliaLang/julia.git julia$bits; fi && cd julia$bits && git pull && \\
if ! [ -e usr/$arch-w64-mingw32 ]; then contrib/windows/get_toolchain.sh $bits; fi && \\
export PATH=`$PWD/usr/$arch-w64-mingw32/sys-root/mingw/bin:`$PATH:/c/tools/python2 && \\
echo 'override CMAKE=/c/Program\\ Files\\ \\(x86\\)/CMake/bin/cmake' > Make.user && \\
make cleanall && make -j2 testall && make win-extras binary-dist"
SCRIPT
Vagrant.configure("2") do |config|
config.vm.box = "kensykora/windows_2012_r2_standard"
config.vm.provider :virtualbox do |vb|
# Use VBoxManage to customize the VM. For example to change memory:
vb.memory = 2048
end
# change the following to $script_msys2 to build with MSYS2 instead of Cygwin
config.vm.provision :shell, privileged: false, :inline => $script_cygwin
end