Tools and libraries to glue C/C++ APIs to high-level languages
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

173 lines
5.9 KiB

# -*- mode: ruby -*-
# vi: set ft=ruby :
#Shell Scripts go here
$script = <<SCRIPT
SCRIPT
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "ubuntu/trusty64"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
#load external box config
external = File.read 'vmsettings.cfg'
eval external
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# this function fixes errors with ubuntu interactive shell
config.vm.provision "fix-no-tty", type: "shell" do |s|
s.privileged = false
s.inline = "sudo sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.profile"
end
#this section runs as root
config.vm.provision "shell", privileged: true , inline: <<-SHELL
# Add Repos
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo add-apt-repository ppa:george-edison55/cmake-3.x
apt-get update
# Build tools
apt-get install -y git build-essential clang cmake ninja-build
aot-get install -y p7zip-full
# Mono
apt-get install -y mono-devel
SHELL
#this section runs as normal user
config.vm.provision "shell", privileged: false , inline: <<-SHELL
function mkcd () { mkdir -p "$@" && cd "$@"; }
git clone https://github.com/mono/CppSharp.git
cd CppSharp/deps/
git clone https://github.com/llvm-mirror/llvm.git
cd llvm/
#change this hash if u need another version of Llvm
git reset --hard 0e8abfa6ed986c892ec723236e32e78fd9c47b8
cd tools/
git clone https://github.com/llvm-mirror/clang.git
cd clang/
#change this hash if u need another version of Clang
git reset --hard 3457cd5516ac741fa106623d9578f5ac88593f4d
mkcd ../../build
cmake -G Ninja -DCLANG_BUILD_EXAMPLES=false -DCLANG_INCLUDE_DOCS=false -DCLANG_INCLUDE_TESTS=false -DCLANG_INCLUDE_DOCS=false -DCLANG_BUILD_EXAMPLES=false -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_INCLUDE_EXAMPLES=false -DLLVM_INCLUDE_DOCS=false -DLLVM_INCLUDE_TESTS=false ..
ninja
# make the output package
cd ..
if [ -d "out" ]; then rm -rf out; fi
mkdir out
mkdir -p out/tools/clang
mkdir -p out/tools/clang/lib/CodeGen
mkdir -p out/build/
mkdir -p out/build/lib
mkdir -p out/build/tools/clang
mkdir -p out/build/tools/clang/lib
cp -R include/ out/
cp -R build/include/ out/build
cp build/lib/*.a out/build/lib
cp -R tools/clang/include/ out/tools/clang
cp -R tools/clang/lib/CodeGen/*.h out/tools/clang/lib/CodeGen
cp -R build/tools/clang/include/ out/build/tools/clang
rm out/build/lib/libllvm*ObjCARCOpts*.a
rm out/build/lib/libclang*ARC*.a
rm out/build/lib/libclang*Matchers*.a
rm out/build/lib/libclang*Rewrite*.a
rm out/build/lib/libclang*StaticAnalyzer*.a
rm out/build/lib/libclang*Tooling*.a
7z a llvm_linux_x86_64.7z ./out/*
# upload to dropbox
curl "https://raw.githubusercontent.com/andreafabrizi/Dropbox-Uploader/master/dropbox_uploader.sh" -o dropbox_uploader.sh
echo APPKEY= > ~/.dropbox_uploader
echo APPSECRET= >> ~/.dropbox_uploader
echo ACCESS_LEVEL=sandbox >> ~/.dropbox_uploader
echo OAUTH_ACCESS_TOKEN= >> ~/.dropbox_uploader
echo OAUTH_ACCESS_TOKEN_SECRET= >> ~/.dropbox_uploader
./dropbox_uploader.sh upload llvm_linux_x86_64.7z llvm_linux_x86_64.7z
SHELL
end