pkg-config 1.3.8 → 1.3.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a47d4bf798e1d6eb5ad3c16fad3ab29dead0f05b2d41e39d98ecb3b3642ac6ea
4
- data.tar.gz: 3ca7a21d13ffba40247e65134cbac57a07690c69312898af8e29fd5394616293
3
+ metadata.gz: 026c6c256fc6bb3656cfcde885adcc911f26987d1ac26d48d87f724ebc4045a2
4
+ data.tar.gz: 95cbb634f8f37a2dd5d6ef3b644a45f810c8ef99d834e9281402e50ce5233dde
5
5
  SHA512:
6
- metadata.gz: 21d73b0dd4803571c903e01410c1d199297af2d3c17a5254197511285f1f1807875c70d819e06cc1b28a6158c715111be694aae997799432af1eb4c41e657aaf
7
- data.tar.gz: 31a9e5bae18a521b65c6ba3b82cffb3197cd076e0318682b44b2f71c65dbd80fe40369ba09125ed3a4b2ad2ce1b9c39a11237922e798583fe94ed060bb329e06
6
+ metadata.gz: 64c6915207090a91ca6d24e4de7c34fb368d3c32c901e8b56c06c2fc0e275742658e05b29ee7477124cf4038eb6f8269abbf7712f1a538dfc9155d4976d7b048
7
+ data.tar.gz: 5ff7d590b763b9b5c114887ec5ee32f311bdfad06da4c8e696bb1f129906b2f511a018d3508ce71dd69b1ff9bbc217fc596d7a2d0a9efaf1a0814d4ead86bb32
data/NEWS CHANGED
@@ -1,5 +1,16 @@
1
1
  = NEWS
2
2
 
