[cairo-commit] rcairo ChangeLog,1.207,1.208 pkg-config.rb,1.6,1.7
Kouhei Sutou
commit at pdx.freedesktop.org
Thu Apr 3 05:19:52 PDT 2008
Committed by: kou
Update of /cvs/cairo/rcairo
In directory kemper:/tmp/cvs-serv19391
Modified Files:
ChangeLog pkg-config.rb
Log Message:
* pkg-config.rb, test/test_pkg_config.rb: support
--with-override-variables extconf.rb option.
Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/rcairo/ChangeLog,v
retrieving revision 1.207
retrieving revision 1.208
diff -u -d -r1.207 -r1.208
--- ChangeLog 31 Mar 2008 23:48:52 -0000 1.207
+++ ChangeLog 3 Apr 2008 12:23:56 -0000 1.208
@@ -1,3 +1,8 @@
+2008-04-03 Kouhei Sutou <kou at cozmixng.org>
+
+ * pkg-config.rb, test/test_pkg_config.rb: support
+ --with-override-variables extconf.rb option.
+
2008-04-01 Kouhei Sutou <kou at cozmixng.org>
* samples/text2.rb: don't use block variable assignment.
Index: pkg-config.rb
===================================================================
RCS file: /cvs/cairo/rcairo/pkg-config.rb,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- pkg-config.rb 4 Mar 2008 13:10:35 -0000 1.6
+++ pkg-config.rb 3 Apr 2008 12:23:56 -0000 1.7
@@ -13,6 +13,8 @@
@path = [@path, guess_default_path].compact.join(separator)
@msvc_syntax = msvc_syntax
@variables = @declarations = nil
+ override_variables = with_config("override-variables", "")
+ @override_variables = parse_override_variables(override_variables)
end
def exist?
@@ -68,6 +70,16 @@
declaration("Version")
end
+ def variable(name)
+ parse_pc if @variables.nil?
+ expand_value(@override_variables[name] || @variables[name])
+ end
+
+ def declaration(name)
+ parse_pc if @declarations.nil?
+ expand_value(@declarations[name])
+ end
+
private
def pc
@path.split(separator).each do |path|
@@ -81,16 +93,6 @@
File.expand_path(".").index(":") ? ";" : ":"
end
- def variable(name)
- parse_pc if @variables.nil?
- expand_value(@variables[name])
- end
-
- def declaration(name)
- parse_pc if @declarations.nil?
- expand_value(@declarations[name])
- end
-
def collect_cflags
all_cflags = (requires_private + requires.reverse).collect do |package|
self.class.new(package, @path, @msvc_syntax).cflags
@@ -129,6 +131,15 @@
requires_without_version.split(/[,\s]+/)
end
+ def parse_override_variables(override_variables)
+ variables = {}
+ override_variables.split(",").each do |variable|
+ name, value = variable.split("=", 2)
+ variables[name] = value
+ end
+ variables
+ end
+
def expand_value(value)
return nil if value.nil?
value.gsub(/\$\{(#{IDENTIFIER_RE})\}/) do
More information about the cairo-commit
mailing list