Skip to content

Commit

Permalink
Add libav cookbook
Browse files Browse the repository at this point in the history
  • Loading branch information
nhannguyen committed Jul 15, 2013
1 parent a335ff9 commit 281d4e0
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
Empty file added libav/README.md
Empty file.
1 change: 1 addition & 0 deletions libav/attributes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default[:libav][:version] = 'release/9'
10 changes: 10 additions & 0 deletions libav/metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name 'libav'
maintainer 'Cogini'
maintainer_email '[email protected]'
license 'All rights reserved'
description 'Installs/Configures libav'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'

depends 'apt'
depends 'git'
44 changes: 44 additions & 0 deletions libav/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

include_recipe "apt"
include_recipe "git"
include_recipe "fpm"


chef_cache = Chef::Config[:file_cache_path]
version = node[:libav][:version]
source_dir = "#{chef_cache}/libav"

pkg_file = "#{chef_cache}/libav-#{version}.deb"
pkg_type = pkg_file[-3..-1]


unless File.exist?(pkg_file)

bash "Get libav source" do
code <<-EOH
[[ -d #{source_dir} ]] || git clone git://git.libav.org/libav.git #{source_dir}
cd #{source_dir}
git fetch
git checkout #{version}
EOH
end

bash 'Compile libav' do
cwd source_dir
code <<-EOH
apt-get build-dep -y libav
./configure
make
make install DESTDIR=#{source_dir}/install
fpm -s dir -t #{pkg_type} -n libav -v 1 -p #{pkg_file} -C install .
EOH
end

end


package "libav" do
action :install
source pkg_file
provider node[:fpm][:provider]
end

0 comments on commit 281d4e0

Please sign in to comment.