From 92eca70cc9b0a8223ccf9273ae3c1d17d73635ac Mon Sep 17 00:00:00 2001 From: Justin Venus Date: Mon, 3 Apr 2017 12:56:02 -0500 Subject: [PATCH] [issue-15] reasonably support older linux distributions --- .gitignore | 1 + Makefile | 41 +++++++++++++++++++++++++++++++++++++++++ README.md | 12 ++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index eb5a316..ec87deb 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ target +/rust-*.tar.gz diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e315996 --- /dev/null +++ b/Makefile @@ -0,0 +1,41 @@ +RUST_VERSION = 1.16.0 +DOCKER_IMAGE = alexcrichton/rust-slave-dist:2015-10-20b +RUST_TARBALL = rust-$(RUST_VERSION)-x86_64-unknown-linux-gnu.tar.gz +RUST_SOURCE = https://static.rust-lang.org/dist/$(RUST_TARBALL) + +ifeq ($(shell uname -s),Darwin) +all: linux darwin + +darwin: target/x86_64-apple-darwin/release/linkerd-tcp + +target/x86_64-apple-darwin/release/linkerd-tcp: + cargo build --release --verbose --target=x86_64-apple-darwin + +else +all: linux +endif + +linux: $(RUST_TARBALL) target/x86_64-unknown-linux-gnu/release/linkerd-tcp + +$(RUST_TARBALL): + curl -L -o $(RUST_TARBALL) $(RUST_SOURCE) + +target/x86_64-unknown-linux-gnu/release/linkerd-tcp: $(RUST_TARBALL) + docker pull $(DOCKER_IMAGE) + @docker run \ + --rm -v $(shell pwd):/rust/app \ + -u root \ + -w /rust/app \ + --entrypoint=/bin/bash \ + $(DOCKER_IMAGE) \ + -exc "cd /tmp && \ + (gzip -dc /rust/app/$(RUST_TARBALL) | tar xf -) && \ + ./rust-$(RUST_VERSION)-x86_64-unknown-linux-gnu/install.sh --without=rust-docs && \ + cd /rust/app && \ + cargo build --release --verbose --target=x86_64-unknown-linux-gnu" + +clean: + -rm -rf target + +distclean: clean + -rm -f $(RUST_TARBALL) diff --git a/README.md b/README.md index 330e050..52a13cf 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,18 @@ Try running the image with: docker run -v `pwd`/example.yml:/example.yml linkerd/linkerd-tcp:latest /example.yml ``` +To build linkerd/linkerd-tcp stand-alone binaries for Linux (requires docker), run: + +```bash +make linux +``` + +To build linkerd/linkerd-tcp stand-alone binaries for macOS (requires macOS host), run: + +```bash +make darwin +``` + ## Code of Conduct ## This project is for everyone. We ask that our users and contributors take a few minutes to