Skip to content

Instantly share code, notes, and snippets.

@rcreasey
Created January 12, 2010 17:54
Show Gist options
  • Select an option

  • Save rcreasey/275407 to your computer and use it in GitHub Desktop.

Select an option

Save rcreasey/275407 to your computer and use it in GitHub Desktop.
package :memcache do
description 'A High-performance, distributed memory object caching system.'
arch = @options[:arch] || 'x86_64'
version = @options[:versions][:memcache] || '1.2.8'
libevent_version = @options[:versions][:libevent] || '1.4.9'
mirror_path = @options[:mirror] || "http://www.danga.com/memcached/dist"
install_path = "#{@defaults[:prefix]}/memcache/#{version}"
libevent_path = "#{@defaults[:prefix]}/libevent/#{libevent_version}"
source "#{mirror_path}/memcached-#{version}.tar.gz" do
prefix install_path
with %W( libevent=#{libevent_path} )
enable %W( threads #{'64bit' if arch =='x86_64'} )
end
verify do
has_directory "#{install_path}"
has_executable "#{install_path}/bin/memcached"
end
requires :libevent
end
package :libevent do
description 'Asynchronous event notification library.'
version = @options[:versions][:libevent] || '1.2.8'
mirror_path = @options[:mirror] || "http://monkey.org/~provos"
install_path = "#{@defaults[:prefix]}/libevent/#{version}"
source "#{mirror_path}/libevent-#{version}-stable.tar.gz" do
prefix install_path
end
verify do
has_directory "#{install_path}"
has_directory "#{install_path}/include"
has_file "#{install_path}/include/event.h"
end
end
On the host, it would end up doing the following:
1. wget http://monkey.org/~provos/libevent-1.4.9-stable.tar.gz
2. extract it
3. run ["./configure --prefix=/z/services/libevent/1.4.9", "make", "make install"].join(' && ')
4. wget http://www.danga.com/memcached/dist/memcached-1.2.8.tar.gz
5. extract it
6. run ["./configure --prefix=/z/services/memcached/1.2.8 --with-libevent=/z/services/libevent/1.4.9 --enable-threads --enable-64bit", "make", "make install"].join(' && ')
source_package "libevent" do
version '1.4.9'
location #{node[:libevent][:mirror]} || "http://monkey.org/~provos"
filename "libevent-#{version}-stable.tar.gz"
prefix "/z/services/libevent/#{version}"
end
source_package "memcache" do
version '1.2.8'
location #{node[:memcache][:mirror]} || "http://www.danga.com/memcached/dist"
filename "memcached-#{version}.tar.gz"
prefix "/z/services/memcache/#{version}"
configure {:with => %W( libevent=/z/services/libevent/#{node[:libevent][:version]} ),
:enable => %W( threads #{'64bit' if node[:machine] == 'x86_64'} )}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment