pkg-config 1.3.9 → 1.4.4

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: 026c6c256fc6bb3656cfcde885adcc911f26987d1ac26d48d87f724ebc4045a2
4
- data.tar.gz: 95cbb634f8f37a2dd5d6ef3b644a45f810c8ef99d834e9281402e50ce5233dde
3
+ metadata.gz: 58f40c4efe4e315db21fe3ce7c7e259d4224d1734972cf461296ccc02f8c66db
4
+ data.tar.gz: 31e2395b16ace3ccc5aeed7dd6882496345fc9a3d23eb49082b4875f78face11
5
5
  SHA512:
6
- metadata.gz: 64c6915207090a91ca6d24e4de7c34fb368d3c32c901e8b56c06c2fc0e275742658e05b29ee7477124cf4038eb6f8269abbf7712f1a538dfc9155d4976d7b048
7
- data.tar.gz: 5ff7d590b763b9b5c114887ec5ee32f311bdfad06da4c8e696bb1f129906b2f511a018d3508ce71dd69b1ff9bbc217fc596d7a2d0a9efaf1a0814d4ead86bb32
6
+ metadata.gz: 61e27036ff20e04388cab0f72f0a035bfd830aff868df6a1fd25bb68a885709c858ef0acce9b829b7924e307e8c768692e4e589c5c06efc3d7d866902900917a
7
+ data.tar.gz: 83747ac073b00b669671e64255a039190e947b1ad0c52770677d85d3ae6624968cd2ee975d0fcfdac1e31341bf2748a7bbe430d0a9502312248478e2249206e7
data/NEWS CHANGED
@@ -1,5 +1,49 @@
1
1
  = NEWS
2
2
 