3
+ == 1.3.9 - 2019-09-28
4
+
5
+ === Improvements
6
+
7
+ * Added support for absolute path in Requires.
8
+ [GitHub#18][Reported by Josh Huckabee]
9
+
10
+ === Thanks
11
+
12
+ * Josh Huckabee
13
+
3
14
  == 1.3.8 - 2019-08-13
4
15
 
5
16
  === Improvements
@@ -14,14 +14,8 @@ A pkg-config implementation by Ruby.
14
14
 
15
15
  == Install
16
16
 
17
- === Package
18
-
19
17
  # gem install pkg-config
20
18
 
21
- === No package
22
-
23
- # ruby setup.rb
24
-
25
19
  == Documents
26
20
 
27
21
  * TODO
@@ -29,11 +23,11 @@ A pkg-config implementation by Ruby.
29
23
  == Source
30
24
 
31
25
  There is the pkg-config repository at GitHub:
32
- http://github.com/rcairo/pkg-config
26
+ http://github.com/ruby-gnome/pkg-config
33
27
 
34
28
  == Copyright
35
29
 
36
- Copyright 2008-2011 Kouhei Sutou <kou@clear-code.com>
30
+ Copyright 2008-2019 Kouhei Sutou <kou@clear-code.com>
37
31
 
38
32
  This library is free software; you can redistribute it and/or
39
33
  modify it under the terms of the GNU Lesser General Public
@@ -134,10 +134,19 @@ class PackageConfig
134
134
  end
135
135
  end
136
136
 
137
+ attr_reader :name
137
138
  attr_reader :paths
138
139
  attr_accessor :msvc_syntax
139
140
  def initialize(name, options={})
140
- @name = name
141
+ if Pathname(name).absolute?
142
+ @pc_path = name
143
+ @path_position = 0
144
+ @name = File.basename(@pc_path, ".*")
145
+ else
146
+ @pc_path = nil
147
+ @path_position = nil
148
+ @name = name
149
+ end
141
150
  @options = options
142
151
  path = @options[:path] || ENV["PKG_CONFIG_PATH"]
143
152
  @paths = [path, guess_default_path].compact.join(SEPARATOR).split(SEPARATOR)
@@ -220,29 +229,61 @@ class PackageConfig
220
229
  end
221
230
 
222
231
  def pc_path
223
- @paths.each do |path|
224
- _pc_path = File.join(path, "#{@name}.pc")
225
- return _pc_path if File.exist?(_pc_path)
232
+ if @pc_path
233
+ return @pc_path if File.exist?(@pc_path)
234
+ else
235
+ @paths.each_with_index do |path, i|
236
+ _pc_path = File.join(path, "#{@name}.pc")
237
+ if File.exist?(_pc_path)
238
+ @path_position = i + 1
239
+ return _pc_path
240
+ end
241
+ end
226
242
  end
227
243
  nil
228
244
  end
229
245
 
246
+ protected
247
+ def path_position
248
+ @path_position
249
+ end
250
+
251
+ def collect_requires(&block)
252
+ packages = []
253
+ targets = yield(self)
254
+ targets.each do |name|
255
+ package = self.class.new(name, @options)
256
+ packages << package
257
+ packages.concat(package.collect_requires(&block))
258
+ end
259
+ packages_without_self = packages.reject do |package|
260
+ package.name == @name
261
+ end
262
+ packages_without_self.uniq do |package|
263
+ package.name
264
+ end
265
+ end
266
+
230
267
  private
231
- def collect_cflags
232
- cflags_set = [declaration("Cflags")]
233
- cflags_set += private_required_packages.collect do |package|
234
- self.class.new(package, @options).cflags
268
+ def sort_packages(packages)
269
+ packages.sort_by.with_index do |package, i|
270
+ [package.path_position, i]
235
271
  end
236
- cflags_set += required_packages.collect do |package|
237
- self.class.new(package, @options).cflags
272
+ end
273
+
274
+ def collect_cflags
275
+ target_packages = sort_packages([self, *all_required_packages])
276
+ cflags_set = []
277
+ target_packages.each do |package|
278
+ cflags_set << package.declaration("Cflags")
238
279
  end
239
280
  all_cflags = normalize_cflags(Shellwords.split(cflags_set.join(" ")))
240
281
  path_flags, other_flags = all_cflags.partition {|flag| /\A-I/ =~ flag}
241
282
  path_flags = normalize_path_flags(path_flags, "-I")
242
- path_flags = remove_duplicated_include_paths(path_flags)
243
283
  path_flags = path_flags.reject do |flag|
244
284
  flag == "-I/usr/include"
245
285
  end
286
+ path_flags = path_flags.uniq
246
287
  if @msvc_syntax
247
288
  path_flags = path_flags.collect do |flag|
248
289
  flag.gsub(/\A-I/, "/I")
@@ -284,21 +325,19 @@ class PackageConfig
284
325
  normalized_cflags
285
326
  end
286
327
 
287
- def remove_duplicated_include_paths(path_flags)
288
- path_flags.uniq
289
- end
290
-
291
328
  def collect_libs
292
- all_libs = required_packages.collect do |package|
293
- self.class.new(package, @options).libs
329
+ target_packages = sort_packages(required_packages + [self])
330
+ libs_set = []
331
+ target_packages.each do |package|
332
+ libs_set << package.declaration("Libs")
294
333
  end
295
- all_libs = [declaration("Libs")] + all_libs
296
- all_flags = split_lib_flags(all_libs.join(" "))
334
+ all_flags = split_lib_flags(libs_set.join(" "))
297
335
  path_flags, other_flags = all_flags.partition {|flag| /\A-L/ =~ flag}
298
336
  path_flags = normalize_path_flags(path_flags, "-L")
299
337
  path_flags = path_flags.reject do |flag|
300
338
  /\A-L\/usr\/lib(?:64|x32)?\z/ =~ flag
301
339
  end
340
+ path_flags = path_flags.uniq
302
341
  if @msvc_syntax
303
342
  path_flags = path_flags.collect do |flag|
304
343
  flag.gsub(/\A-L/, "/libpath:")
@@ -443,21 +482,15 @@ class PackageConfig
443
482
  end
444
483
 
445
484
  def required_packages
446
- requires.reject do |package|
447
- @name == package
448
- end.uniq
449
- end
450
-
451
- def private_required_packages
452
- requires_private.reject do |package|
453
- @name == package
454
- end.uniq
485
+ collect_requires do |package|
486
+ package.requires
487
+ end
455
488
  end
456
489
 
457
490
  def all_required_packages
458
- (requires_private + requires.reverse).reject do |package|
459
- @name == package
460
- end.uniq
491
+ collect_requires do |package|
492
+ package.requires_private + package.requires
493
+ end
461
494
  end
462
495
 
463
496
  def normalize_paths(paths)
@@ -15,5 +15,5 @@
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
  module PKGConfig
18
- VERSION = "1.3.8"
18
+ VERSION = "1.3.9"
19
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pkg-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.8
4
+ version: 1.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-13 00:00:00.000000000 Z
11
+ date: 2019-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit
@@ -69,7 +69,7 @@ files:
69
69
  - lib/pkg-config/version.rb
70
70
  - test/run-test.rb
71
71
  - test/test_pkg_config.rb
72
- homepage: https://github.com/ruby-gnome2/pkg-config
72
+ homepage: https://github.com/ruby-gnome/pkg-config
73
73
  licenses:
74
74
  - LGPLv2+
75
75
  metadata: