diff --git a/.gitignore b/.gitignore index 160a3a95..ef080446 100755 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ out*.jpg out*.png examples/*.avi examples/tmp/* +vagrant/.vagrant diff --git a/package.json b/package.json index 226053aa..88dda82a 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,9 @@ "description": "Node Bindings to OpenCV", "author": "Peter Braden ", "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": { diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile new file mode 100644 index 00000000..ad5f0f01 --- /dev/null +++ b/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 diff --git a/vagrant/scripts/setup-node.sh b/vagrant/scripts/setup-node.sh new file mode 100755 index 00000000..de3bbb2b --- /dev/null +++ b/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 + diff --git a/vagrant/setup.sh b/vagrant/setup.sh new file mode 100755 index 00000000..e51e2828 --- /dev/null +++ b/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" \ No newline at end of file diff --git a/vagrant/user.sh b/vagrant/user.sh new file mode 100755 index 00000000..fb22639e --- /dev/null +++ b/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/