Permalink
Browse files

Import libevent cookbook

Apache 2 licensed, per discussion with @joshk.
  • Loading branch information...
1 parent bb630f2 commit a1d75988443d5336937e9d970dd4ce2acaf0c035 @michaelklishin michaelklishin committed Oct 24, 2013
@@ -0,0 +1,7 @@
+language: ruby
+gemfile:
+ - tests/support/Gemfile
+rvm:
+ - 1.9.2
+ - 1.9.3
+script: bundle exec rake chef:tests
@@ -0,0 +1,12 @@
+# CHANGELOG for libevent
+
+This file is used to list changes made in each version of libevent.
+
+## 0.1.0:
+
+* Initial release of libevent
+
+- - -
+Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
+
+The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.
@@ -0,0 +1,22 @@
+Description
+===========
+
+Installs libevent (from source)
+
+Requirements
+============
+
+## Platform
+
+* Linux (I'd tested on CentOS 6.3)
+
+Attributes
+==========
+
+* `node['libevent']['version']` - version of libev. Default is 2.0.20 .
+* `node['libevent']['prefix']` - prefix of install_path. Default is /usr .
+
+Usage
+=====
+
+Simply include the `libevent` and the libevent will be installed to your system.
@@ -0,0 +1,8 @@
+#!/usr/bin/env rake
+
+require 'rake-foodcritic'
+require 'rake-chef-syntax'
+
+namespace :chef do
+ task :tests => [:foodcritic, :syntax_check]
+end
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: libevent
+# Attributes:: default
+#
+# Copyright 2012, Takeshi KOMIYA
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+default['libevent']['version'] = '2.0.20'
+default['libevent']['prefix'] = '/usr'
+
@@ -0,0 +1,13 @@
+name "libevent"
+maintainer "Takeshi KOMIYA"
+maintainer_email "i.tkomiya@gmail.com"
+license "Apache 2.0"
+description "Installs libevent (from source)"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
+version "0.1.0"
+
+%w{ fedora redhat centos ubuntu debian amazon }.each do |os|
+ supports os
+end
+
+depends 'build-essential'
@@ -0,0 +1,48 @@
+#
+# Cookbook Name:: libevent
+# Recipe:: default
+#
+# Copyright 2012, Takeshi KOMIYA
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+include_recipe "build-essential"
+
+version = node['libevent']['version']
+prefix = node['libevent']['prefix']
+
+remote_file "#{Chef::Config[:file_cache_path]}/libevent-#{version}-stable.tar.gz" do
+ source "https://github.com/downloads/libevent/libevent/libevent-#{version}-stable.tar.gz"
+ not_if {::File.exists?("#{prefix}/lib/libevent.a")}
+ notifies :run, "script[install-libevent]", :immediately
+end
+
+script "install-libevent" do
+ interpreter "bash"
+ only_if {::File.exists?("#{Chef::Config[:file_cache_path]}/libevent-#{version}-stable.tar.gz")}
+ flags "-e -x"
+ code <<-EOH
+ cd /usr/local/src
+ tar xzf #{Chef::Config[:file_cache_path]}/libevent-#{version}-stable.tar.gz
+ cd libevent-#{version}-stable
+ ./configure --prefix=#{prefix} --with-pic
+ make
+ make install
+ EOH
+end
+
+file "libevent-tarball-cleanup" do
+ path "#{Chef::Config[:file_cache_path]}/libevent-#{version}-stable.tar.gz"
+ action :delete
+end
@@ -0,0 +1,5 @@
+source "https://rubygems.org"
+
+gem 'rake'
+gem 'rake-foodcritic'
+gem 'rake-chef-syntax'

1 comment on commit a1d7598

Owner

joshk commented on a1d7598 Oct 24, 2013

Please sign in to comment.