At Thu, 20 Dec 2001 03:32:29 +0900,
Alexander Bokovoy <a.bokovoy / sam-solutions.net> wrote:
> Don't know how this escaped from mkmf.rb but it misses several DESTDIR
> prefixes in exec_prefix and libdir which particulary insuitable for
> packaging (rpm, deb, ...) of Ruby extensions.

Since exec_prefix is defaulted to $(prefix), $(exec_prefix)
would be expanded as $(DESTDIR)$(DESTDIR)/prefix.

If you configured exec_prefix and/or libdir as an absolute path
not relative to $(prefix), you need to specify them simillary
to make.

$ make DESTDIR=/var/tmp/foo \
       exec_prefix='$(DESTDIR)/exec/prefix' \
       libdir='$(DESTDIR)/lib/dir' \
       site-install


Index: mkmf.rb =================================================================== RCS file: /cvs/ruby/src/ruby/lib/mkmf.rb,v retrieving revision 1.37.2.26 diff -u -2 -p -r1.37.2.26 mkmf.rb --- mkmf.rb 2001/12/06 09:55:31 1.37.2.26 +++ mkmf.rb 2001/12/19 19:46:53 @@ -361,4 +361,8 @@ def dir_config(target, idefault=nil, lde end +def with_destdir(dir) + /^\$\(/ =~ dir ? dir : "$(DESTDIR)"+dir +end + def create_makefile(target, srcdir = File.dirname($0)) save_libs = $libs.dup @@ -452,12 +456,12 @@ else end } -prefix = $(DESTDIR)#{CONFIG["prefix"].sub(drive, '')} -exec_prefix = #{CONFIG["exec_prefix"].sub(drive, '')} -libdir = #{$libdir.sub(drive, '')} -rubylibdir = #{$rubylibdir.sub(drive, '')} -archdir = #{$archdir.sub(drive, '')} -sitedir = #{$sitedir.sub(drive, '')} -sitelibdir = #{$sitelibdir.sub(drive, '')} -sitearchdir = #{$sitearchdir.sub(drive, '')} +prefix = #{with_destdir CONFIG["prefix"].sub(drive, '')} +exec_prefix = #{with_destdir CONFIG["exec_prefix"].sub(drive, '')} +libdir = #{with_destdir $libdir.sub(drive, '')} +rubylibdir = #{with_destdir $rubylibdir.sub(drive, '')} +archdir = #{with_destdir $archdir.sub(drive, '')} +sitedir = #{with_destdir $sitedir.sub(drive, '')} +sitelibdir = #{with_destdir $sitelibdir.sub(drive, '')} +sitearchdir = #{with_destdir $sitearchdir.sub(drive, '')} target_prefix = #{target_prefix} @@ -500,5 +504,5 @@ EOMF mfile.printf <<EOMF $(sitearchdir)$(target_prefix)/$(DLLIB): $(DLLIB) - @$(RUBY) -r ftools -e 'File::makedirs(*ARGV)' $(libdir) $(sitearchdir)$(target_prefix) + @$(RUBY) -r ftools -e 'File::makedirs(*ARGV)' $(sitearchdir)$(target_prefix) @$(RUBY) -r ftools -e 'File::install(ARGV[0], ARGV[1], 0555, true)' $(DLLIB) $(sitearchdir)$(target_prefix)/$(DLLIB) EOMF
Nobu Nakada