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

ruby-changes:35376

From: nobu <ko1@a...>
Date: Tue, 9 Sep 2014 09:27:39 +0900 (JST)
Subject: [ruby-changes:35376] nobu:r47458 (trunk): mkmf.rb: -I flags to $INCFLAGS

nobu	2014-09-09 09:27:34 +0900 (Tue, 09 Sep 2014)

  New Revision: 47458

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

  Log:
    mkmf.rb: -I flags to $INCFLAGS
    
    * lib/mkmf.rb (MakeMakefile#pkg_config): separate -I flags to
      $INCFLAGS, which is used by CPP.

  Modified files:
    trunk/lib/mkmf.rb
Index: lib/mkmf.rb
===================================================================
--- lib/mkmf.rb	(revision 47457)
+++ lib/mkmf.rb	(revision 47458)
@@ -1759,22 +1759,37 @@ SRC https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L1759
   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}
     elsif ($PKGCONFIG ||=
            (pkgconfig = with_config("pkg-config", ("pkg-config" unless CROSS_COMPILING))) &&
            find_executable0(pkgconfig) && pkgconfig) and
         system("#{$PKGCONFIG} --exists #{pkg}")
       # default to pkg-config command
-      get = proc {|opt| `#{$PKGCONFIG} --#{opt} #{pkg}`.strip}
+      pkgconfig = $PKGCONFIG
+      get = proc {|opt|
+        opt = IO.popen("#{$PKGCONFIG} --#{opt} #{pkg}", err:[:child, :out], &:read)
+        opt.strip if $?.success?
+      }
     elsif find_executable0(pkgconfig = "#{pkg}-config")
       # default to package specific config command, as a last resort.
-      get = proc {|opt| `#{pkgconfig} --#{opt}`.strip}
+    else
+      pkgconfig = nil
+    end
+    if pkgconfig
+      get ||= proc {|opt|
+        opt = IO.popen("#{pkgconfig} --#{opt}", err:[:child, :out], &:read)
+        opt.strip if $?.success?
+      }
     end
     orig_ldflags = $LDFLAGS
     if get and option
       get[option]
     elsif get and try_ldflags(ldflags = get['libs'])
-      cflags = get['cflags']
+      if incflags = get['cflags-only-I']
+        $INCFLAGS << " " << incflags
+        cflags = get['cflags-only-other']
+      else
+        cflags = get['cflags']
+      end
       libs = get['libs-only-l']
       ldflags = (Shellwords.shellwords(ldflags) - Shellwords.shellwords(libs)).quote.join(" ")
       $CFLAGS += " " << cflags

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

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