Skip to content
This repository has been archived by the owner on Jul 25, 2023. It is now read-only.

Commit

Permalink
vagrant setup for emscripten
Browse files Browse the repository at this point in the history
  • Loading branch information
rhelmer committed Apr 20, 2012
1 parent b9ea51a commit 49399ba
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vagrant
35 changes: 31 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
Vagrant[1] and puppet[2] config for emscripten[3]
This project will use http://vagrantup.com and http://puppetlabs.com to
install a complete https://github.com/kripken/emscripten/ environment in a
local http://virtualbox.org/ VM.

[1] http://vagrantup.com
[2] http://puppetlabs.com
[3] https://github.com/kripken/emscripten/
---
INSTALL
---

1) Install the latest Virtualbox from http://www.virtualbox.org/

2) Install vagrant from http://vagrantup.com/

3) build VM and provision with puppet

$ vagrant up

4) Enjoy your Emscripten environment!

Here are some common vagrant operations:

SSH into your VM (emscripten is checked out in ~vagrant/src/emscripten):
$ vagrant ssh

Re-run puppet
$ vagrant provision

Reboot VM and re-run puppet
$ vagrant reload

Destroy VM and rebuild from scratch
$ vagrant destroy
$ vagrant up
15 changes: 15 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant::Config.run do |config|
config.vm.box = "ubuntu-1110-server-amd64"
config.vm.box_url = "http://timhuegdon.com/vagrant-boxes/ubuntu-11.10.box"

# Boot with a GUI so you can see the screen. (Default is headless)
# config.vm.boot_mode = :gui

config.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet/manifests"
puppet.manifest_file = "emscripten.pp"
end
end
40 changes: 40 additions & 0 deletions puppet/files/dot.emscripten
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This file will be copied to ~/.emscripten if that file doesn't exist. Or, this is that copy.
# IMPORTANT: Edit the *copy* with the right paths!

EMSCRIPTEN_ROOT = os.path.expanduser('~/src/emscripten') # this helps projects using emscripten find it

LLVM_ROOT = os.path.expanduser('/home/vagrant/src/clang+llvm-3.0-x86_64-linux-Ubuntu-11_10/bin/')

# See below for notes on which JS engine(s) you need
NODE_JS = 'node'
SPIDERMONKEY_ENGINE = [os.path.expanduser('/usr/bin/js'), '-m', '-n']
V8_ENGINE = os.path.expanduser('~/src/v8/d8')

TEMP_DIR = '/tmp'


########################################################################################################


# Pick the JS engine to use for running the compiler. This engine must exist, or
# nothing can be compiled.
#
# Recommendation: If you already have node installed, use that. Otherwise, build v8 or
# spidermonkey from source. Any of these three is fine, as long as it's
# a recent version (especially for v8 and spidermonkey).

COMPILER_ENGINE = NODE_JS
#COMPILER_ENGINE = V8_ENGINE
#COMPILER_ENGINE = SPIDERMONKEY_ENGINE


# All JS engines to use when running the automatic tests. Not all the engines in this list
# must exist (if they don't, they will be skipped in the test runner).
#
# Recommendation: If you already have node installed, use that. If you can, also build
# spidermonkey from source as well to get more test coverage (node can't
# run all the tests due to node issue 1669). v8 is currently not recommended
# here because of v8 issue 1822.

JS_ENGINES = [NODE_JS, SPIDERMONKEY_ENGINE]

87 changes: 87 additions & 0 deletions puppet/manifests/emscripten.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
$emscripten_deps = ["git", "openjdk-6-jdk", "nodejs"]
$clang_dir = "clang+llvm-3.0-x86_64-linux-Ubuntu-11_10"
$clang_filename = "${clang_dir}.tar.gz"
$clang_url = "http://llvm.org/releases/3.0/${clang_filename}"

Exec {
user => "vagrant",
cwd => "/home/vagrant/src/emscripten",
logoutput => on_failure,
environment => ["PWD=/home/vagrant/src/emscripten", "HOME=/home/vagrant"],
timeout => 0
}

class emscripten {
file { "/home/vagrant/.emscripten":
owner => vagrant,
group => vagrant,
mode => 664,
source => "/vagrant/puppet/files/dot.emscripten"
}

file { "/home/vagrant/src":
owner => vagrant,
group => vagrant,
mode => 775,
recurse=> false,
ensure => directory
}

exec { "/usr/bin/add-apt-repository ppa:chris-lea/node.js":
alias => "add-nodejs-ppa",
cwd => "/root",
user => "root",
creates => "/etc/apt/sources.list.d/chris-lea-node_js-oneiric.list",
require => Package["python-software-properties"],
notify => Exec["apt-get-update"]
}

exec { "/usr/bin/apt-get update":
alias => "apt-get-update",
cwd => "/root",
user => "root",
}

package {
$emscripten_deps:
ensure => "latest",
require => [Exec["add-nodejs-ppa"], Exec["apt-get-update"]];

"python-software-properties":
ensure => "latest";
}


exec { "/usr/bin/git clone https://github.com/kripken/emscripten/":
alias => "git-clone-emscripten",
cwd => "/home/vagrant/src",
require => Package[$emscripten_deps],
creates => "/home/vagrant/src/emscripten"
}

exec { "/usr/bin/git pull origin master":
alias => "git-pull-emscripten",
require => Exec["git-clone-emscripten"]
}

exec { "/usr/bin/wget ${clang_url}":
alias => "wget-clang-llvm",
cwd => "/home/vagrant/src",
creates => "/home/vagrant/src/${clang_filename}",
environment => ["PWD=/home/vagrant/src", "HOME=/home/vagrant"],
}

exec { "/bin/tar -zxf ${clang_filename}":
alias => "untar-clang-llvm",
cwd => "/home/vagrant/src",
environment => ["PWD=/home/vagrant/src", "HOME=/home/vagrant"],
creates => "/home/vagrant/src/${clang_dir}",
require => Exec["wget-clang-llvm"]
}
}

group { "puppet":
ensure => "present",
}

include emscripten

0 comments on commit 49399ba

Please sign in to comment.