pkg-config 1.4.0 → 1.4.5

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: a83385090e3b6e095368c03006b2c5acd72667ceb0b906f21e5fe0b3a1becf2e
4
- data.tar.gz: 41816b28d440895d76ce10c57c64e323109a893a01a51a0011441dbb8205794f
3
+ metadata.gz: c534d5c0df96e67e72a0571920884897446ee0f744a16396826c97556bad064d
4
+ data.tar.gz: 3f98e05ee7a23b4e849caf6fe122b9efd25da4dd905cbe12bd2885333c679156
5
5
  SHA512:
6
- metadata.gz: eee27aa9f295b5f2d3570c1b2caa45790be5d4870c294db31cfeeebc52b512c24ccc8d4a7b406bcb9b189960ba5ddb17b9b17c34f2445517a374dd6acd140e80
7
- data.tar.gz: 5fcace2bbadde0b6dc0f33eba70a90c587dbc339a60637f0020b9bbddc7615332aa40d55b19d52603c5575abbf40c538d0c4c00146bb904a2261d7517687de5b
6
+ metadata.gz: a1974ba13aa57590a7608a0baded10dd18f22dde4a0c242c81d1adba0dd1809bd2ec03fa3fdb03e57bb63acc94957a14da856b048baf4aa41eca38a98e37d61e
7
+ data.tar.gz: 40383987f314bacb2e8e9d39fca02bd0f9f4b60c1670fc7270e9757f6836bbd2c84001f07329882ef0713381e91054bf10bd06edea51b0fdb8e0eb3f97481ab4
data/NEWS CHANGED
@@ -1,5 +1,54 @@
1
1
  = NEWS
2
2
 
