pkg-config 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/NEWS +4 -0
  2. data/lib/pkg-config.rb +18 -4
  3. data/test/test_pkg_config.rb +17 -2
  4. metadata +3 -3
data/NEWS CHANGED
@@ -1,5 +1,9 @@
1
1
  = NEWS
2
2
 
3
+ == 1.0.6 - 2010/09/23
4
+
5
+ * add PKGConfig.libs_only_L.
6
+
3
7
  == 1.0.5 - 2010/09/23
4
8
 
5
9
  * suppress duplicated configure arguments processing.
data/lib/pkg-config.rb CHANGED
@@ -123,7 +123,7 @@ class PackageConfig
123
123
 
124
124
  def cflags
125
125
  path_flags, other_flags = collect_cflags
126
- (other_flags + path_flags).join(" ")
126
+ (path_flags + other_flags).join(" ")
127
127
  end
128
128
 
129
129
  def cflags_only_I
@@ -132,7 +132,7 @@ class PackageConfig
132
132
 
133
133
  def libs
134
134
  path_flags, other_flags = collect_libs
135
- (other_flags + path_flags).join(" ")
135
+ (path_flags + other_flags).join(" ")
136
136
  end
137
137
 
138
138
  def libs_only_l
@@ -145,6 +145,16 @@ class PackageConfig
145
145
  end.join(" ")
146
146
  end
147
147
 
148
+ def libs_only_L
149
+ collect_libs[0].find_all do |arg|
150
+ if @msvc_syntax
151
+ /\A\/libpath:/ =~ arg
152
+ else
153
+ /\A-L/ =~ arg
154
+ end
155
+ end.join(" ")
156
+ end
157
+
148
158
  def version
149
159
  declaration("Version")
150
160
  end
@@ -277,7 +287,7 @@ class PackageConfig
277
287
  end
278
288
 
279
289
  module PKGConfig
280
- VERSION = "1.0.5"
290
+ VERSION = "1.0.6"
281
291
 
282
292
  @@paths = []
283
293
  @@override_variables = {}
@@ -314,6 +324,10 @@ module PKGConfig
314
324
  package_config(pkg).libs_only_l
315
325
  end
316
326
 
327
+ def libs_only_L(pkg)
328
+ package_config(pkg).libs_only_L
329
+ end
330
+
317
331
  def cflags(pkg)
318
332
  package_config(pkg).cflags
319
333
  end
@@ -348,7 +362,7 @@ module PKGConfig
348
362
  def have_package(pkg, major = nil, minor = 0, micro = 0)
349
363
  message = "#{pkg}"
350
364
  unless major.nil?
351
- message << "version (>= #{major}.#{minor}.#{micro})"
365
+ message << " version (>= #{major}.#{minor}.#{micro})"
352
366
  end
353
367
  major ||= 0
354
368
  enough_version = checking_for(checking_message(message)) do
@@ -2,8 +2,10 @@ require 'pkg-config'
2
2
 
3
3
  class PkgConfigTest < Test::Unit::TestCase
4
4
  def setup
5
- @cairo = PackageConfig.new("cairo")
6
- @cairo_png = PackageConfig.new("cairo-png")
5
+ @custom_libdir = "/tmp/local/lib"
6
+ options = {:override_variables => {"libdir" => @custom_libdir}}
7
+ @cairo = PackageConfig.new("cairo", options)
8
+ @cairo_png = PackageConfig.new("cairo-png", options)
7
9
  end
8
10
 
9
11
  def test_exist?
@@ -31,6 +33,7 @@ class PkgConfigTest < Test::Unit::TestCase
31
33
  @cairo.msvc_syntax = true
32
34
  result = pkg_config("cairo", "--libs")
33
35
  msvc_result = result.gsub(/-lcairo\b/, "cairo.lib")
36
+ msvc_result = msvc_result.gsub(/-L/, '/libpath:')
34
37
  assert_not_equal(msvc_result, result)
35
38
  assert_equal(msvc_result, @cairo.libs)
36
39
  end
@@ -46,6 +49,17 @@ class PkgConfigTest < Test::Unit::TestCase
46
49
  assert_equal(msvc_result, @cairo_png.libs_only_l)
47
50
  end
48
51
 
52
+ def test_libs_only_L
53
+ assert_pkg_config("cairo", ["--libs-only-L"], @cairo.libs_only_L)
54
+ assert_pkg_config("cairo-png", ["--libs-only-L"], @cairo_png.libs_only_L)
55
+
56
+ @cairo_png.msvc_syntax = true
57
+ result = pkg_config("cairo-png", "--libs-only-L")
58
+ msvc_result = result.gsub(/-L/, '/libpath:')
59
+ assert_not_equal(msvc_result, result)
60
+ assert_equal(msvc_result, @cairo_png.libs_only_L)
61
+ end
62
+
49
63
  def test_requires
50
64
  assert_equal([], @cairo.requires)
51
65
  end
@@ -85,6 +99,7 @@ class PkgConfigTest < Test::Unit::TestCase
85
99
 
86
100
  private
87
101
  def pkg_config(package, *args)
102
+ args.unshift("--define-variable=libdir=#{@custom_libdir}")
88
103
  args = args.collect {|arg| arg.dump}.join(' ')
89
104
  `pkg-config #{args} #{package}`.strip
90
105
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pkg-config
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 5
10
- version: 1.0.5
9
+ - 6
10
+ version: 1.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kouhei Sutou