[cairo-commit] rcairo ChangeLog,1.123,1.124 extconf.rb,1.2,1.3

Kouhei Sutou commit at pdx.freedesktop.org
Fri Apr 13 05:35:22 PDT 2007


Committed by: kou

Update of /cvs/cairo/rcairo
In directory kemper:/tmp/cvs-serv19456

Modified Files:
	ChangeLog extconf.rb 
Log Message:
* extconf.rb, Rakefile: supported RubyGems.


Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/rcairo/ChangeLog,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -d -r1.123 -r1.124
--- ChangeLog	8 Apr 2007 06:12:50 -0000	1.123
+++ ChangeLog	13 Apr 2007 12:35:13 -0000	1.124
@@ -1,3 +1,7 @@
+2007-04-13  Kouhei Sutou  <kou at cozmixng.org>
+
+	* extconf.rb, Rakefile: supported RubyGems.
+
 2007-04-08  Kouhei Sutou  <kou at cozmixng.org>
 
 	* src/rb_cairo_surface.c (yield_and_finish):

Index: extconf.rb
===================================================================
RCS file: /cvs/cairo/rcairo/extconf.rb,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- extconf.rb	8 Apr 2007 06:04:01 -0000	1.2
+++ extconf.rb	13 Apr 2007 12:35:13 -0000	1.3
@@ -2,6 +2,8 @@
 # vim: filetype=ruby:expandtab:shiftwidth=2:tabstop=8:softtabstop=2 :
 
 $LOAD_PATH.unshift(".")
+
+require 'English'
 require 'mkmf'
 require 'pkg-config'
 require 'fileutils'
@@ -61,67 +63,53 @@
   set_output_lib(target_name)
 end
 
-def create_makefile_at_srcdir(pkg_name, srcdir, defs=nil)
-  begin
-    Dir.mkdir(srcdir) unless File.exist?(srcdir)
-    Dir.chdir(srcdir)
 
-    yield if block_given?
+pkg = "cairo"
+modname = "cairo"
+ext_dir_name = "src"
+srcdir = File.join(File.expand_path(File.dirname(__FILE__)), ext_dir_name)
+major, minor, micro = 1, 2, 0
 
-    $defs << defs if defs
-    create_makefile(pkg_name, srcdir)
-  ensure
-    Dir.chdir('..')
-  end
-end
+PKGConfig.have_package(pkg, major, minor, micro) or exit 1
 
-def create_top_makefile(sub_dirs=["src"])
-  File.open("Makefile", "w") do |mfile|
-    if /mswin32/ =~ RUBY_PLATFORM
-      mfile.print <<MSWIN32_END
+setup_win32(File.basename(modname))
+$defs << "-DRUBY_CAIRO_COMPILATION"
+create_makefile(modname, srcdir)
 
-all:
-#{sub_dirs.map{|d| "	@cd #{d}\n	@nmake -nologo all\n	@cd ..\n"}.join('')}
-install:
-#{sub_dirs.map{|d| "	@cd #{d}\n	@nmake -nologo install DESTDIR=$(DESTDIR)\n	@cd ..\n"}.join('')}
-site-install:
-#{sub_dirs.map{|d| "	@cd #{d}\n	@nmake -nologo site-install DESTDIR=$(DESTDIR)\n	@cd ..\n"}.join('')}
-clean:
-#{sub_dirs.map{|d| "	@cd #{d}\n	@nmake -nologo clean\n	@cd ..\n"}.join('')}	@if exist extconf.h del extconf.h
-	@if exist conftest.* del conftest.*
-	@if exist *.lib del *.lib
-	@if exist *~ del *~
-	@if exist mkmf.log del mkmf.log
-MSWIN32_END
+makefile = File.read("Makefile")
+File.open("Makefile", "w") do |f|
+  objs = []
+  co = nil
+  makefile.each do |line|
+    case line
+    when /^TARGET\s*=\s*/
+      f.print("TARGET = #{ext_dir_name}/#{$POSTMATCH}")
+    when /^(SRCS)\s*=\s*/
+      name = $1
+      vars = $POSTMATCH.split.collect {|var| "$(srcdir)/#{var}"}.join(" ")
+      f.puts("#{name} = #{vars}")
+    when /^(OBJS|CLEANLIBS|CLEANOBJS)\s*=\s*/
+      name = $1
+      vars = $POSTMATCH.split.collect {|var| "#{ext_dir_name}/#{var}"}
+      objs = vars if name == "OBJS"
+      vars = vars.join(" ")
+      f.puts("#{name} = #{vars}")
+    when /^\t\$\(CC\)/
+      line = "#{line.chomp} -o $@" if /-o/ !~ line
+      co = line
+      f.puts(line)
     else
-      mfile.print <<END
-all:
-#{sub_dirs.map{|d| "	@cd #{d}; make all\n"}.join('')}
+      f.print(line)
+    end
+  end
 
-install:
-#{sub_dirs.map{|d| "	@cd #{d}; make install\n"}.join('')}
-site-install:
-#{sub_dirs.map{|d| "	@cd #{d}; make site-install\n"}.join('')}
-clean:
-#{sub_dirs.map{|d| "	@cd #{d}; make clean\n"}.join('')}
-distclean:	clean
-#{sub_dirs.map{|d| "	@cd #{d}; make distclean\n"}.join('')}
-	@rm -f Makefile extconf.h conftest.*
-	@rm -f core *~ mkmf.log
-END
+  if co and !objs.empty?
+    f.puts
+    objs.each do |obj|
+      f.puts "#{obj}: $(srcdir)/#{File.basename(obj).sub(/.o$/, '.c')}"
+      f.puts co
     end
   end
 end
 
-
-pkg = "cairo"
-modname = "cairo"
-srcdir = File.join(File.expand_path(File.dirname(__FILE__)), "src")
-major, minor, micro = 1, 2, 0
-
-PKGConfig.have_package(pkg, major, minor, micro) or exit 1
-
-setup_win32(File.basename(modname))
-create_makefile_at_srcdir(modname, srcdir, "-DRUBY_CAIRO_COMPILATION")
-
-create_top_makefile
+FileUtils.mkdir_p(ext_dir_name)



More information about the cairo-commit mailing list