From 6b9922fc2c430a0680ea984058717f71bc1ed0b7 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Wed, 23 Nov 2016 20:20:32 -0800 Subject: [PATCH] Build Linux binaries using Vagrant (#132) Adds a Vagrantfile to provision a Debian VM, and recipes to build for linux on the VM. --- .gitignore | 2 +- Vagrantfile | 18 ++++++++++++++++++ justfile | 24 +++++++++++++++--------- tmp/.gitignore | 1 + 4 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 Vagrantfile create mode 100644 tmp/.gitignore diff --git a/.gitignore b/.gitignore index 787aa48..3d3a5e4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ /target -/tmp +/.vagrant diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..5323f6f --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,18 @@ +Vagrant.configure(2) do |config| + config.vm.box = 'debian/jessie64' + + config.vm.provision "shell", inline: <<-EOS + apt-get -y update + apt-get install -y clang git vim + EOS + + config.vm.provision "shell", privileged: false, inline: <<-EOS + curl https://sh.rustup.rs -sSf > install-rustup + chmod +x install-rustup + ./install-rustup -y + source ~/.cargo/env + rustup target add x86_64-unknown-linux-musl + cargo install just + git clone https://github.com/casey/just.git + EOS +end diff --git a/justfile b/justfile index 88bff13..5ef7ff0 100644 --- a/justfile +++ b/justfile @@ -38,6 +38,17 @@ build-binary-mac VERSION: build-binary-linux VERSION: just build-binary {{VERSION}} x86_64-unknown-linux-musl +build-and-fetch-linux-binary VERSION: + vagrant up + vagrant ssh -- 'bash -lc "cd just && git checkout build-binaries && git pull && just build-binary-linux {{VERSION}}"' + rm -rf tmp/linux + mkdir tmp/linux + scp \ + -P 2222 \ + -i .vagrant/machines/default/virtualbox/private_key \ + 'vagrant@127.0.0.1:just/tmp/*-x86_64-unknown-linux-musl.tar.gz' \ + tmp/linux + build-binary VERSION TARGET: git diff --no-ext-diff --quiet --exit-code git checkout {{VERSION}} @@ -49,12 +60,11 @@ build-binary VERSION TARGET: GRAMMAR.md \ LICENSE.md \ README.md \ - target/release/just \ + target/{{TARGET}}/release/just \ tmp/just-{{VERSION}}-{{TARGET}} cd tmp && tar cvfz \ just-{{VERSION}}-{{TARGET}}.tar.gz \ just-{{VERSION}}-{{TARGET}} - open tmp # clean up feature branch BRANCH done BRANCH: @@ -105,10 +115,11 @@ backtick-fail: echo {{`exit 1`}} test-quine: - cargo run -- quine clean + cargo run -- quine # make a quine, compile it, and verify it -quine: create +quine: + @echo '{{quine-text}}' > tmp/gen0.c cc tmp/gen0.c -o tmp/gen0 ./tmp/gen0 > tmp/gen1.c cc tmp/gen1.c -o tmp/gen1 @@ -132,11 +143,6 @@ quine-text = ' } ' -# create our quine -create: - mkdir -p tmp - @echo '{{quine-text}}' > tmp/gen0.c - # run all polyglot recipes polyglot: python js perl sh ruby diff --git a/tmp/.gitignore b/tmp/.gitignore new file mode 100644 index 0000000..72e8ffc --- /dev/null +++ b/tmp/.gitignore @@ -0,0 +1 @@ +*