From 02bc5c02c2f8d08d61f9ece834308ddd953e181f Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Sun, 14 Feb 2016 11:17:20 +0100 Subject: [PATCH] doc: complete windows.md This adds more explanations and explain how to properly build with and without Cygwin. License: MIT Signed-off-by: Christian Couder --- docs/windows.md | 120 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 102 insertions(+), 18 deletions(-) diff --git a/docs/windows.md b/docs/windows.md index 0efca45aa..588fe2694 100644 --- a/docs/windows.md +++ b/docs/windows.md @@ -16,6 +16,13 @@ the Path environment variable. Please install the Go language as explained on https://golang.org/doc/install. +To properly install Go, you will need to set some environment +variables. We recommend you to set them globally using the Control +Panel, as explained in the documentation above, so that these +environment variables are automatically available in all the possible +environments that you might want to use like Git Bash, Windows's cmd, +Cygwin's terminal, Windows' PowerShell and so on. + You must make sure that the GOROOT environment variable is set and that the %GOROOT%/bin directory is in the Path environment variable. @@ -23,36 +30,113 @@ The GOPATH environment variable should also be set to a directory that you have created, and the %GOPATH/bin directory should also be in the Path environment variable. -## Download go-ipfs and its dependencies +## Download go-ipfs and fix Git authentication -The following commands should download or update go-ipfs and its -dependencies: +Use the following command to download go-ipfs source code: -```sh +``` +go get -u github.com/ipfs/go-ipfs +``` + +The above command uses Git to download go-ipfs from its GitHub +repository. If you get authentication problems with Git, you might +want to take a look at +https://help.github.com/articles/caching-your-github-password-in-git/ +and use the suggested solution: + +``` +git config --global credential.helper wincred +``` + +## Choose the way you want to proceed + +Now there are two ways to download, install the dependencies and to +build go-ipfs: + +1) There is the "Manual Way", where you don't need to install anymore +software except the dependencies, but you have a number of commands to +type. + +2) There is a way by installing 'make' through Cygwin and using it to +do nearly everything. We call this way the "Cygwin Way". It may take +much more time, because installing Cygwin can take a lot of time, but +after that it might be easier as many procedures are just a 'make' +command away. + +So use the next steps below that start with "Manual Way" if that's the +way you want, otherwise scroll down a bit and use the "Cygwin Way" +steps below. + +## Manual Way: download and install dependencies + +The following commands should download or update go-ipfs dependencies +and then install them: + +``` go get -u github.com/whyrusleeping/gx go get -u github.com/whyrusleeping/gx-go -go get -u github.com/ipfs/go-ipfs cd %GOPATH%/src/github.com/ipfs/go-ipfs gx --verbose install --global ``` -If you get authentication problems with Git, you might want to take a -look at -https://help.github.com/articles/caching-your-github-password-in-git/ -and use the suggested solution: +## Manual Way: build go-ipfs -```sh -git config --global credential.helper wincred +To actually build go-ipfs, first go to the cmd/ipfs directory: + +``` +cd cmd\ipfs ``` -## Build +Then get the current Git commit: -Fuse is not supported for Windows, so you need to build IPFS without Fuse: - -```sh -go build -tags nofuse ./cmd/ipfs +``` +git rev-parse --short HEAD ``` -## TODO +It will output a small number of hex characters that you must pass to +the actual build command (replace XXXXXXX with these characters): -Fix the "Build" section to pass the current commit as the Makefile does. +``` +go install -ldflags="-X "github.com/ipfs/go-ipfs/repo/config".CurrentCommit=XXXXXXX" +``` + +After that ipfs should have been built and should be available in +"%GOPATH%\bin". + +You can check that the ipfs you built has the right version using: + +``` +ipfs version --commit +``` + +It should output something like "ipfs version 0.4.0-dev-XXXXXXX" where +XXXXXXX is the current commit that you passed to the build command. + +## Cygwin way: install Cygwin + +Install Cygwin as explained in the Cygwin documentation: + +http://cygwin.com/install.html + +By default Cygwin will not install 'make', so you should click on the +"Devel" category during the Cygwin installation process and then check +the 'make' package. + +## Cygwin way: build go-ipfs + +To build go-ipfs using Cygwin you just need to open a Cygwin Terminal +and then type the following commands: + +``` +cd $GOPATH/src/github.com/ipfs/go-ipfs +make install +``` + +After that ipfs should have been built and should be available in +"%GOPATH%\bin". + +You can check that the ipfs you built has the right version using: + +``` +ipfs version --commit +```