From 481c885be9a5ba6fc2c977ce1113c9aad0718bfe Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Mon, 18 Jan 2021 17:20:14 -0800 Subject: [PATCH] Add linux build script --- README.md | 4 ++++ build_linux.sh | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100755 build_linux.sh diff --git a/README.md b/README.md index 7004ae2..c91f2ce 100644 --- a/README.md +++ b/README.md @@ -15,3 +15,7 @@ Executing `make build` will compile to `./build/yk`. Additionally, distribution ### Note on distribution builds Currently cross compiling is not working correctly. + +### Building for linux distros + +This is a work in progress, but it can be done by running `./build_linux.sh [golang|ubuntu]`. diff --git a/build_linux.sh b/build_linux.sh new file mode 100755 index 0000000..00e9826 --- /dev/null +++ b/build_linux.sh @@ -0,0 +1,25 @@ +#! /bin/sh +set -e + +# Use first arg as docker image to build inside of (ubuntu or golang) +if [ $# -gt 0 ]; then + docker run --rm -it --workdir /src -v "$(pwd):/src" "$1" ./build_linux.sh +fi + +set -x + +apt-get update + +# For ubuntu +# apt-get install wget +if ! command -v go; then + apt-get install -y --no-install-recommends make golang git ca-certificates + mkdir /go + export GOPATH=/go + export PATH=$GOPATH/bin:$PATH +fi + +# For ubuntu and golang +apt-get install -y --no-install-recommends libpcsclite-dev # gnome-keyring + +make dist/yk-linux-amd64