1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/mkmf.rb (pkg_config): Add optional argument "option".

If it is given, it returns the result of
  `pkg-config --<option> <pkgname>`.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2013-04-10 21:15:32 +00:00
parent e79d4b363c
commit c607493e48
2 changed files with 10 additions and 2 deletions

View file

@ -1,3 +1,9 @@
Thu Apr 11 05:30:43 2013 NARUSE, Yui <naruse@ruby-lang.org>
* 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@ruby-lang.org>
* ext/fiddle/closure.c (initialize): check mprotect's return value.

View file

@ -1722,7 +1722,7 @@ SRC
#
# 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
# 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(" ")