Skip to content

Commit 2594459

Browse files
committed
docs/BUILDING.md: instructions for building from source
Most people won't need the instructions for building from source. So move them from `README.md` to `docs/BUILDING.md`, leaving only a link in `README.md`. Also add some more details.
1 parent eae2795 commit 2594459

File tree

2 files changed

+60
-30
lines changed

2 files changed

+60
-30
lines changed

README.md

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -79,36 +79,7 @@ Is your Git repository bursting at the seams?
7979

8080
* Move the executable file (`git-sizer` or `git-sizer.exe`) into your `PATH`.
8181

82-
b. Install `git-sizer` using `go get`:
83-
84-
* Make sure that you have a recent version of the [Go language toolchain](https://golang.org/doc/install) installed and that you have set `GOPATH`.
85-
86-
* Get `git-sizer` using `go get`:
87-
88-
go get github.com/github/git-sizer
89-
90-
This should fetch and compile the source code and write the executable file to `$GOPATH/bin/`.
91-
92-
* Either add `$GOPATH/bin` to your `PATH`, or copy the executable file (`git-sizer` or `git-sizer.exe`) to a directory that is already in your `PATH`.
93-
94-
c. Build using `make` (for experts; works on Linux or OS X):
95-
96-
* Clone the `git-sizer` Git repository and switch to that directory:
97-
98-
git clone https://github.com/github/git-sizer.git
99-
cd git-sizer
100-
101-
* Install Go if necessary and create and prepare a project-local `GOPATH`:
102-
103-
script/bootstrap
104-
105-
* Build `git-sizer`:
106-
107-
make
108-
109-
* Copy the resulting executable file (`bin/git-sizer`) to a directory in your `PATH`.
110-
111-
Assuming that you have installed the `git-sizer` executable to your `PATH`, you can run the program via Git by typing `git sizer`; otherwise, you need to type the full path and filename to run it; e.g., `/path/to/bin/git-sizer`.
82+
b. Build and install from source. See the instructions in [`docs/BUILDING.md`](docs/BUILDING.md).
11283

11384
3. Change to the directory containing the Git repository that you'd like to analyze, then run
11485

docs/BUILDING.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Building `git-sizer` from source
2+
3+
Most people can just install a released version of `git-sizer`, [as described in the `README.md`](../README.md#getting-started). However, if you want to test a non-release version, or if you might want to contribute to `git-sizer`, you can also build it from source.
4+
5+
6+
## Build and install using `go get`
7+
8+
1. Make sure that you have a recent version of the [Go language toolchain](https://golang.org/doc/install) installed and that you have set `GOPATH`.
9+
10+
2. Get `git-sizer` using `go get`:
11+
12+
go get github.com/github/git-sizer
13+
14+
This should fetch and compile the source code and write the executable file to `$GOPATH/bin/`.
15+
16+
3. Either add `$GOPATH/bin` to your `PATH`, or copy the executable file (`git-sizer` or `git-sizer.exe`) to a directory that is already in your `PATH`.
17+
18+
19+
## Build using `make`
20+
21+
This procedure is intended for experts and people who want to help develop `git-sizer`. It should work on Linux or OS X. On other Unix-like systems, this procedure is also likely to work, provided you first [install Go manually](https://golang.org/doc/install).
22+
23+
1. Clone the `git-sizer` Git repository and switch to that directory:
24+
25+
git clone https://github.com/github/git-sizer.git
26+
cd git-sizer
27+
28+
2. Install Go if necessary and create and prepare a project-local `GOPATH`:
29+
30+
script/bootstrap
31+
32+
3. (Optional) Run the automated tests:
33+
34+
make test
35+
36+
4. Build `git-sizer`:
37+
38+
make
39+
40+
If you have a C toolchain set up, you can enable support for `isatty()` (which turns off `--progress` by default if output is not to a TTY) by running
41+
42+
make USE_ISATTY=true
43+
44+
5. Copy the resulting executable file (`bin/git-sizer`) to a directory in your `PATH`.
45+
46+
It is also possible to cross-compile for other platforms that are supported by Go. See the comments in the `Makefile` for more information.
47+
48+
Note that this procedure uses a project-local `GOPATH`. This means that you can clone the repository anywhere. The disadvantage is that Go tools need to know about this `GOPATH`. The `Makefile` and the scripts under `scripts/` take care of this automatically. But if you want to run `go` commands by hand, either first set your `GOPATH`:
49+
50+
export GOPATH="$(pwd)/.gopath"
51+
52+
Or use `script/go` and `script/gofmt` rather than `go` and `gofmt`, respectively.
53+
54+
Unfortunately, some Go tools get confused by the symlink that is used to make the project-local `GOPATH` work. If you have this problem, it sometimes helps to run such commands from `.gopath/src/github.com/github/git-sizer/`. Alternatively, clone the project into the traditional place in your normal `GOPATH`.
55+
56+
57+
## Making a release
58+
59+
See [`RELEASING.md`](RELEASING.md).

0 commit comments

Comments
 (0)