[前][次][番号順一覧][スレッド一覧]

ruby-changes:28166

From: naruse <ko1@a...>
Date: Thu, 11 Apr 2013 06:15:50 +0900 (JST)
Subject: [ruby-changes:28166] naruse:r40218 (trunk): * lib/mkmf.rb (pkg_config): Add optional argument "option".

naruse	2013-04-11 06:15:32 +0900 (Thu, 11 Apr 2013)

  New Revision: 40218

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40218

  Log:
    * lib/mkmf.rb (pkg_config): Add optional argument "option".
      If it is given, it returns the result of
      `pkg-config --<option> <pkgname>`.

  Modified files:
    trunk/ChangeLog
    trunk/lib/mkmf.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40217)
+++ ChangeLog	(revision 40218)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Apr 11 05:30:43 2013  NARUSE, Yui  <naruse@r...>
+
+	* lib/mkmf.rb (pkg_config): Add optional argument "option".
+	  If it is given, it returns the result of
+	  `pkg-config --<option> <pkgname>`.
+
 Thu Apr 11 03:33:05 2013  NARUSE, Yui  <naruse@r...>
 
 	* ext/fiddle/closure.c (initialize): check mprotect's return value.
Index: lib/mkmf.rb
===================================================================
--- lib/mkmf.rb	(revision 40217)
+++ lib/mkmf.rb	(revision 40218)
@@ -1722,7 +1722,7 @@ SRC https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L1722
   #
   # The actual command name can be overridden by
   # <code>--with-pkg-config</code> command line option.
-  def pkg_config(pkg)
+  def pkg_config(pkg, option=nil)
     if pkgconfig = with_config("#{pkg}-config") and find_executable0(pkgconfig)
       # iff package specific config command is given
       get = proc {|opt| `#{pkgconfig} --#{opt}`.strip}
@@ -1736,7 +1736,9 @@ SRC https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L1736
       # default to package specific config command, as a last resort.
       get = proc {|opt| `#{pkgconfig} --#{opt}`.strip}
     end
-    if get and try_ldflags(ldflags = get['libs'])
+    if get and option
+      get[option]
+    elsif get and try_ldflags(ldflags = get['libs'])
       cflags = get['cflags']
       libs = get['libs-only-l']
       ldflags = (Shellwords.shellwords(ldflags) - Shellwords.shellwords(libs)).quote.join(" ")

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]