pkg-config 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/NEWS +4 -0
- data/lib/pkg-config.rb +18 -4
- data/test/test_pkg_config.rb +17 -2
- metadata +3 -3
data/NEWS
CHANGED
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
|
-
(
|
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
|
-
(
|
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.
|
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
|
data/test/test_pkg_config.rb
CHANGED
@@ -2,8 +2,10 @@ require 'pkg-config'
|
|
2
2
|
|
3
3
|
class PkgConfigTest < Test::Unit::TestCase
|
4
4
|
def setup
|
5
|
-
@
|
6
|
-
|
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:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 6
|
10
|
+
version: 1.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kouhei Sutou
|