3
+ == 1.4.4 - 2020-09-23
4
+
5
+ === Fixes
6
+
7
+ * Fixed a bug that NoMethodError instead of
8
+ PackageConfig::NotFoundError is raised.
9
+ [Fixed by kojix2][GitHub#21]
10
+
11
+ === Thanks
12
+
13
+ * kojix2
14
+
15
+ == 1.4.3 - 2020-09-15
16
+
17
+ === Improvements
18
+
19
+ * Changed to use PackageConfig::NotFoundError instead of RuntimeError
20
+ for exception on no .pc is found.
21
+
22
+ == 1.4.2 - 2020-08-10
23
+
24
+ === Improvements
25
+
26
+ * Added support for detecting pkgconfig path on RubyInstaller
27
+ without "ridk exec".
28
+
29
+ == 1.4.1 - 2020-02-10
30
+
31
+ === Improvements
32
+
33
+ * Added support for cycled depended .pc such as freetype2.pc and
34
+ harfbuzz.pc on PLD Linux.
35
+ [Reported by Jakub Bogusz]
36
+
37
+ === Thanks
38
+
39
+ * Jakub Bogusz
40
+
41
+ == 1.4.0 - 2019-10-24
42
+
43
+ === Improvements
44
+
45
+ * Improved Homebrew detection.
46
+
3
47
  == 1.3.9 - 2019-09-28
4
48
 
5
49
  === Improvements
@@ -8,17 +8,13 @@ pkg-config
8
8
 
9
9
  A pkg-config implementation by Ruby.
10
10
 
11
- == Dependencies
12
-
13
- * ruby >= 1.8 (1.9.2 is also supported!)
14
-
15
11
  == Install
16
12
 
17
13
  # gem install pkg-config
18
14
 
19
15
  == Documents
20
16
 
21
- * TODO
17
+ * https://rubydoc.info/gems/pkg-config
22
18
 
23
19
  == Source
24
20
 
@@ -27,7 +23,7 @@ http://github.com/ruby-gnome/pkg-config
27
23
 
28
24
  == Copyright
29
25
 
30
- Copyright 2008-2019 Kouhei Sutou <kou@clear-code.com>
26
+ Copyright 2008-2020 Kouhei Sutou <kou@clear-code.com>
31
27
 
32
28
  This library is free software; you can redistribute it and/or
33
29
  modify it under the terms of the GNU Lesser General Public
@@ -45,10 +41,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
45
41
 
46
42
  See LGPL-2.1 file for details.
47
43
 
48
- == Mailing list
49
-
50
- TODO
51
-
52
44
  == Thanks
53
45
 
54
46
  * Funky Bibimbap
@@ -1,4 +1,4 @@
1
- # Copyright 2008-2019 Kouhei Sutou <kou@cozmixng.org>
1
+ # Copyright 2008-2020 Sutou Kouhei <kou@cozmixng.org>
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -15,17 +15,22 @@
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
  begin
18
- require "pkg-config/version"
18
+ require_relative "pkg-config/version"
19
19
  rescue LoadError
20
20
  end
21
21
 
22
+ require "English"
23
+ require "pathname"
22
24
  require "rbconfig"
23
-
24
- require 'shellwords'
25
- require 'English'
26
- require 'pathname'
25
+ require "shellwords"
27
26
 
28
27
  class PackageConfig
28
+ class Error < StandardError
29
+ end
30
+
31
+ class NotFoundError < Error
32
+ end
33
+
29
34
  SEPARATOR = File::PATH_SEPARATOR
30
35
 
31
36
  class << self
@@ -122,6 +127,7 @@ class PackageConfig
122
127
  def compute_native_pkg_config_prefix
123
128
  pkg_config = native_pkg_config
124
129
  return nil unless pkg_config.absolute?
130
+ return nil unless pkg_config.exist?
125
131
 
126
132
  pkg_config_prefix = pkg_config.parent.parent
127
133
  if File::ALT_SEPARATOR
@@ -248,13 +254,15 @@ class PackageConfig
248
254
  @path_position
249
255
  end
250
256
 
251
- def collect_requires(&block)
257
+ def collect_requires(processed_packages={}, &block)
252
258
  packages = []
253
259
  targets = yield(self)
254
260
  targets.each do |name|
261
+ next if processed_packages.key?(name)
255
262
  package = self.class.new(name, @options)
263
+ processed_packages[name] = package
256
264
  packages << package
257
- packages.concat(package.collect_requires(&block))
265
+ packages.concat(package.collect_requires(processed_packages, &block))
258
266
  end
259
267
  packages_without_self = packages.reject do |package|
260
268
  package.name == @name
@@ -357,7 +365,7 @@ class PackageConfig
357
365
  all_flags = {}
358
366
  flags = []
359
367
  in_option = false
360
- libs_command_line.gsub(/-([Ll]) /, '\1').split.each do |arg|
368
+ libs_command_line.gsub(/-([Ll]) /, "\\1").split.each do |arg|
361
369
  if in_option
362
370
  flags << arg
363
371
  in_option = false
@@ -378,12 +386,12 @@ class PackageConfig
378
386
 
379
387
  IDENTIFIER_RE = /[a-zA-Z\d_\.]+/
380
388
  def parse_pc
381
- raise ".pc for #{@name} doesn't exist." unless exist?
389
+ raise NotFoundError, ".pc doesn't exist: <#{@name}>" unless exist?
382
390
  @variables = {}
383
391
  @declarations = {}
384
392
  File.open(pc_path) do |input|
385
393
  input.each_line do |line|
386
- line = line.gsub(/#.*/, '').strip
394
+ line = line.gsub(/#.*/, "").strip
387
395
  next if line.empty?
388
396
  case line
389
397
  when /^(#{IDENTIFIER_RE})=/
@@ -397,7 +405,7 @@ class PackageConfig
397
405
 
398
406
  def parse_requires(requires)
399
407
  return [] if requires.nil?
400
- requires_without_version = requires.gsub(/[<>]?=\s*[\d.a-zA-Z_-]+\s*/, '')
408
+ requires_without_version = requires.gsub(/[<>]?=\s*[\d.a-zA-Z_-]+\s*/, "")
401
409
  requires_without_version.split(/[,\s]+/)
402
410
  end
403
411
 
@@ -437,6 +445,11 @@ class PackageConfig
437
445
  "/opt/X11/lib/pkgconfig",
438
446
  "/usr/share/pkgconfig",
439
447
  ]
448
+ if Object.const_defined?(:RubyInstaller)
449
+ mingw_bin_path = RubyInstaller::Runtime.msys2_installation.mingw_bin_path
450
+ mingw_pkgconfig_path = Pathname.new(mingw_bin_path) + "../lib/pkgconfig"
451
+ default_paths.unshift(mingw_pkgconfig_path.cleanpath.to_s)
452
+ end
440
453
  libdir = ENV["PKG_CONFIG_LIBDIR"]
441
454
  default_paths.unshift(libdir) if libdir
442
455
 
@@ -465,14 +478,13 @@ class PackageConfig
465
478
  homebrew_repository_candidates << pkg_config_prefix + "Homebrew"
466
479
  homebrew_repository_candidates << pkg_config_prefix
467
480
  end
468
- else
469
- brew = self.class.__send__(:search_executable_from_path, "brew")
470
- if brew
471
- homebrew_repository = `brew --repository`.chomp
472
- homebrew_repository_candidates << Pathname(homebrew_repository)
473
- end
474
481
  end
475
- homebrew_repository_candidates.each do |candidate|
482
+ brew = self.class.__send__(:search_executable_from_path, "brew")
483
+ if brew
484
+ homebrew_repository = `brew --repository`.chomp
485
+ homebrew_repository_candidates << Pathname(homebrew_repository)
486
+ end
487
+ homebrew_repository_candidates.uniq.each do |candidate|
476
488
  path = candidate + "Library/Homebrew/os/mac/pkgconfig/#{mac_os_version}"
477
489
  paths << path.to_s if path.exist?
478
490
  end
@@ -514,7 +526,7 @@ module PKGConfig
514
526
  end
515
527
 
516
528
  def msvc?
517
- /mswin/.match(RUBY_PLATFORM) and /^cl\b/.match(RbConfig::CONFIG['CC'])
529
+ /mswin/.match(RUBY_PLATFORM) and /^cl\b/.match(RbConfig::CONFIG["CC"])
518
530
  end
519
531
 
520
532
  def package_config(package)
@@ -589,18 +601,18 @@ module PKGConfig
589
601
  dldflags = libs(pkg)
590
602
  dldflags = (Shellwords.shellwords(dldflags) -
591
603
  Shellwords.shellwords(libraries))
592
- dldflags = dldflags.map {|s| /\s/ =~ s ? "\"#{s}\"" : s }.join(' ')
593
- $libs += ' ' + libraries
604
+ dldflags = dldflags.map {|s| /\s/ =~ s ? "\"#{s}\"" : s }.join(" ")
605
+ $libs += " " + libraries
594
606
  if /mswin/ =~ RUBY_PLATFORM
595
- $DLDFLAGS += ' ' + dldflags
607
+ $DLDFLAGS += " " + dldflags
596
608
  else
597
- $LDFLAGS += ' ' + dldflags
609
+ $LDFLAGS += " " + dldflags
598
610
  end
599
- $CFLAGS += ' ' + cflags_only_other(pkg)
611
+ $CFLAGS += " " + cflags_only_other(pkg)
600
612
  if defined?($CXXFLAGS)
601
- $CXXFLAGS += ' ' + cflags_only_other(pkg)
613
+ $CXXFLAGS += " " + cflags_only_other(pkg)
602
614
  end
603
- $INCFLAGS += ' ' + cflags_only_I(pkg)
615
+ $INCFLAGS += " " + cflags_only_I(pkg)
604
616
  end
605
617
  enough_version
606
618
  end
@@ -1,4 +1,4 @@
1
- # Copyright 2012-2019 Kouhei Sutou <kou@cozmixng.org>
1
+ # Copyright 2012-2020 Sutou Kouhei <kou@cozmixng.org>
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -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.9"
18
+ VERSION = "1.4.4"
19
19
  end
@@ -6,9 +6,6 @@ base_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
6
6
  lib_dir = File.join(base_dir, "lib")
7
7
  test_dir = File.join(base_dir, "test")
8
8
 
9
- ENV["BUNDLE_GEMFILE"] ||= File.join(base_dir, "Gemfile")
10
- require "bundler/setup"
11
-
12
9
  require 'test-unit'
13
10
 
14
11
  $LOAD_PATH.unshift(lib_dir)
@@ -17,10 +17,10 @@ class PkgConfigTest < Test::Unit::TestCase
17
17
  end
18
18
 
19
19
  def test_exist?
20
- assert(system('pkg-config --exists cairo'))
20
+ assert(system("pkg-config --exists cairo"))
21
21
  assert(@cairo.exist?)
22
22
 
23
- assert(system('pkg-config --exists cairo-png'))
23
+ assert(system("pkg-config --exists cairo-png"))
24
24
  assert(@cairo_png.exist?)
25
25
  end
26
26
 
@@ -94,7 +94,7 @@ class PkgConfigTest < Test::Unit::TestCase
94
94
  @cairo.msvc_syntax = true
95
95
  result = pkg_config("cairo", "--libs")
96
96
  msvc_result = result.gsub(/-lcairo\b/, "cairo.lib")
97
- msvc_result = msvc_result.gsub(/-L/, '/libpath:')
97
+ msvc_result = msvc_result.gsub(/-L/, "/libpath:")
98
98
  assert_not_equal(msvc_result, result)
99
99
  assert_equal(msvc_result, @cairo.libs)
100
100
  end
@@ -107,7 +107,7 @@ class PkgConfigTest < Test::Unit::TestCase
107
107
  def test_libs_only_l_msvc
108
108
  @cairo_png.msvc_syntax = true
109
109
  result = pkg_config("cairo-png", "--libs-only-l")
110
- msvc_result = result.gsub(/-l(cairo|png[0-9]+|z)\b/, '\1.lib')
110
+ msvc_result = result.gsub(/-l(cairo|png[0-9]+|z)\b/, "\\1.lib")
111
111
  assert_not_equal(msvc_result, result)
112
112
  assert_equal(msvc_result, @cairo_png.libs_only_l)
113
113
  end
@@ -120,7 +120,7 @@ class PkgConfigTest < Test::Unit::TestCase
120
120
  def test_libs_only_L_msvc
121
121
  @cairo_png.msvc_syntax = true
122
122
  result = pkg_config("cairo-png", "--libs-only-L")
123
- msvc_result = result.gsub(/-L/, '/libpath:')
123
+ msvc_result = result.gsub(/-L/, "/libpath:")
124
124
  assert_not_equal(msvc_result, result)
125
125
  assert_equal(msvc_result, @cairo_png.libs_only_L)
126
126
  end
@@ -164,10 +164,17 @@ class PkgConfigTest < Test::Unit::TestCase
164
164
  end
165
165
  end
166
166
 
167
+ def test_not_found
168
+ message = ".pc doesn't exist: <nonexistent>"
169
+ assert_raise(PackageConfig::NotFoundError.new(message)) do
170
+ PKGConfig.modversion("nonexistent")
171
+ end
172
+ end
173
+
167
174
  private
168
175
  def pkg_config(package, *args)
169
176
  args.unshift("--define-variable=libdir=#{@custom_libdir}")
170
- args = args.collect {|arg| arg.dump}.join(' ')
177
+ args = args.collect {|arg| arg.dump}.join(" ")
171
178
  `pkg-config #{args} #{package}`.strip
172
179
  end
173
180
 
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.9
4
+ version: 1.4.4
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-09-27 00:00:00.000000000 Z
11
+ date: 2020-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit
@@ -68,7 +68,7 @@ files:
68
68
  - lib/pkg-config.rb
69
69
  - lib/pkg-config/version.rb
70
70
  - test/run-test.rb
71
- - test/test_pkg_config.rb
71
+ - test/test-pkg-config.rb
72
72
  homepage: https://github.com/ruby-gnome/pkg-config
73
73
  licenses:
74
74
  - LGPLv2+
@@ -89,11 +89,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  requirements: []
92
- rubyforge_project:
93
- rubygems_version: 2.7.6.2
92
+ rubygems_version: 3.2.0.rc.1
94
93
  signing_key:
95
94
  specification_version: 4
96
95
  summary: A pkg-config implementation for Ruby
97
96
  test_files:
98
97
  - test/run-test.rb
99
- - test/test_pkg_config.rb
98
+ - test/test-pkg-config.rb