3
+ == 1.4.5 - 2021-02-04
4
+
5
+ === Improvements
6
+
7
+ * Added support for macOS 11.2.
8
+ [Reported by Ludovic Moutury][GitHub:rcairo/rcairo#69]
9
+
10
+ === Thanks
11
+
12
+ * Ludovic Moutury
13
+
14
+ == 1.4.4 - 2020-09-23
15
+
16
+ === Fixes
17
+
18
+ * Fixed a bug that NoMethodError instead of
19
+ PackageConfig::NotFoundError is raised.
20
+ [GitHub#21][Fixed by kojix2]
21
+
22
+ === Thanks
23
+
24
+ * kojix2
25
+
26
+ == 1.4.3 - 2020-09-15
27
+
28
+ === Improvements
29
+
30
+ * Changed to use PackageConfig::NotFoundError instead of RuntimeError
31
+ for exception on no .pc is found.
32
+
33
+ == 1.4.2 - 2020-08-10
34
+
35
+ === Improvements
36
+
37
+ * Added support for detecting pkgconfig path on RubyInstaller
38
+ without "ridk exec".
39
+
40
+ == 1.4.1 - 2020-02-10
41
+
42
+ === Improvements
43
+
44
+ * Added support for cycled depended .pc such as freetype2.pc and
45
+ harfbuzz.pc on PLD Linux.
46
+ [Reported by Jakub Bogusz]
47
+
48
+ === Thanks
49
+
50
+ * Jakub Bogusz
51
+
3
52
  == 1.4.0 - 2019-10-24
4
53
 
5
54
  === Improvements
data/README.rdoc CHANGED
@@ -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
data/lib/pkg-config.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2008-2019 Kouhei Sutou <kou@cozmixng.org>
1
+ # Copyright 2008-2021 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
@@ -249,13 +254,15 @@ class PackageConfig
249
254
  @path_position
250
255
  end
251
256
 
252
- def collect_requires(&block)
257
+ def collect_requires(processed_packages={}, &block)
253
258
  packages = []
254
259
  targets = yield(self)
255
260
  targets.each do |name|
261
+ next if processed_packages.key?(name)
256
262
  package = self.class.new(name, @options)
263
+ processed_packages[name] = package
257
264
  packages << package
258
- packages.concat(package.collect_requires(&block))
265
+ packages.concat(package.collect_requires(processed_packages, &block))
259
266
  end
260
267
  packages_without_self = packages.reject do |package|
261
268
  package.name == @name
@@ -358,7 +365,7 @@ class PackageConfig
358
365
  all_flags = {}
359
366
  flags = []
360
367
  in_option = false
361
- libs_command_line.gsub(/-([Ll]) /, '\1').split.each do |arg|
368
+ libs_command_line.gsub(/-([Ll]) /, "\\1").split.each do |arg|
362
369
  if in_option
363
370
  flags << arg
364
371
  in_option = false
@@ -379,12 +386,12 @@ class PackageConfig
379
386
 
380
387
  IDENTIFIER_RE = /[a-zA-Z\d_\.]+/
381
388
  def parse_pc
382
- raise ".pc for #{@name} doesn't exist." unless exist?
389
+ raise NotFoundError, ".pc doesn't exist: <#{@name}>" unless exist?
383
390
  @variables = {}
384
391
  @declarations = {}
385
392
  File.open(pc_path) do |input|
386
393
  input.each_line do |line|
387
- line = line.gsub(/#.*/, '').strip
394
+ line = line.gsub(/#.*/, "").strip
388
395
  next if line.empty?
389
396
  case line
390
397
  when /^(#{IDENTIFIER_RE})=/
@@ -398,7 +405,7 @@ class PackageConfig
398
405
 
399
406
  def parse_requires(requires)
400
407
  return [] if requires.nil?
401
- requires_without_version = requires.gsub(/[<>]?=\s*[\d.a-zA-Z_-]+\s*/, '')
408
+ requires_without_version = requires.gsub(/[<>]?=\s*[\d.a-zA-Z_-]+\s*/, "")
402
409
  requires_without_version.split(/[,\s]+/)
403
410
  end
404
411
 
@@ -438,6 +445,11 @@ class PackageConfig
438
445
  "/opt/X11/lib/pkgconfig",
439
446
  "/usr/share/pkgconfig",
440
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
441
453
  libdir = ENV["PKG_CONFIG_LIBDIR"]
442
454
  default_paths.unshift(libdir) if libdir
443
455
 
@@ -473,7 +485,11 @@ class PackageConfig
473
485
  homebrew_repository_candidates << Pathname(homebrew_repository)
474
486
  end
475
487
  homebrew_repository_candidates.uniq.each do |candidate|
476
- path = candidate + "Library/Homebrew/os/mac/pkgconfig/#{mac_os_version}"
488
+ pkgconfig_base_path = candidate + "Library/Homebrew/os/mac/pkgconfig"
489
+ path = pkgconfig_base_path + mac_os_version
490
+ unless path.exist?
491
+ path = pkgconfig_base_path + mac_os_version.gsub(/\.\d+\z/, "")
492
+ end
477
493
  paths << path.to_s if path.exist?
478
494
  end
479
495
  end
@@ -514,7 +530,7 @@ module PKGConfig
514
530
  end
515
531
 
516
532
  def msvc?
517
- /mswin/.match(RUBY_PLATFORM) and /^cl\b/.match(RbConfig::CONFIG['CC'])
533
+ /mswin/.match(RUBY_PLATFORM) and /^cl\b/.match(RbConfig::CONFIG["CC"])
518
534
  end
519
535
 
520
536
  def package_config(package)
@@ -589,18 +605,18 @@ module PKGConfig
589
605
  dldflags = libs(pkg)
590
606
  dldflags = (Shellwords.shellwords(dldflags) -
591
607
  Shellwords.shellwords(libraries))
592
- dldflags = dldflags.map {|s| /\s/ =~ s ? "\"#{s}\"" : s }.join(' ')
593
- $libs += ' ' + libraries
608
+ dldflags = dldflags.map {|s| /\s/ =~ s ? "\"#{s}\"" : s }.join(" ")
609
+ $libs += " " + libraries
594
610
  if /mswin/ =~ RUBY_PLATFORM
595
- $DLDFLAGS += ' ' + dldflags
611
+ $DLDFLAGS += " " + dldflags
596
612
  else
597
- $LDFLAGS += ' ' + dldflags
613
+ $LDFLAGS += " " + dldflags
598
614
  end
599
- $CFLAGS += ' ' + cflags_only_other(pkg)
615
+ $CFLAGS += " " + cflags_only_other(pkg)
600
616
  if defined?($CXXFLAGS)
601
- $CXXFLAGS += ' ' + cflags_only_other(pkg)
617
+ $CXXFLAGS += " " + cflags_only_other(pkg)
602
618
  end
603
- $INCFLAGS += ' ' + cflags_only_I(pkg)
619
+ $INCFLAGS += " " + cflags_only_I(pkg)
604
620
  end
605
621
  enough_version
606
622
  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.4.0"
18
+ VERSION = "1.4.5"
19
19
  end
data/test/run-test.rb CHANGED
@@ -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.4.0
4
+ version: 1.4.5
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-10-24 00:00:00.000000000 Z
11
+ date: 2021-02-04 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.3.0.dev
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