pkg-config 1.4.9 → 1.5.1

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: a8744b07afc1df6d424780519cc0bc63c958c3933b1b4ee58ed8c97b73c240f9
4
- data.tar.gz: 4cdef6c98e5f88ac45a0bc5c26f580a1d9fb31fb637bfd37eb014e7aa6798bff
3
+ metadata.gz: c90e9d9dd81d99b7fd6412e1befe74deaabf67d3c181d50261846a2da0fe9d43
4
+ data.tar.gz: 9dd90a3ffc4e140bce369c8b45ba0c34ba8f3ccea6f0a49ce884b8ba6a2d9825
5
5
  SHA512:
6
- metadata.gz: daad81936552a5db084c32c3c91825917cdb5f35c3940aa7cd0249f433ab02b5b5ee779538e7cad51721f9daed7890e9a45571244078f927db895b243045a2bd
7
- data.tar.gz: 970f917f76ed381f3d427c3add37495107c5bb556aa9470b72459b06bb768b4ad21215f9efd6fb712535a9f99f9ffb2019313e562d5f57c1228de5824634c36b
6
+ metadata.gz: de054c89cbe328715e28258636442959dfbca1c859e1fbff4f076bd945e019ced3aa0515f69cdb470288c76811b2d0138293b65398470acc24415c4631f298bc
7
+ data.tar.gz: a5414ffd42e1bc9cdde74df9ae83689473c9799ef7b6606ee9bb02379017b42db93b5d80f550820f9cea9befddd2a3402cf65435290b0f78db578c55480b9c00
data/NEWS CHANGED
@@ -1,5 +1,22 @@
1
1
  = NEWS
2
2
 
3
+ == 1.5.1 - 2022-11-23
4
+
5
+ === Improvements
6
+
7
+ * Improved the default search path. "/usr" in "/usr/bin/pkg-config"
8
+ isn't used for buidling the default search path if "pkg-config
9
+ --variable=pc_path pkg-config" is available.
10
+ [Reported by Watson][GitHub:#22]
11
+
12
+ == 1.5.0 - 2022-11-23
13
+
14
+ === Improvements
15
+
16
+ * Improved the default search path. "pkg-config --variable=pc_path
17
+ pkg-config" is used as the default search path if it's available.
18
+ [Reported by Watson][GitHub:#22]
19
+
3
20
  == 1.4.9 - 2022-07-31
4
21
 
5
22
  This is a bug fix release of 1.4.8. All 1.4.8 users should be upgraded
@@ -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.9"
18
+ VERSION = "1.5.1"
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,111 @@ 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
+ pkg_config_prefix = native_pkg_config_prefix
163
+ if pkg_config_prefix
164
+ pkg_config_arch_depended_paths =
165
+ Dir.glob((pkg_config_prefix + "lib/*/pkgconfig").to_s)
166
+ default_paths.concat(pkg_config_arch_depended_paths)
167
+ default_paths << (pkg_config_prefix + "lib64/pkgconfig").to_s
168
+ default_paths << (pkg_config_prefix + "libx32/pkgconfig").to_s
169
+ default_paths << (pkg_config_prefix + "lib/pkgconfig").to_s
170
+ default_paths << (pkg_config_prefix + "libdata/pkgconfig").to_s
171
+ default_paths << (pkg_config_prefix + "share/pkgconfig").to_s
172
+ end
173
+ default_paths << "/usr/local/lib64/pkgconfig"
174
+ default_paths << "/usr/local/libx32/pkgconfig"
175
+ default_paths << "/usr/local/lib/pkgconfig"
176
+ default_paths << "/usr/local/libdata/pkgconfig"
177
+ default_paths << "/usr/local/share/pkgconfig"
178
+ default_paths << "/opt/local/lib/pkgconfig"
179
+ default_paths.concat(arch_depended_path)
180
+ default_paths << "/usr/lib64/pkgconfig"
181
+ default_paths << "/usr/libx32/pkgconfig"
182
+ default_paths << "/usr/lib/pkgconfig"
183
+ default_paths << "/usr/libdata/pkgconfig"
184
+ default_paths << "/usr/X11R6/lib/pkgconfig"
185
+ default_paths << "/usr/X11R6/share/pkgconfig"
186
+ default_paths << "/usr/X11/lib/pkgconfig"
187
+ default_paths << "/opt/X11/lib/pkgconfig"
188
+ default_paths << "/usr/share/pkgconfig"
189
+ end
190
+ if Object.const_defined?(:RubyInstaller)
191
+ mingw_bin_path = RubyInstaller::Runtime.msys2_installation.mingw_bin_path
192
+ mingw_pkgconfig_path = Pathname.new(mingw_bin_path) + "../lib/pkgconfig"
193
+ default_paths.unshift(mingw_pkgconfig_path.cleanpath.to_s)
194
+ end
195
+ libdir = ENV["PKG_CONFIG_LIBDIR"]
196
+ default_paths.unshift(libdir) if libdir
197
+
198
+ paths = []
199
+ if /-darwin\d[\d\.]*\z/ =~ RUBY_PLATFORM and
200
+ /\A(\d+\.\d+)/ =~ run_command("sw_vers", "-productVersion")
201
+ mac_os_version = $1
202
+ homebrew_repository_candidates = []
203
+ if pkg_config_prefix
204
+ brew_path = pkg_config_prefix + "bin" + "brew"
205
+ if brew_path.exist?
206
+ homebrew_repository = run_command(brew_path.to_s, "--repository")
207
+ if homebrew_repository
208
+ homebrew_repository_candidates <<
209
+ Pathname.new(homebrew_repository.strip)
210
+ end
211
+ else
212
+ homebrew_repository_candidates << pkg_config_prefix + "Homebrew"
213
+ homebrew_repository_candidates << pkg_config_prefix
214
+ end
215
+ end
216
+ brew = search_executable_from_path("brew")
217
+ if brew
218
+ homebrew_repository = run_command("brew", "--repository")
219
+ if homebrew_repository
220
+ homebrew_repository_candidates <<
221
+ Pathname(homebrew_repository.to_s)
222
+ end
223
+ end
224
+ homebrew_repository_candidates.uniq.each do |candidate|
225
+ pkgconfig_base_path = candidate + "Library/Homebrew/os/mac/pkgconfig"
226
+ path = pkgconfig_base_path + mac_os_version
227
+ unless path.exist?
228
+ path = pkgconfig_base_path + mac_os_version.gsub(/\.\d+\z/, "")
229
+ end
230
+ paths << path.to_s if path.exist?
231
+ end
232
+ end
233
+ paths.concat(default_paths)
234
+ paths.join(SEPARATOR)
235
+ end
236
+
237
+ def run_command(*command_line)
238
+ IO.pipe do |input, output|
239
+ begin
240
+ pid = spawn(*command_line,
241
+ out: output,
242
+ err: File::NULL)
243
+ output.close
244
+ _, status = Process.waitpid2(pid)
245
+ return nil unless status.success?
246
+ input.read
247
+ rescue SystemCallError
248
+ nil
249
+ end
250
+ end
251
+ end
141
252
  end
142
253
 
143
254
  attr_reader :name
@@ -155,7 +266,7 @@ class PackageConfig
155
266
  end
156
267
  @options = options
157
268
  path = @options[:path] || ENV["PKG_CONFIG_PATH"]
158
- @paths = [path, guess_default_path].compact.join(SEPARATOR).split(SEPARATOR)
269
+ @paths = [path, self.class.default_path].compact.join(SEPARATOR).split(SEPARATOR)
159
270
  @paths.unshift(*(@options[:paths] || []))
160
271
  @paths = normalize_paths(@paths)
161
272
  @msvc_syntax = @options[:msvc_syntax]
@@ -425,79 +536,6 @@ class PackageConfig
425
536
  end
426
537
  end
427
538
 
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
539
  def required_packages
502
540
  collect_requires do |package|
503
541
  package.requires
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.9
4
+ version: 1.5.1
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: