Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: improve windows.md #2337

Merged
merged 2 commits into from
Feb 15, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 135 additions & 6 deletions docs/windows.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,142 @@
# Building on Windows

## Build
## Install Git For Windows

Fuse is not supported for Windows, so you need to build IPFS without Fuse:
As Git is used by the Go language to download dependencies, you need
to install Git, for example from http://git-scm.com/.

You also must make sure that the directory that contains the Git For
Windows binary is in the Path environment variable. Note that Git For
Windows has a 'git' binary in a 'Git\bin' directory and another one in
a 'Git\cmd' directory. You should only put the 'Git\cmd' directory in
the Path environment variable.

## Install Go

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.

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 fix Git authentication

Use the following command to download go-ipfs source code:

```
go get -u github.com/ipfs/go-ipfs
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we put this in the makefile or something? it's annoying to ask people to have to install something.

(or is it that Make has problems on windows?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that installing "make" on Windows is usually done by installing Cygwin which takes a lot of time. We should perhaps check if there is a way to install make without Cygwin but it might be for another PR.


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
cd %GOPATH%/src/github.com/ipfs/go-ipfs
gx --verbose install --global
```

## Manual Way: build go-ipfs

To actually build go-ipfs, first go to the cmd/ipfs directory:

```sh
go build -tags nofuse ./cmd/ipfs
```
cd cmd\ipfs
```

Then get the current Git commit:

```
git rev-parse --short HEAD
```

It will output a small number of hex characters that you must pass to
the actual build command (replace XXXXXXX with these characters):

```
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
```

## TODO
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.

Add more instructions on setting up the golang environment on Windows
## 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
```