Hello Bryan-

On 09:42 Wed 15 Jun 2011, Bryan Duxbury wrote:
> Is DESTDIR always defined?

No, it isn't. But, it seems to do the right thing despite that.

To be explicit and safe lets copy the way the python Makefile works and
define it is / by default. Patch inline.

Thank you for the review.

        Brandon

>From c9f4b2a260efa7bcb5c4dae3b8f4de70fe3f5501 Mon Sep 17 00:00:00 2001
From: Brandon Philips <brandon.phil...@rackspace.com>
Date: Tue, 14 Jun 2011 16:31:25 -0700
Subject: [PATCH] lib/rb: Fix Makefile.am to work with DESTDIR=

With DESTDIR=/tmp/installdir the following error occurs:

mkdir -p /usr/local/lib/ruby/site_ruby/1.9.1/x86_64-linux
install thrift_native.so /usr/local/lib/ruby/site_ruby/1.9.1/x86_64-linux/.
setup.rb:633:in `initialize': Permission denied - 
/usr/local/lib/ruby/site_ruby/1.9.1/x86_64-linux/thrift_native.so 
(Errno::EACCES)
---
 lib/rb/Makefile.am |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lib/rb/Makefile.am b/lib/rb/Makefile.am
index da45ed5..39c04d9 100644
--- a/lib/rb/Makefile.am
+++ b/lib/rb/Makefile.am
@@ -28,12 +28,14 @@ EXTRA_DIST = \
        script \
        spec
 
+DESTDIR ?= /
+
 all-local:
        if [ -n "$(RUBY_PREFIX)" ] ; then $(RUBY) setup.rb config 
--prefix=$(DESTDIR)$(RUBY_PREFIX) --rbdir='$$libdir/ruby' 
--sodir='$$libdir/ruby' ; elif [ -n "$(DESTDIR)" ] ; then $(RUBY) setup.rb 
config --prefix=$(DESTDIR) ; else $(RUBY) setup.rb config ; fi
        $(RUBY) setup.rb setup
 
 install-exec-hook:
-       $(RUBY) setup.rb install
+       $(RUBY) setup.rb install --prefix=$(DESTDIR)
 
 # Make sure this doesn't fail if Ruby is not configured.
 clean-local:
-- 
1.7.3.4

Reply via email to