summaryrefslogtreecommitdiff
path: root/ext/extmk.rb.in
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-09-04 16:52:53 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-09-04 16:52:53 +0000
commit8ed2c6fc8a141b07d2b7a024b5ec1ffa4d9250e2 (patch)
tree001c9d1c834fc6b2b73fd6cefb6fb146daa6197c /ext/extmk.rb.in
parent0e7b1e2632570b33aa957b9db966c09b290671a5 (diff)
* extmk.rb (create_makefile): add macro MAKEDIRS, INSTALL_PROG,
INSTALL_DATA. * extmk.rb (create_makefile): support for building to any directory. * extmk.rb (xsystem): move to mkmf.rb. * mkmf.rb (xsystem): support for extmk.rb * mkmf.rb ($CPP): remove '-E' option. add CPPFLAGS. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/extmk.rb.in')
-rw-r--r--ext/extmk.rb.in32
1 files changed, 11 insertions, 21 deletions
diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in
index 54f1176..77da315 100644
--- a/ext/extmk.rb.in
+++ b/ext/extmk.rb.in
@@ -44,23 +44,6 @@ $log = nil
$orgerr = $stderr.dup
$orgout = $stdout.dup
-def xsystem command
- if $DEBUG
- puts command
- $stdout.flush
- return system(command)
- end
- $log ||= open(File.join($topdir, 'ext', 'extmk.log'), 'w')
- $stderr.reopen($log)
- $stdout.reopen($log)
- puts command
- $stdout.flush
- system(command)
-ensure
- $stderr.reopen($orgerr)
- $stdout.reopen($orgout)
-end
-
$LINK = "#{CONFIG['CC']} #{OUTFLAG}conftest -I#$topdir -I#$top_srcdir #{CFLAGS} %s %s #{CONFIG['LDFLAGS']} %s conftest.c %s %s #{CONFIG['LIBS']}"
$CPP = "#{CONFIG['CPP']} #{CONFIG['CPPFLAGS']} %s -I#$topdir -I#$top_srcdir #{CFLAGS} %s %s conftest.c"
@@ -150,10 +133,12 @@ EOL
RUBY_INSTALL_NAME = #{CONFIG['RUBY_INSTALL_NAME']}
RUBY_SO_NAME = #{CONFIG['RUBY_SO_NAME']}
+ruby_version = #{Config::CONFIG["ruby_version"]}
prefix = #{CONFIG['prefix']}
exec_prefix = #{CONFIG['exec_prefix']}
libdir = #{CONFIG['libdir']}
+rubylibdir = $(libdir)/ruby/$(ruby_version)
#pkglibdir = $(libdir)/$(RUBY_INSTALL_NAME)/#{CONFIG['MAJOR']}.#{CONFIG['MINOR']}
pkglibdir = $(libdir)/ruby/#{CONFIG['MAJOR']}.#{CONFIG['MINOR']}
archdir = $(pkglibdir)/#{CONFIG['arch']}
@@ -203,6 +188,9 @@ DLLIB = $(TARGET).#{$static ? $LIBEXT : CONFIG['DLEXT']}
RUBY = #{ruby_interpreter} -I$(topdir) -I$(hdrdir)/lib
RM = $(RUBY) -rftools -e "File::rm_f(*ARGV.map do|x|Dir[x]end.flatten.uniq)"
+MAKEDIRS = $(RUBY) -r ftools -e 'File::makedirs(*ARGV)'
+INSTALL_PROG = $(RUBY) -r ftools -e 'File::install(ARGV[0], ARGV[1], 0555, true)'
+INSTALL_DATA = $(RUBY) -r ftools -e 'File::install(ARGV[0], ARGV[1], 0644, true)'
EXEEXT = CONFIG['EXEEXT']
@@ -229,15 +217,17 @@ EOS
mfile.printf <<EOS
install:
- @$(RUBY) -r ftools -e 'File::makedirs(*ARGV)' $(DESTDIR)$(libdir) $(DESTDIR)$(pkglibdir) $(DESTDIR)$(archdir)$(target_prefix)
-
+ @$(MAKEDIRS) $(DESTDIR)$(libdir) $(DESTDIR)$(pkglibdir) $(DESTDIR)$(archdir)$(target_prefix)
EOS
unless $static
mfile.printf "\
- @$(RUBY) -r ftools -e 'File::install(ARGV[0], ARGV[1], 0555, true)' $(DLLIB) $(DESTDIR)$(archdir)$(target_prefix)/$(DLLIB)
+ @$(INSTALL_PROG) $(DLLIB) $(DESTDIR)$(archdir)$(target_prefix)/$(DLLIB)
"
end
- install_rb(mfile, $srcdir)
+ save_srcdir = Config::CONFIG['srcdir']
+ Config::CONFIG['srcdir'] = $srcdir
+ install_rb(mfile, '$(DESTDIR)$(rubylibdir)$(target_prefix)', '$(srcdir)')
+ Config::CONFIG['srcdir'] = save_srcdir
mfile.printf "\n"
unless /mswin32/ =~ RUBY_PLATFORM