Build Linux binaries using Vagrant (#132)

Adds a Vagrantfile to provision a Debian VM, and recipes to build for
linux on the VM.
This commit is contained in:
Casey Rodarmor 2016-11-23 20:20:32 -08:00 committed by GitHub
parent da8108f19d
commit 6b9922fc2c
4 changed files with 35 additions and 10 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
/target /target
/tmp /.vagrant

18
Vagrantfile vendored Normal file
View File

@ -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

View File

@ -38,6 +38,17 @@ build-binary-mac VERSION:
build-binary-linux VERSION: build-binary-linux VERSION:
just build-binary {{VERSION}} x86_64-unknown-linux-musl 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: build-binary VERSION TARGET:
git diff --no-ext-diff --quiet --exit-code git diff --no-ext-diff --quiet --exit-code
git checkout {{VERSION}} git checkout {{VERSION}}
@ -49,12 +60,11 @@ build-binary VERSION TARGET:
GRAMMAR.md \ GRAMMAR.md \
LICENSE.md \ LICENSE.md \
README.md \ README.md \
target/release/just \ target/{{TARGET}}/release/just \
tmp/just-{{VERSION}}-{{TARGET}} tmp/just-{{VERSION}}-{{TARGET}}
cd tmp && tar cvfz \ cd tmp && tar cvfz \
just-{{VERSION}}-{{TARGET}}.tar.gz \ just-{{VERSION}}-{{TARGET}}.tar.gz \
just-{{VERSION}}-{{TARGET}} just-{{VERSION}}-{{TARGET}}
open tmp
# clean up feature branch BRANCH # clean up feature branch BRANCH
done BRANCH: done BRANCH:
@ -105,10 +115,11 @@ backtick-fail:
echo {{`exit 1`}} echo {{`exit 1`}}
test-quine: test-quine:
cargo run -- quine clean cargo run -- quine
# make a quine, compile it, and verify it # make a quine, compile it, and verify it
quine: create quine:
@echo '{{quine-text}}' > tmp/gen0.c
cc tmp/gen0.c -o tmp/gen0 cc tmp/gen0.c -o tmp/gen0
./tmp/gen0 > tmp/gen1.c ./tmp/gen0 > tmp/gen1.c
cc tmp/gen1.c -o tmp/gen1 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 # run all polyglot recipes
polyglot: python js perl sh ruby polyglot: python js perl sh ruby

1
tmp/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*