pkg-config 1.6.6 → 1.6.7

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: e2e29eff2da53b36ec5eb75c9592ed4870d7a73a516cd729422a457fe70ad7da
4
- data.tar.gz: 26c8d162c9278406471ba4b80a8362453eaafef00250fc081e083df590e69718
3
+ metadata.gz: 9247c36102e80ca429636e25d28b24b14573486f0825d1d6764f85a09fc55681
4
+ data.tar.gz: 8dc70f0d2fb458c96b78b4db348e119be01c9c170e16b969795e6e435a3dca5b
5
5
  SHA512:
6
- metadata.gz: 9ca2fec23f2f9a20cb7e78e8c89125a49193b2683d351281893c348e763321dce2dfa216db9b22c867a703b090df420bed6668d1880c4cf9464fce1eec29da57
7
- data.tar.gz: e978241d3ad1e15438c0dfa7d5abc28c596dd1b000a1572baa09788eb4b4c097b49d200872780538a4c77ca7f5d71f83cf211e4a9271b26ab7d024c58e3edd7c
6
+ metadata.gz: 4c4d698e50f0f74dd4411fe8443e2c190fb1b1ae04e36c8341be38d997430977ffcb6ae3b7871fa4f53de367e3b08c9ec2305df504e9a60fe8a078843ee4d3e6
7
+ data.tar.gz: 1b01d95584b9feb2417852a11c8bce55ae12b6c703c8aea9f3fe71185f640fd379a09176172eee9eb1f981dc4851f6fb11e6e8145351be3c5a54d429b18dce1d
data/NEWS.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # NEWS
2
2
 
3
+ ## 1.6.7 - 2026-11-04
4
+
5
+ ### Improvements
6
+
7
+ * Improved `pkgconf`/`pkg-config` search algorithm: Search `pkgconf`
8
+ and `pkg-config` in each `PATH` entry.
9
+ * [apache/arrow#55366](https://github.com/apache/arrow/issues/55366)
10
+ * Reported by tadeja
11
+
12
+ ### Thanks
13
+
14
+ * tadeja
15
+
3
16
  ## 1.6.6 - 2026-10-19
4
17
 
5
18
  ### Improvements
data/lib/pkg-config.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2008-2025 Sutou Kouhei <kou@cozmixng.org>
1
+ # Copyright (C) 2008-2026 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
@@ -19,7 +19,7 @@ require "rbconfig"
19
19
  require "shellwords"
20
20
 
21
21
  module PKGConfig
22
- VERSION = "1.6.6"
22
+ VERSION = "1.6.7"
23
23
 
24
24
  @@paths = []
25
25
  @@override_variables = {}
@@ -187,8 +187,6 @@ class PackageConfig
187
187
  candidates = [
188
188
  with_config("pkg-config"),
189
189
  ENV["PKG_CONFIG"],
190
- "pkgconf#{exeext}",
191
- "pkg-config#{exeext}",
192
190
  ].compact
193
191
  candidates.each do |pkg_config|
194
192
  pkg_config = Pathname.new(pkg_config)
@@ -202,13 +200,19 @@ class PackageConfig
202
200
  return found_pkg_config if found_pkg_config
203
201
  end
204
202
  end
205
- Pathname.new(candidates[0])
203
+ # Search both names in each PATH entry to respect PATH order.
204
+ default_candidates = ["pkgconf#{exeext}", "pkg-config#{exeext}"]
205
+ found_pkg_config = search_executable_from_path(*default_candidates)
206
+ return found_pkg_config if found_pkg_config
207
+ Pathname.new(candidates[0] || default_candidates[0])
206
208
  end
207
209
 
208
- def search_executable_from_path(name)
210
+ def search_executable_from_path(*names)
209
211
  (ENV["PATH"] || "").split(SEPARATOR).each do |path|
210
- try_name = Pathname(path) + name
211
- return try_name if try_name.executable?
212
+ names.each do |name|
213
+ try_name = Pathname(path) + name
214
+ return try_name if try_name.executable?
215
+ end
212
216
  end
213
217
  nil
214
218
  end
@@ -1,5 +1,7 @@
1
1
  require "mkmf"
2
+ require "fileutils"
2
3
  require "tempfile"
4
+ require "tmpdir"
3
5
 
4
6
  require "pkg-config"
5
7
 
@@ -344,4 +346,54 @@ Cflags: -I${includedir}/my-package
344
346
  "-DFOO", "-Wall", "-Wl,--as-needed"]))
345
347
  end
346
348
  end
349
+
350
+ sub_test_case(".native_pkg_config") do
351
+ def setup
352
+ super
353
+ original_path = ENV["PATH"]
354
+ original_pkg_config = ENV["PKG_CONFIG"]
355
+ begin
356
+ ENV.delete("PKG_CONFIG")
357
+ PackageConfig.clear_configure_args_cache
358
+ Dir.mktmpdir do |tmp_dir|
359
+ @tmp_dir = tmp_dir
360
+ yield
361
+ end
362
+ ensure
363
+ ENV["PATH"] = original_path
364
+ ENV["PKG_CONFIG"] = original_pkg_config
365
+ PackageConfig.clear_configure_args_cache
366
+ end
367
+ end
368
+
369
+ def create_executable(dir, name)
370
+ dir = File.join(@tmp_dir, dir)
371
+ FileUtils.mkdir_p(dir)
372
+ path = File.join(dir, "#{name}#{RbConfig::CONFIG["EXEEXT"]}")
373
+ File.write(path, "")
374
+ FileUtils.chmod(0755, path)
375
+ Pathname(path)
376
+ end
377
+
378
+ def native_pkg_config
379
+ PackageConfig.native_pkg_config
380
+ end
381
+
382
+ def test_prefer_earlier_path_entry
383
+ pkg_config = create_executable("conda", "pkg-config")
384
+ pkgconf = create_executable("homebrew", "pkgconf")
385
+ ENV["PATH"] = [
386
+ File.dirname(pkg_config),
387
+ File.dirname(pkgconf),
388
+ ].join(File::PATH_SEPARATOR)
389
+ assert_equal(pkg_config, native_pkg_config)
390
+ end
391
+
392
+ def test_prefer_pkgconf_in_same_path_entry
393
+ create_executable("bin", "pkg-config")
394
+ pkgconf = create_executable("bin", "pkgconf")
395
+ ENV["PATH"] = File.dirname(pkgconf)
396
+ assert_equal(pkgconf, native_pkg_config)
397
+ end
398
+ end
347
399
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pkg-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.6
4
+ version: 1.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sutou Kouhei