Skip to content

Commit

Permalink
prep
Browse files Browse the repository at this point in the history
  • Loading branch information
keeganbrown committed Sep 29, 2015
1 parent 709df98 commit fd40071
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -7,3 +7,4 @@ out*.jpg
out*.png
examples/*.avi
examples/tmp/*
vagrant/.vagrant
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -3,9 +3,9 @@
"description": "Node Bindings to OpenCV",
"author": "Peter Braden <peterbraden@peterbraden.co.uk>",
"dependencies": {
"buffers": "0.1.1",
"nan": "^1.7.0",
"node-pre-gyp": "^0.6.4"
"buffers": "^0.1.1",
"nan": "^2.0.9",
"node-pre-gyp": "^0.6.11"
},
"version": "3.2.0",
"devDependencies": {
Expand Down
31 changes: 31 additions & 0 deletions vagrant/Vagrantfile
@@ -0,0 +1,31 @@
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

# Using Ubuntu Trusty (14.04) for now
config.vm.box = "ubuntu/trusty64"

# Give Box it's own IP
config.vm.network "private_network", ip: "192.168.35.111"

# Would you rather use port forwarding? comment out that last line and add these:
# config.vm.network :forwarded_port, guest: 80, host: 8888
# config.vm.network :forwarded_port, guest: 3000, host: 3000 #common port for node, etc

# Sync parent folder. Clone this repo into project folder.
# I Like to work this way so I don't have vagrant files running all over my code.
# Parent folder will have the name of your app
config.vm.synced_folder "../", "/home/vagrant/"+File.basename(File.expand_path('..'))

# EDIT THE SCRIPT REFERENCED BELOW TO
config.vm.provision "shell", path: "setup.sh"

config.vm.provider "virtualbox" do |v|
#NAME THE VM -- You'll probably want to rename this box on a per-project basis.
#For now, it should inherit the name of the parent folder
v.name = "VDK - " + File.basename(File.expand_path('..'))

# 512 is pretty tight to run Node.js on, if you're in to that sort of thing. I've boosted this.
v.memory = 1024
end
end
6 changes: 6 additions & 0 deletions vagrant/scripts/setup-node.sh
@@ -0,0 +1,6 @@
apt-get install gcc make build-essential -y
apt-get install -y curl
apt-get install -y git
curl --silent --location https://deb.nodesource.com/setup_4.x | sudo bash -
apt-get install -y nodejs

31 changes: 31 additions & 0 deletions vagrant/setup.sh
@@ -0,0 +1,31 @@
#!/bin/bash
apt-get update
apt-get upgrade -y

#INSTALL BASE
chmod +x "/vagrant/scripts/base.sh"
$include "/vagrant/scripts/base.sh"

#COMMENT OUT OR IN LINES AS APPROPRIATE
INCLUDED_TECH=()
INCLUDED_TECH+=("node")
#INCLUDED_TECH+=("mongodb")
#INCLUDED_TECH+=("meteor")
#INCLUDED_TECH+=("redis")
#INCLUDED_TECH+=("apache")
#INCLUDED_TECH+=("nginx")
#INCLUDED_TECH+=("mysql")
#INCLUDED_TECH+=("php")

SCRIPT_LOCATION="/vagrant/scripts/setup-"

for i in ${INCLUDED_TECH[@]}; do
chmod +x "${SCRIPT_LOCATION}${i}.sh"
$include "${SCRIPT_LOCATION}${i}.sh"
done

echo "Base Setup Done!"
ls
#INSTALL USER
chmod +x "/vagrant/user.sh"
$include "/vagrant/user.sh"
26 changes: 26 additions & 0 deletions vagrant/user.sh
@@ -0,0 +1,26 @@
export REPO_FOLDER="node-opencv"
cd /home/vagrant/$REPO_FOLDER
apt-get install -y cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
mkdir opencv_lib
cd /home/vagrant/$REPO_FOLDER/opencv_lib/
[ ! -f /home/vagrant/$REPO_FOLDER/opencv_lib/2.4.11.tar.gz ] && wget https://github.com/Itseez/opencv/archive/2.4.11.tar.gz && tar -zxvf2.4.11.tar.gz
cd opencv-2.4.11
mkdir release
cd release
echo "Removing any pre-installed ffmpeg and x264"
apt-get -y remove ffmpeg x264 libx264-dev
echo "Installing Dependenices"
apt-get -y install libopencv-dev
apt-get -y install build-essential checkinstall cmake pkg-config yasm
apt-get -y install libtiff4-dev libjpeg-dev libjasper-dev
apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libdc1394-22 libdc1394-utils libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev
apt-get -y install python-dev python-numpy
apt-get -y install libtbb-dev
apt-get -y install libqt4-dev libgtk2.0-dev
apt-get -y install libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev
apt-get -y install x264 v4l-utils ffmpeg libx264-dev
apt-get -y install libgtk2.0-dev

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON ..
make install
cd /home/vagrant/$REPO_FOLDER/

0 comments on commit fd40071

Please sign in to comment.