Skip to content

Commit fb9fdbd

Browse files
committedMar 6, 2018
Mention Makefile.dist in README
1 parent d31e915 commit fb9fdbd

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed
 

‎CROSS-COMPILE.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ For example, to build a static 64-bit Windows binary:
1919
-ldflags '-w -extldflags "-static" -extld x86_64-w64-mingw32-gcc' \
2020
github.com/square/ghostunnel
2121

22-
For more info, see [xgo][xgo]'s README on GitHub.
22+
Ghostunnel ships with a `Makefile.dist` that will cross-compile for
23+
darwin/amd64, linux/amd64, windows/386 and windows/amd64 when asked to build
24+
the `dist` target. Note that [xgo][xgo] (and Docker) must already be installed
25+
to run this. For more info, see also [xgo][xgo]'s README on GitHub.
2326

2427
[xgo]: https://github.com/karalabe/xgo

‎Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
SOURCE_FILES := $(shell find . \( -name '*.go' -not -path './vendor*' \))
22
INTEGRATION_TESTS := $(shell find tests -name 'test-*.py' -exec basename {} .py \;)
3+
VERSION := $(shell git describe --always --dirty)
4+
5+
# Ghostunnel binary
6+
ghostunnel: $(SOURCE_FILES)
7+
go build -ldflags '-X main.version=${VERSION}' -o ghostunnel .
38

49
# Test binary with coverage instrumentation
510
ghostunnel.test: $(SOURCE_FILES)

‎README.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,21 @@ on how to generate new ones with OpenSSL).
6565

6666
Ghostunnel is available through [GitHub releases][rel] and through [Docker Hub][hub].
6767

68-
Note that ghostunnel requires Go 1.9 or later to build, and CGO is required for PKCS#11 support.
68+
Binaries can be built from source as follows (cross-compile requires Docker and [xgo][xgo]):
69+
70+
# Compile for local architecture
71+
make ghostunnel
72+
73+
# Cross-compile release binaries
74+
make -f Makefile.dist dist
75+
76+
Note that ghostunnel requires Go 1.9 or later to build, and CGO is required for
77+
PKCS#11 support. See also [CROSS-COMPILE.md](CROSS-COMPILE.md) for
78+
instructions on how to cross-compile a custom build with CGO enabled.
6979

7080
[rel]: https://github.com/square/ghostunnel/releases
7181
[hub]: https://hub.docker.com/r/squareup/ghostunnel
82+
[xgo]: https://github.com/karalabe/xgo
7283

7384
### Develop
7485

0 commit comments

Comments
 (0)
Please sign in to comment.