pkg-config 1.4.8 → 1.5.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2c16e146d0ccf624f6d0bb159f794819283d0a03473faa688464c85529c76a8
4
- data.tar.gz: 7bf14f8e591acf8eaae6ac8859499e1bb193e098d3f1ae6fd73027992433a87e
3
+ metadata.gz: 2fa734326aace2a082621cebde9999bab5917805ff2148b046488471c5206db7
4
+ data.tar.gz: 7d6b09c7530dcc1710e12286ce7dc8fd8d5d84018c90c0708f49879b59031077
5
5
  SHA512:
6
- metadata.gz: 78855df890fe391b08d049034817b8df3e238bbf584fe206dbea89c035ef3bc09651bc233c0623b09750f425afeeef0339fec0eca22555775e7f76a0bd3afdcc
7
- data.tar.gz: d1baeaa40e6e8334c8b90dce84b8d53e5709164e983e267728897124f07f700051539b3cf5c347d1107c799535aa7a1aa860a9cd3fba1937147acfae05ffe585
6
+ metadata.gz: 3d0ccc44aed59fe08e92f7b2f3fda3979e48e4dec6356b11067c9068841b3a4483ede5d94dcd8fd7880e99a065aef466b89cb48b2905b29387ada1f95078bb8e
7
+ data.tar.gz: 04e1038f82ecd393e0529a312baa6d4d0c887b10a36c7089fdef0d9b3c584040f056bc2e8b1945e995f1e49f24d197d5c98ca8f1fdb2682b4b1705398da97980
data/NEWS CHANGED
@@ -1,5 +1,23 @@
1
1
  = NEWS
2
2
 
