pkg-config 1.6.4 → 1.6.5

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: 1aa00fc6e840f6d61f9d63a7455da3a9a6fd4febfb4d9909508aa5f32fcbd838
4
- data.tar.gz: 318ecf2df122cbaa86fc972fbd32017d8afe938cc0b0dc492cf75c6d0706aaa6
3
+ metadata.gz: 0a4a54b361004652d84f50b2d4f2cfaaf447ffd2fc97c44490ed7c7751763721
4
+ data.tar.gz: 3ae709328a845092794bca9d2753e5d7867170b5832d7f85023c0692ec1e8178
5
5
  SHA512:
6
- metadata.gz: 077e55fa2ddf6791ae05f24012c29bb3cdb126e713d5f07c58e204facc62885a33901cea3fd5985f4e64adfa3acab2e40a893250a0095675fea416c0b302b186
7
- data.tar.gz: 5b0fc63366cd7dd3e41185fb35338547b407ad6a0ba0e2018e59e072a5cbc2a83ed22a23ab172e0b5a0506d07e29ce256aee5528a1c7cec01787240554483377
6
+ metadata.gz: 748e225bef3d590013e8bf3efcc2c0422d6d2a802a65f104f15feebd01bcf526d29b0909b922d444b261c5354a2b6101d549871867f7e5bb95c0bd01da12ba48
7
+ data.tar.gz: 0203aee2b542ca94a0dbf18e7515ff73339b3910931eeb209d19e791f30a63d8a70bf36c500271f68b73a2045abfc60fe6c0a5727e265df01843c893c95e7936
data/NEWS.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # NEWS
2
2
 
3
+ ## 1.6.5 - 2025-12-01
4
+
5
+ ### Improvements
6
+
7
+ * Improved pkgconf compatibility: Removed duplicated `-D`/`-W` flags.
8
+ * [ruby-gnome/pkg-config#43](https://github.com/ruby-gnome/pkg-config/issues/43)
9
+ * Patch by takuya kodama
10
+
11
+ ### Thanks
12
+
13
+ * takuya kodama
14
+
3
15
  ## 1.6.4 - 2025-09-03
4
16
 
5
17
  ### Improvements
data/lib/pkg-config.rb CHANGED
@@ -19,7 +19,7 @@ require "rbconfig"
19
19
  require "shellwords"
20
20
 
21
21
  module PKGConfig
22
- VERSION = "1.6.4"
22
+ VERSION = "1.6.5"
23
23
 
24
24
  @@paths = []
25
25
  @@override_variables = {}
@@ -545,6 +545,7 @@ class PackageConfig
545
545
  flag.gsub(/\A-I/, "/I")
546
546
  end
547
547
  end
548
+ other_flags = merge_back_cflags(other_flags)
548
549
  [path_flags, other_flags]
549
550
  end
550
551
 
@@ -579,6 +580,32 @@ class PackageConfig
579
580
  normalized_cflags
580
581
  end
581
582
 
583
+ # Implementing behavior compatible with pkgconf's pkgconf_fragment_copy().
584
+ # This is not a complete reproduction yet, but the goal is to stay compatible.
585
+ # https://github.com/pkgconf/pkgconf/blob/pkgconf-2.5.1/libpkgconf/fragment.c#L381-L416
586
+ def merge_back_cflags(cflags)
587
+ merge_backed_cflags = []
588
+ cflags.each do |cflag|
589
+ if mergeable_flag?(cflag)
590
+ # NOTE: This may be slow because this checks merge_back_cflags N times
591
+ # (where N is the number of mergeable flags).
592
+ merge_backed_cflags.delete(cflag)
593
+ end
594
+ merge_backed_cflags << cflag
595
+ end
596
+ merge_backed_cflags
597
+ end
598
+
599
+ def mergeable_flag?(flag)
600
+ return false unless flag.start_with?("-")
601
+ return true if flag.start_with?("-D")
602
+ if flag.start_with?("-W")
603
+ return false if flag.start_with?("-Wa,", "-Wl,", "-Wp,")
604
+ return true
605
+ end
606
+ false
607
+ end
608
+
582
609
  def collect_libs
583
610
  target_packages = [*required_packages, self]
584
611
  libs_set = []
@@ -314,4 +314,34 @@ Cflags: -I${includedir}/my-package
314
314
  parse_requires("fribidi = 1.0"))
315
315
  end
316
316
  end
317
+
318
+ sub_test_case("#merge_back_cflags") do
319
+ def merge_back_cflags(cflags)
320
+ @glib.__send__(:merge_back_cflags, cflags)
321
+ end
322
+
323
+ def test_d
324
+ assert_equal(["-DFOO"],
325
+ merge_back_cflags(["-DFOO", "-DFOO"]))
326
+ end
327
+
328
+ def test_w
329
+ assert_equal(["-Wno-unknown-warning-option"],
330
+ merge_back_cflags(["-Wno-unknown-warning-option",
331
+ "-Wno-unknown-warning-option"]))
332
+ end
333
+
334
+ def test_wa_wl_wp
335
+ assert_equal(["-Wa,--noexecstack", "-Wl,--as-needed", "-Wp,-DFOO",
336
+ "-Wa,--noexecstack", "-Wl,--as-needed", "-Wp,-DFOO"],
337
+ merge_back_cflags(["-Wa,--noexecstack", "-Wl,--as-needed", "-Wp,-DFOO",
338
+ "-Wa,--noexecstack", "-Wl,--as-needed", "-Wp,-DFOO"]))
339
+ end
340
+
341
+ def test_mixed
342
+ assert_equal(["-Wl,--as-needed", "-DFOO", "-Wall", "-Wl,--as-needed"],
343
+ merge_back_cflags(["-DFOO", "-Wall", "-Wl,--as-needed",
344
+ "-DFOO", "-Wall", "-Wl,--as-needed"]))
345
+ end
346
+ end
317
347
  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.4
4
+ version: 1.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sutou Kouhei
@@ -29,7 +29,7 @@ homepage: https://github.com/ruby-gnome/pkg-config
29
29
  licenses:
30
30
  - LGPLv2+
31
31
  metadata:
32
- msys2_mingw_dependencies: pkg-config
32
+ msys2_mingw_dependencies: pkgconf
33
33
  rdoc_options: []
34
34
  require_paths:
35
35
  - lib