Skip to content

Instantly share code, notes, and snippets.

@jtimberman
Created February 26, 2012 06:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtimberman/d3f67bb25145ac3bf395 to your computer and use it in GitHub Desktop.
Save jtimberman/d3f67bb25145ac3bf395 to your computer and use it in GitHub Desktop.
recipe[emacs::source24] to install Emacs 24 from Git source
#
# Author:: Joshua Timberman <opensource@housepub.org>
# Copyright:: Copyright (c) 2012, Joshua Timberman
# License:: Apache License, Version 2.0
#
# 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.
#
if platform?("ubuntu","debian","linuxmint")
srcdir = "#{Chef::Config[:file_cache_path]}/emacs-source"
%w{ git-core build-essential texinfo autoconf libncurses-dev }.each {|prereq| package prereq}
git "#{Chef::Config[:file_cache_path]}/emacs-source" do
repository "git://git.savannah.gnu.org/emacs.git"
action :checkout
end
bash "build emacs24" do
cwd srcdir
creates "#{srcdir}/src/emacs"
code <<-EOH
./autogen.sh && \
./configure --without-x && \
make bootstrap && \
make 2>&1 >| make-#{node.name}-#{node['ohai_time']}
EOH
end
execute "install emacs24" do
cwd srcdir
command "make install 2>&1 >| make-#{node.name}-#{node['ohai_time']}"
creates "/usr/local/bin/emacs"
only_if "#{srcdir}/src/emacs --version"
end
else
Chef::Log.warn("#{cookbook_name}::#{recipe_name} is not supported on #{node['platform']}")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment