#!/usr/bin/env ruby
require 'fileutils'

puts 'Getting needed software to build ffmpeg video support...'
`sudo apt-get -y install ruby1.9.1 ruby1.8-dev ruby1.9.1-dev libavformat-dev libswscale-dev`

puts 'Building ffmpeg for Ruby 1.8...'
FileUtils.rm_f '1.8/ffmpeg.so'
`ruby1.8 extconf.rb`
`make clean`
`make`

FileUtils.mkdir_p '1.8'
FileUtils.mv 'ffmpeg.so', '1.8/ffmpeg.so'

puts 'Building ffmpeg for Ruby 1.9...'
FileUtils.rm_f '1.9/ffmpeg.so'
`ruby1.9.1 extconf.rb`
`make clean`
`make`

FileUtils.mkdir_p '1.9'
FileUtils.mv 'ffmpeg.so', '1.9/ffmpeg.so'
