Hyang-Ah Hana Kim | c636713 | 2015-02-25 16:08:54 -0500 | [diff] [blame] | 1 | # Use [winstrap](https://github.com/golang/winstrap) |
Andrew Gerrand | 5bc444d | 2014-12-10 11:35:11 +1100 | [diff] [blame] | 2 | |
Hyang-Ah Hana Kim | 0fd917f | 2015-02-25 17:09:43 -0500 | [diff] [blame] | 3 | Download the latest version of winstrap.exe from the [winstrap](https://github.com/golang/winstrap) page and run it. |
Andrew Gerrand | 5bc444d | 2014-12-10 11:35:11 +1100 | [diff] [blame] | 4 | |
| 5 | It will download some installers to your desktop, which you should run. Just click through; all the defaults are fine. |
| 6 | |
| 7 | Then it will check out Go and place it in c:\Users\%USER%\goroot and build it. |
| 8 | |
| 9 | That's it. |
| 10 | |
| 11 | |
| 12 | --- |
| 13 | |
| 14 | Older (deprecated?) instructions follow. |
| 15 | |
| 16 | |
| 17 | --- |
| 18 | |
| 19 | |
| 20 | # Install MinGW/MSYS |
| 21 | |
| 22 | Download and save the latest version of the automated MinGW installer executable (` exe `) file from SourceForge. |
| 23 | |
| 24 | http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst/ |
| 25 | |
| 26 | Open 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 `. |
| 27 | |
| 28 | The 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. |
| 29 | |
| 30 | For Repository Catalogues, check the Download latest repository catalogues button. |
| 31 | |
| 32 | For 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. |
| 33 | |
| 34 | For Ready to Install, review and verify the installation settings, which should look similar this: |
| 35 | ``` |
| 36 | Installing: |
| 37 | mingw-get |
| 38 | pkginfo |
| 39 | C Compiler |
| 40 | MSYS Basic System |
| 41 | MinGW Developer Toolkit |
| 42 | Downloading latest repository catalogues |
| 43 | Destination location: |
| 44 | C:\MinGW |
| 45 | ``` |
| 46 | When the installation settings are correct, Install. |
| 47 | |
| 48 | The installation loads the package installation catalogues and downloads and installs the files. The installation may take some time, largely depending on the download speed. |
| 49 | |
| 50 | The MSYS terminal window may be opened by opening and running the ` C:\MinGW\msys\1.0\msys.bat ` batch file. |
| 51 | |
| 52 | # Build |
| 53 | |
| 54 | ``` |
| 55 | hg clone https://code.google.com/p/go/ |
| 56 | cd go\src |
| 57 | all.bat |
| 58 | ``` |
| 59 | |
| 60 | # 64-bit Notes |
| 61 | |
| 62 | 1. Ensure you are able to compile a working 32-bit Go first. |
| 63 | 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. |
| 64 | 1. Replace ` gcc.exe ` and ` ar.exe ` with their 64-bit counterparts. |
| 65 | 1. Set ` GOARCH=amd64 ` and away you go! |
| 66 | |
| 67 | # Alternative Strategy |
| 68 | |
| 69 | Install http://tdm-gcc.tdragon.net/ |
| 70 | |
| 71 | Install Python 2.x. |
| 72 | |
| 73 | Install Mercurial for Python 2.x. |
| 74 | |
| 75 | Make a "godev.bat" file on your desktop with: |
| 76 | |
| 77 | ``` |
| 78 | set GOROOT=c:\go |
| 79 | set GOPATH=c:\you\gopath |
| 80 | set PATH=%PATH%;%GOROOT%\bin;C:\Python27;C:\Python27\Scripts |
| 81 | cd %GOROOT%\src |
| 82 | CMD |
| 83 | ``` |
| 84 | |
| 85 | Then double-click and type "all.bat". The codereview extension should work too (test with "hg pq") |