3
+ == 1.5.0 - 2022-11-23
4
+
5
+ === Improvements
6
+
7
+ * Improved the default search path. "pkg-config --variable=pc_path
8
+ pkg-config" is used as the default search path if it's available.
9
+ [Reported by Watson][GitHub:#22]
10
+
11
+ == 1.4.9 - 2022-07-31
12
+
13
+ This is a bug fix release of 1.4.8. All 1.4.8 users should be upgraded
14
+ to 1.4.9.
15
+
16
+ === Fixes
17
+
18
+ * Fixed a regression bug in 1.4.8 that PkgConfig.have_package can't
19
+ detect nonexistent package.
20
+
3
21
  == 1.4.8 - 2022-07-30
4
22
 
5
23
  === Improvements
@@ -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.8"
18
+ VERSION = "1.5.0"
19
19
  end
data/lib/pkg-config.rb CHANGED
@@ -44,6 +44,11 @@ class PackageConfig
44
44
  @native_pkg_config_prefix ||= compute_native_pkg_config_prefix
45
45
  end
46
46
 
47
+ @default_path = nil
48
+ def default_path
49
+ @default_path ||= compute_default_path
50
+ end
51
+
47
52
  @custom_override_variables = nil
48
53
  def custom_override_variables
49
54
  @custom_override_variables ||= with_config("override-variables", "")
@@ -52,6 +57,7 @@ class PackageConfig
52
57
  def clear_configure_args_cache
53
58
  @native_pkg_config = nil
54
59
  @native_pkg_config_prefix = nil
60
+ @default_path = nil
55
61
  @custom_override_variables = nil
56
62
  end
57
63
 
@@ -138,6 +144,112 @@ class PackageConfig
138
144
  pkg_config_prefix
139
145
  end
140
146
  end
147
+
148
+ def compute_default_path
149
+ default_paths = nil
150
+ if native_pkg_config
151
+ pc_path = run_command(native_pkg_config.to_s,
152
+ "--variable=pc_path",
153
+ "pkg-config")
154
+ if pc_path
155
+ default_paths = pc_path.strip.split(SEPARATOR)
156
+ default_paths = nil if default_paths.empty?
157
+ end
158
+ end
159
+ if default_paths.nil?
160
+ arch_depended_path = Dir.glob("/usr/lib/*/pkgconfig")
161
+ default_paths = [
162
+ "/usr/local/lib64/pkgconfig",
163
+ "/usr/local/libx32/pkgconfig",
164
+ "/usr/local/lib/pkgconfig",
165
+ "/usr/local/libdata/pkgconfig",
166
+ "/usr/local/share/pkgconfig",
167
+ "/opt/local/lib/pkgconfig",
168
+ *arch_depended_path,
169
+ "/usr/lib64/pkgconfig",
170
+ "/usr/libx32/pkgconfig",
171
+ "/usr/lib/pkgconfig",
172
+ "/usr/libdata/pkgconfig",
173
+ "/usr/X11R6/lib/pkgconfig",
174
+ "/usr/X11R6/share/pkgconfig",
175
+ "/usr/X11/lib/pkgconfig",
176
+ "/opt/X11/lib/pkgconfig",
177
+ "/usr/share/pkgconfig",
178
+ ]
179
+ end
180
+ if Object.const_defined?(:RubyInstaller)
181
+ mingw_bin_path = RubyInstaller::Runtime.msys2_installation.mingw_bin_path
182
+ mingw_pkgconfig_path = Pathname.new(mingw_bin_path) + "../lib/pkgconfig"
183
+ default_paths.unshift(mingw_pkgconfig_path.cleanpath.to_s)
184
+ end
185
+ libdir = ENV["PKG_CONFIG_LIBDIR"]
186
+ default_paths.unshift(libdir) if libdir
187
+
188
+ paths = []
189
+ pkg_config_prefix = native_pkg_config_prefix
190
+ if pkg_config_prefix
191
+ pkg_config_arch_depended_paths =
192
+ Dir.glob((pkg_config_prefix + "lib/*/pkgconfig").to_s)
193
+ paths.concat(pkg_config_arch_depended_paths)
194
+ paths << (pkg_config_prefix + "lib64/pkgconfig").to_s
195
+ paths << (pkg_config_prefix + "libx32/pkgconfig").to_s
196
+ paths << (pkg_config_prefix + "lib/pkgconfig").to_s
197
+ paths << (pkg_config_prefix + "libdata/pkgconfig").to_s
198
+ paths << (pkg_config_prefix + "share/pkgconfig").to_s
199
+ end
200
+ if /-darwin\d[\d\.]*\z/ =~ RUBY_PLATFORM and
201
+ /\A(\d+\.\d+)/ =~ run_command("sw_vers", "-productVersion")
202
+ mac_os_version = $1
203
+ homebrew_repository_candidates = []
204
+ if pkg_config_prefix
205
+ brew_path = pkg_config_prefix + "bin" + "brew"
206
+ if brew_path.exist?
207
+ homebrew_repository = run_command(brew_path.to_s, "--repository")
208
+ if homebrew_repository
209
+ homebrew_repository_candidates <<
210
+ Pathname.new(homebrew_repository.strip)
211
+ end
212
+ else
213
+ homebrew_repository_candidates << pkg_config_prefix + "Homebrew"
214
+ homebrew_repository_candidates << pkg_config_prefix
215
+ end
216
+ end
217
+ brew = search_executable_from_path("brew")
218
+ if brew
219
+ homebrew_repository = run_command("brew", "--repository")
220
+ if homebrew_repository
221
+ homebrew_repository_candidates <<
222
+ Pathname(homebrew_repository.to_s)
223
+ end
224
+ end
225
+ homebrew_repository_candidates.uniq.each do |candidate|
226
+ pkgconfig_base_path = candidate + "Library/Homebrew/os/mac/pkgconfig"
227
+ path = pkgconfig_base_path + mac_os_version
228
+ unless path.exist?
229
+ path = pkgconfig_base_path + mac_os_version.gsub(/\.\d+\z/, "")
230
+ end
231
+ paths << path.to_s if path.exist?
232
+ end
233
+ end
234
+ paths.concat(default_paths)
235
+ paths.join(SEPARATOR)
236
+ end
237
+
238
+ def run_command(*command_line)
239
+ IO.pipe do |input, output|
240
+ begin
241
+ pid = spawn(*command_line,
242
+ out: output,
243
+ err: File::NULL)
244
+ output.close
245
+ _, status = Process.waitpid2(pid)
246
+ return nil unless status.success?
247
+ input.read
248
+ rescue SystemCallError
249
+ nil
250
+ end
251
+ end
252
+ end
141
253
  end
142
254
 
143
255
  attr_reader :name
@@ -155,7 +267,7 @@ class PackageConfig
155
267
  end
156
268
  @options = options
157
269
  path = @options[:path] || ENV["PKG_CONFIG_PATH"]
158
- @paths = [path, guess_default_path].compact.join(SEPARATOR).split(SEPARATOR)
270
+ @paths = [path, self.class.default_path].compact.join(SEPARATOR).split(SEPARATOR)
159
271
  @paths.unshift(*(@options[:paths] || []))
160
272
  @paths = normalize_paths(@paths)
161
273
  @msvc_syntax = @options[:msvc_syntax]
@@ -425,79 +537,6 @@ class PackageConfig
425
537
  end
426
538
  end
427
539
 
428
- def guess_default_path
429
- arch_depended_path = Dir.glob("/usr/lib/*/pkgconfig")
430
- default_paths = [
431
- "/usr/local/lib64/pkgconfig",
432
- "/usr/local/libx32/pkgconfig",
433
- "/usr/local/lib/pkgconfig",
434
- "/usr/local/libdata/pkgconfig",
435
- "/usr/local/share/pkgconfig",
436
- "/opt/local/lib/pkgconfig",
437
- *arch_depended_path,
438
- "/usr/lib64/pkgconfig",
439
- "/usr/libx32/pkgconfig",
440
- "/usr/lib/pkgconfig",
441
- "/usr/libdata/pkgconfig",
442
- "/usr/X11R6/lib/pkgconfig",
443
- "/usr/X11R6/share/pkgconfig",
444
- "/usr/X11/lib/pkgconfig",
445
- "/opt/X11/lib/pkgconfig",
446
- "/usr/share/pkgconfig",
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
453
- libdir = ENV["PKG_CONFIG_LIBDIR"]
454
- default_paths.unshift(libdir) if libdir
455
-
456
- paths = []
457
- pkg_config_prefix = self.class.native_pkg_config_prefix
458
- if pkg_config_prefix
459
- pkg_config_arch_depended_paths =
460
- Dir.glob((pkg_config_prefix + "lib/*/pkgconfig").to_s)
461
- paths.concat(pkg_config_arch_depended_paths)
462
- paths << (pkg_config_prefix + "lib64/pkgconfig").to_s
463
- paths << (pkg_config_prefix + "libx32/pkgconfig").to_s
464
- paths << (pkg_config_prefix + "lib/pkgconfig").to_s
465
- paths << (pkg_config_prefix + "libdata/pkgconfig").to_s
466
- paths << (pkg_config_prefix + "share/pkgconfig").to_s
467
- end
468
- if /-darwin\d[\d\.]*\z/ =~ RUBY_PLATFORM and
469
- /\A(\d+\.\d+)/ =~ `sw_vers -productVersion`
470
- mac_os_version = $1
471
- homebrew_repository_candidates = []
472
- if pkg_config_prefix
473
- brew_path = pkg_config_prefix + "bin" + "brew"
474
- if brew_path.exist?
475
- escaped_brew_path = Shellwords.escape(brew_path.to_s)
476
- homebrew_repository = `#{escaped_brew_path} --repository`.chomp
477
- homebrew_repository_candidates << Pathname.new(homebrew_repository)
478
- else
479
- homebrew_repository_candidates << pkg_config_prefix + "Homebrew"
480
- homebrew_repository_candidates << pkg_config_prefix
481
- end
482
- end
483
- brew = self.class.__send__(:search_executable_from_path, "brew")
484
- if brew
485
- homebrew_repository = `brew --repository`.chomp
486
- homebrew_repository_candidates << Pathname(homebrew_repository)
487
- end
488
- homebrew_repository_candidates.uniq.each do |candidate|
489
- pkgconfig_base_path = candidate + "Library/Homebrew/os/mac/pkgconfig"
490
- path = pkgconfig_base_path + mac_os_version
491
- unless path.exist?
492
- path = pkgconfig_base_path + mac_os_version.gsub(/\.\d+\z/, "")
493
- end
494
- paths << path.to_s if path.exist?
495
- end
496
- end
497
- paths.concat(default_paths)
498
- paths.join(SEPARATOR)
499
- end
500
-
501
540
  def required_packages
502
541
  collect_requires do |package|
503
542
  package.requires
@@ -598,13 +637,14 @@ module PKGConfig
598
637
  message << " version (>= #{major}.#{minor}.#{micro})"
599
638
  end
600
639
  major ||= 0
601
- enough_version = checking_for(checking_message(message), "%s") do
640
+ result = checking_for(checking_message(message), "%s") do
602
641
  if check_version?(pkg, major, minor, micro)
603
642
  "yes (#{modversion(pkg)})"
604
643
  else
605
644
  "no"
606
645
  end
607
646
  end
647
+ enough_version = (result != "no")
608
648
  if enough_version
609
649
  libraries = libs_only_l(pkg)
610
650
  dldflags = libs(pkg)
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.8
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-30 00:00:00.000000000 Z
11
+ date: 2022-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit
@@ -74,7 +74,7 @@ licenses:
74
74
  - LGPLv2+
75
75
  metadata:
76
76
  msys2_mingw_dependencies: pkg-config
77
- post_install_message:
77
+ post_install_message:
78
78
  rdoc_options: []
79
79
  require_paths:
80
80
  - lib
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  version: '0'
91
91
  requirements: []
92
92
  rubygems_version: 3.4.0.dev
93
- signing_key:
93
+ signing_key:
94
94
  specification_version: 4
95
95
  summary: A pkg-config implementation for Ruby
96
96
  test_files: