[cairo-commit] rcairo ChangeLog, 1.271, 1.272 pkg-config.rb, 1.16, 1.17 README, 1.23, 1.24

Kouhei Sutou commit at pdx.freedesktop.org
Fri Jun 20 01:48:58 PDT 2008


Committed by: kou

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

Modified Files:
	ChangeLog pkg-config.rb README 
Log Message:
* pkg-config.rb:
  - add /opt/local/lib/pkgconfig as default path.
  - improve default path guess.
  Suggested by Carsten Bormann. Thanks!!!

* README: add Carsten Bormann to thanks list. Thanks!!!


Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/rcairo/ChangeLog,v
retrieving revision 1.271
retrieving revision 1.272
diff -u -d -r1.271 -r1.272
--- ChangeLog	20 Jun 2008 02:08:47 -0000	1.271
+++ ChangeLog	20 Jun 2008 08:48:56 -0000	1.272
@@ -1,5 +1,12 @@
 2008-06-20  Kouhei Sutou  <kou at cozmixng.org>
 
+	* pkg-config.rb:
+	- add /opt/local/lib/pkgconfig as default path.
+	- improve default path guess.
+	Suggested by Carsten Bormann. Thanks!!!
+
+	* README: add Carsten Bormann to thanks list. Thanks!!!
+
 	* test/test_surface.rb: add.
 
 	* src/rb_cairo_surface.c (yield_and_finish): don't finish if it

Index: pkg-config.rb
===================================================================
RCS file: /cvs/cairo/rcairo/pkg-config.rb,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- pkg-config.rb	19 Jun 2008 08:34:20 -0000	1.16
+++ pkg-config.rb	20 Jun 2008 08:48:56 -0000	1.17
@@ -164,47 +164,65 @@
     end
   end
 
+  def search_pkg_config_from_path(pkg_config)
+    (ENV["PATH"] || "").split(separator).each do |path|
+      try_pkg_config = Pathname(path) + pkg_config
+      return try_pkg_config if try_pkg_config.exist?
+    end
+    nil
+  end
+
+  def search_pkg_config_by_dln_find_exe(pkg_config)
+    begin
+      require "dl/import"
+    rescue LoadError
+      return nil
+    end
+    dln = Module.new
+    dln.module_eval do
+      if DL.const_defined?(:Importer)
+        extend DL::Importer
+      else
+        extend DL::Importable
+      end
+      begin
+        dlload RbConfig::CONFIG["LIBRUBY"]
+      rescue RuntimeError
+        return nil if $!.message == "unknown error"
+        return nil if /: image not found\z/ =~ $!.message
+        raise
+      rescue DL::DLError
+        return nil
+      end
+      extern "const char *dln_find_exe(const char *, const char *)"
+    end
+    dln.dln_find_exe(pkg_config.to_s, ".")
+  end
+
   def guess_default_path
     default_path = ["/usr/local/lib64/pkgconfig",
                     "/usr/local/lib/pkgconfig",
+                    "/opt/local/lib/pkgconfig",
                     "/usr/lib64/pkgconfig",
                     "/usr/lib/pkgconfig",
-                    "/usr/share/pkgconfig"].join(":")
+                    "/usr/share/pkgconfig"].join(separator)
     libdir = ENV["PKG_CONFIG_LIBDIR"]
-    default_path = "#{libdir}:#{default_path}" if libdir
+    default_path = [libdir, default_path].join(separator) if libdir
+
     pkg_config = with_config("pkg-config", ENV["PKG_CONFIG"] || "pkg-config")
     pkg_config = Pathname.new(pkg_config)
     unless pkg_config.absolute?
-      begin
-        require "dl/import"
-      rescue LoadError
-        return default_path
-      end
-      dln = Module.new
-      dln.module_eval do
-        if DL.const_defined?(:Importer)
-          extend DL::Importer
-        else
-          extend DL::Importable
-        end
-        begin
-          dlload RbConfig::CONFIG["LIBRUBY"]
-        rescue RuntimeError
-          return default_path if $!.message == "unknown error"
-          return default_path if /: image not found\z/ =~ $!.message
-          raise
-        rescue DL::DLError
-          return default_path
-        end
-        extern "const char *dln_find_exe(const char *, const char *)"
-      end
-      pkg_config = dln.dln_find_exe(pkg_config.to_s, ".")
-      return default_path if pkg_config.nil?
-      return default_path if pkg_config.size.zero?
-      pkg_config = Pathname.new(pkg_config)
+      found_pkg_config = search_pkg_config_from_path(pkg_config)
+      pkg_config = found_pkg_config if found_pkg_config
+    end
+    unless pkg_config.absolute?
+      found_pkg_config = search_pkg_config_by_dln_find_exe(pkg_config)
+      pkg_config = found_pkg_config if found_pkg_config
     end
+
+    return default_path unless pkg_config.absolute?
     [(pkg_config.parent.parent + "lib" + "pkgconfig").to_s,
-     default_path].join(":")
+     default_path].join(separator)
   end
 end
 

Index: README
===================================================================
RCS file: /cvs/cairo/rcairo/README,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- README	19 Jun 2008 08:34:20 -0000	1.23
+++ README	20 Jun 2008 08:48:56 -0000	1.24
@@ -69,3 +69,4 @@
     - reports a bug.
   * OBATA Akio: reports a bug.
   * James Healy: reports bugs.
+  * Carsten Bormann: A suggestion.



More information about the cairo-commit mailing list