blob: aed5eb14b64d60fbbf46e4bd506c954d33920e60 [file] [log] [blame] [view]
Brad Fitzpatrick8a9a5ee2016-08-30 14:07:51 -07001# The Automatic (but unsupported) Way: [winstrap](https://github.com/golang/winstrap)
Andrew Gerrand5bc444d2014-12-10 11:35:11 +11002
Brad Fitzpatrick1d7b0712016-01-26 15:47:08 -08003The winstrap tool is used by the Go project to turn a fresh Windows VM image into a Windows builder. It installs all necessary dependencies. It's sometimes out of date, though, as it's only updated when we need to update the Windows base image for the [Go continuous build](https://build.golang.org/).
4
Tom7cfb7e72016-07-06 21:07:06 -03005To use winstrap, download the latest version of winstrap.exe from the [winstrap](https://github.com/golang/winstrap) page and run it.
Andrew Gerrand5bc444d2014-12-10 11:35:11 +11006
7It will download some installers to your desktop, which you should run. Just click through; all the defaults are fine.
8
Gautham B A9d927c92018-07-05 10:18:05 +05309Then it will check out Go and place it in c:\Users\\%USER%\goroot and build it.
Andrew Gerrand5bc444d2014-12-10 11:35:11 +110010
11That's it.
12
Brad Fitzpatrick8a9a5ee2016-08-30 14:07:51 -070013Note however that winstrap is not supported. It's considered an internal tool used for occasional setup of new Windows builder images and is not actively maintained until we need it ourselves.
Andrew Gerrand5bc444d2014-12-10 11:35:11 +110014
Brad Fitzpatrick1d7b0712016-01-26 15:47:08 -080015# The Manual Way
Andrew Gerrand5bc444d2014-12-10 11:35:11 +110016
Brad Fitzpatrick1d7b0712016-01-26 15:47:08 -080017## Install MinGW/MSYS
Andrew Gerrand5bc444d2014-12-10 11:35:11 +110018
19Download and save the latest version of the automated MinGW installer executable (` exe `) file from SourceForge.
20
Sean Dukehart83000792019-03-25 11:15:12 -040021http://sourceforge.net/projects/mingw/files/OldFiles/mingw-get-inst/
Andrew Gerrand5bc444d2014-12-10 11:35:11 +110022
23Open and run the saved automated MinGW installer executable file, which is named ` mingw-get-inst-yyyymmdd.exe `, where ` yyyymmdd ` is the version date stamp. For example, ` mingw-get-inst-20110530.exe `.
24
25The MinGW Setup Wizard window will open with the title "Setup - MinGW-Get". Except for the following, accept the setup defaults, unless it's necessary to change them.
26
27For Repository Catalogues, check the Download latest repository catalogues button.
28
29For Select Components, the MinGW Compiler Suite, the C Compiler box is automatically checked. Scroll down to the bottom of the list and check the MinGW Developer Toolkit box, which includes the MSYS Basic System.
30
31For Ready to Install, review and verify the installation settings, which should look similar this:
32```
33 Installing:
34 mingw-get
35 pkginfo
36 C Compiler
37 MSYS Basic System
38 MinGW Developer Toolkit
39 Downloading latest repository catalogues
40 Destination location:
41 C:\MinGW
42```
43When the installation settings are correct, Install.
44
45The installation loads the package installation catalogues and downloads and installs the files. The installation may take some time, largely depending on the download speed.
46
47The MSYS terminal window may be opened by opening and running the ` C:\MinGW\msys\1.0\msys.bat ` batch file.
48
Brad Fitzpatrick1d7b0712016-01-26 15:47:08 -080049## Build
Andrew Gerrand5bc444d2014-12-10 11:35:11 +110050
51```
Brad Fitzpatrick1d7b0712016-01-26 15:47:08 -080052git clone https://go.googlesource.com/go
Andrew Gerrand5bc444d2014-12-10 11:35:11 +110053cd go\src
54all.bat
55```
56
Brad Fitzpatrick1d7b0712016-01-26 15:47:08 -080057## 64-bit Notes
Andrew Gerrand5bc444d2014-12-10 11:35:11 +110058
59 1. Ensure you are able to compile a working 32-bit Go first.
60 1. Grab the latest zip from http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Automated%20Builds/ and extract it over the MinGW directory, so that for example the .exe files end up in the same location as the 32-bit ones.
61 1. Replace ` gcc.exe ` and ` ar.exe ` with their 64-bit counterparts.
62 1. Set ` GOARCH=amd64 ` and away you go!
63