pkg-config 1.5.8 → 1.6.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: 718c0829414803eaf6e4b4119eedbd5635f06490e432e02b8fecd1100e471409
4
- data.tar.gz: 00d55bbd4c8f935454a5a65a1f84a6183e04f87ed6621fb6b21145075e38b481
3
+ metadata.gz: 9271911be7ad02986afe55f8d4f0500c71ee9c0041ac3d04848ef77db62db6d1
4
+ data.tar.gz: 6e85abd87a218c0ceb11ec08d80aa5bced06be9af3dea3ec2b142b394b33f058
5
5
  SHA512:
6
- metadata.gz: 5333ac54f4a4ff9d9013d4f61097032bd822d8b562144b5dd79a646106fe82d0c4ae32933ba6e570a14b10198d729c442d885b782e32ab490da4998bb7930c9c
7
- data.tar.gz: a31424703041ab85dabff217234d68dcf0d1e28418f7b6a3ec2173dfdba6cc3c565d68744adf4e8eae7140cf3775a01c180ab6667886ae7ed50c3fc465fedd5b
6
+ metadata.gz: a374570fbcdebfbd7f54595ffdce0573881dafd1ed3ccae5dcc64ac68d22314f7c769edc26203dc0ffbdf8c54c33ba4e1ae0c5053c5f84388d2e7dceb1637b75
7
+ data.tar.gz: 017eb1d26ca3c49021f5a32e40f9543ecab4ca31dfa081f5496420fd54094eb9c09e37bc2c18f5b62387fb5fd207e55fc45b96b34cd1445e8e02675e21756684
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- # -*- mode: ruby; coding: utf-8 -*-
1
+ # -*- ruby -*-
2
2
  #
3
- # Copyright (C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2011-2025 Sutou Kouhei <kou@clear-code.com>
4
4
  #
5
5
  # This library is free software; you can redistribute it and/or
6
6
  # modify it under the terms of the GNU Lesser General Public
@@ -18,3 +18,13 @@
18
18
  source "https://rubygems.org/"
19
19
 
20
20
  gemspec
21
+
22
+ group :development, :test do
23
+ gem "bundler"
24
+ gem "rake"
25
+ end
26
+
27
+ group :test do
28
+ gem "test-unit"
29
+ end
30
+
data/NEWS.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # NEWS
2
2
 
3
+ ## 1.6.0 - 2025-03-02
4
+
5
+ ### Improvements
6
+
7
+ * Changed to use only one file: `pkg-config.rb`
8
+
9
+ * Removed `English` dependency.
10
+
11
+ ## 1.5.9 - 2025-01-08
12
+
13
+ ### Improvements
14
+
15
+ * Added support for `.pc` that uses UTF-8.
16
+
3
17
  ## 1.5.8 - 2024-11-21
4
18
 
5
19
  ### Improvements
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- # -*- coding: utf-8; mode: ruby -*-
1
+ # -*- ruby -*-
2
2
  #
3
- # Copyright (C) 2010-2012 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2010-2025 Sutou Kouhei <kou@clear-code.com>
4
4
  #
5
5
  # This library is free software; you can redistribute it and/or
6
6
  # modify it under the terms of the GNU Lesser General Public
@@ -33,5 +33,9 @@ spec = helper.gemspec
33
33
 
34
34
  desc "Run tests"
35
35
  task :test do
36
- ruby("test/run-test.rb")
36
+ ruby("test/run.rb")
37
37
  end
38
+
39
+ release_task = Rake.application["release"]
40
+ # We use Trusted Publishing.
41
+ release_task.prerequisites.delete("release:rubygem_push")
data/lib/pkg-config.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2008-2023 Sutou Kouhei <kou@cozmixng.org>
1
+ # Copyright (C) 2008-2025 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
@@ -14,16 +14,127 @@
14
14
  # License along with this library; if not, write to the Free Software
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
- begin
18
- require_relative "pkg-config/version"
19
- rescue LoadError
20
- end
21
-
22
- require "English"
23
17
  require "pathname"
24
18
  require "rbconfig"
25
19
  require "shellwords"
26
20
 
21
+ module PKGConfig
22
+ VERSION = "1.6.0"
23
+
24
+ @@paths = []
25
+ @@override_variables = {}
26
+
27
+ module_function
28
+ def add_path(path)
29
+ @@paths << path
30
+ end
31
+
32
+ def set_override_variable(key, value)
33
+ @@override_variables[key] = value
34
+ end
35
+
36
+ def msvc?
37
+ /mswin/.match(RUBY_PLATFORM) and /^cl\b/.match(RbConfig::CONFIG["CC"])
38
+ end
39
+
40
+ def package_config(package)
41
+ PackageConfig.new(package,
42
+ :msvc_syntax => msvc?,
43
+ :override_variables => @@override_variables,
44
+ :paths => @@paths)
45
+ end
46
+
47
+ def exist?(pkg)
48
+ package_config(pkg).exist?
49
+ end
50
+
51
+ def libs(pkg)
52
+ package_config(pkg).libs
53
+ end
54
+
55
+ def libs_only_l(pkg)
56
+ package_config(pkg).libs_only_l
57
+ end
58
+
59
+ def libs_only_L(pkg)
60
+ package_config(pkg).libs_only_L
61
+ end
62
+
63
+ def cflags(pkg)
64
+ package_config(pkg).cflags
65
+ end
66
+
67
+ def cflags_only_I(pkg)
68
+ package_config(pkg).cflags_only_I
69
+ end
70
+
71
+ def cflags_only_other(pkg)
72
+ package_config(pkg).cflags_only_other
73
+ end
74
+
75
+ def modversion(pkg)
76
+ package_config(pkg).version
77
+ end
78
+
79
+ def description(pkg)
80
+ package_config(pkg).description
81
+ end
82
+
83
+ def variable(pkg, name)
84
+ package_config(pkg).variable(name)
85
+ end
86
+
87
+ def check_version?(pkg, major=0, minor=0, micro=0)
88
+ return false unless exist?(pkg)
89
+ ver = modversion(pkg).split(".").collect {|item| item.to_i}
90
+ (0..2).each {|i| ver[i] = 0 unless ver[i]}
91
+
92
+ (ver[0] > major ||
93
+ (ver[0] == major && ver[1] > minor) ||
94
+ (ver[0] == major && ver[1] == minor &&
95
+ ver[2] >= micro))
96
+ end
97
+
98
+ def have_package(pkg, major=nil, minor=0, micro=0)
99
+ message = "#{pkg}"
100
+ unless major.nil?
101
+ message << " version (>= #{major}.#{minor}.#{micro})"
102
+ end
103
+ major ||= 0
104
+ result = checking_for(checking_message(message), "%s") do
105
+ if check_version?(pkg, major, minor, micro)
106
+ "yes (#{modversion(pkg)})"
107
+ else
108
+ if exist?(pkg)
109
+ "no (#{modversion(pkg)})"
110
+ else
111
+ "no (nonexistent)"
112
+ end
113
+ end
114
+ end
115
+ enough_version = result.start_with?("yes")
116
+ if enough_version
117
+ libraries = libs_only_l(pkg)
118
+ dldflags = libs(pkg)
119
+ dldflags = (Shellwords.shellwords(dldflags) -
120
+ Shellwords.shellwords(libraries))
121
+ dldflags = dldflags.map {|s| /\s/ =~ s ? "\"#{s}\"" : s }.join(" ")
122
+ $libs += " " + libraries
123
+ if /mswin/ =~ RUBY_PLATFORM
124
+ $DLDFLAGS += " " + dldflags
125
+ else
126
+ $LDFLAGS += " " + dldflags
127
+ end
128
+ $CFLAGS += " " + cflags_only_other(pkg)
129
+ if defined?($CXXFLAGS)
130
+ $CXXFLAGS += " " + cflags_only_other(pkg)
131
+ end
132
+ $INCFLAGS += " " + cflags_only_I(pkg)
133
+ end
134
+ enough_version
135
+ end
136
+ end
137
+
27
138
  class PackageConfig
28
139
  class Error < StandardError
29
140
  end
@@ -289,6 +400,14 @@ class PackageConfig
289
400
  @override_variables = default_override_variables.merge(@override_variables)
290
401
  end
291
402
 
403
+ def eql?(other)
404
+ other.is_a?(self.class) and @name == other.name
405
+ end
406
+
407
+ def hash
408
+ @name.hash
409
+ end
410
+
292
411
  def exist?
293
412
  not pc_path.nil?
294
413
  end
@@ -303,7 +422,7 @@ class PackageConfig
303
422
 
304
423
  def cflags
305
424
  path_flags, other_flags = collect_cflags
306
- (other_flags + path_flags).join(" ")
425
+ (path_flags + other_flags).join(" ")
307
426
  end
308
427
 
309
428
  def cflags_only_I
@@ -315,26 +434,25 @@ class PackageConfig
315
434
  end
316
435
 
317
436
  def libs
318
- path_flags, other_flags = collect_libs
319
- (path_flags + other_flags).join(" ")
437
+ collect_libs.join(" ")
320
438
  end
321
439
 
322
440
  def libs_only_l
323
- collect_libs[1].find_all do |arg|
441
+ collect_libs.find_all do |arg|
324
442
  if @msvc_syntax
325
- /\.lib\z/ =~ arg
443
+ arg.end_with?(".lib")
326
444
  else
327
- /\A-l/ =~ arg
445
+ arg.start_with?("-l")
328
446
  end
329
447
  end.join(" ")
330
448
  end
331
449
 
332
450
  def libs_only_L
333
- collect_libs[0].find_all do |arg|
451
+ collect_libs.find_all do |arg|
334
452
  if @msvc_syntax
335
- /\A\/libpath:/ =~ arg
453
+ arg.start_with?("/libpath:")
336
454
  else
337
- /\A-L/ =~ arg
455
+ arg.start_with?("-L")
338
456
  end
339
457
  end.join(" ")
340
458
  end
@@ -377,40 +495,32 @@ class PackageConfig
377
495
  @path_position
378
496
  end
379
497
 
380
- def collect_requires(processed_packages={}, &block)
381
- packages = []
382
- targets = yield(self)
383
- targets.each do |name|
384
- next if processed_packages.key?(name)
385
- package = self.class.new(name, @options)
386
- processed_packages[name] = package
387
- packages << package
388
- packages.concat(package.collect_requires(processed_packages, &block))
389
- end
390
- packages_without_self = packages.reject do |package|
391
- package.name == @name
392
- end
393
- packages_without_self.uniq do |package|
394
- package.name
498
+ def collect_requires(&block)
499
+ dependencies = {}
500
+ pending_packages = yield(self).collect {|name| self.class.new(name, @options)}
501
+ until pending_packages.empty?
502
+ package = pending_packages.shift
503
+ next if dependencies.key?(package)
504
+ dependencies[package] = true
505
+ targets = yield(package)
506
+ targets.each do |name|
507
+ require_package = self.class.new(name, @options)
508
+ pending_packages.push(require_package)
509
+ end
395
510
  end
511
+ dependencies.keys
396
512
  end
397
513
 
398
514
  private
399
- def sort_packages(packages)
400
- packages.sort_by.with_index do |package, i|
401
- [package.path_position, i]
402
- end
403
- end
404
-
405
515
  def collect_cflags
406
- target_packages = sort_packages([self, *all_required_packages])
516
+ target_packages = [self, *all_required_packages]
407
517
  cflags_set = []
408
518
  target_packages.each do |package|
409
519
  cflags_set << package.declaration("Cflags")
410
520
  end
411
521
  all_cflags = normalize_cflags(Shellwords.split(cflags_set.join(" ")))
412
522
  path_flags, other_flags = all_cflags.partition {|flag| /\A-I/ =~ flag}
413
- path_flags = normalize_path_flags(path_flags, "-I")
523
+ path_flags = path_flags.collect {|flag| normalize_path_flag(flag, "-I")}
414
524
  path_flags = path_flags.reject do |flag|
415
525
  flag == "-I/usr/include"
416
526
  end
@@ -423,20 +533,18 @@ class PackageConfig
423
533
  [path_flags, other_flags]
424
534
  end
425
535
 
426
- def normalize_path_flags(path_flags, flag_option)
427
- return path_flags unless /-mingw(?:32|-ucrt)\z/ === RUBY_PLATFORM
536
+ def normalize_path_flag(path_flag, flag_option)
537
+ return path_flag unless /-mingw(?:32|-ucrt)\z/ === RUBY_PLATFORM
428
538
 
429
539
  pkg_config_prefix = self.class.native_pkg_config_prefix
430
- return path_flags unless pkg_config_prefix
540
+ return path_flag unless pkg_config_prefix
431
541
 
432
542
  mingw_dir = pkg_config_prefix.basename.to_s
433
- path_flags.collect do |path_flag|
434
- path = path_flag.sub(/\A#{Regexp.escape(flag_option)}/, "")
435
- path = path.sub(/\A\/#{Regexp.escape(mingw_dir)}/i) do
436
- pkg_config_prefix.to_s
437
- end
438
- "#{flag_option}#{path}"
543
+ path = path_flag.sub(/\A#{Regexp.escape(flag_option)}/, "")
544
+ path = path.sub(/\A\/#{Regexp.escape(mingw_dir)}/i) do
545
+ pkg_config_prefix.to_s
439
546
  end
547
+ "#{flag_option}#{path}"
440
548
  end
441
549
 
442
550
  def normalize_cflags(cflags)
@@ -457,31 +565,32 @@ class PackageConfig
457
565
  end
458
566
 
459
567
  def collect_libs
460
- target_packages = sort_packages(required_packages + [self])
568
+ target_packages = [*required_packages, self]
461
569
  libs_set = []
462
570
  target_packages.each do |package|
463
571
  libs_set << package.declaration("Libs")
464
572
  end
465
- all_flags = split_lib_flags(libs_set.join(" "))
466
- path_flags, other_flags = all_flags.partition {|flag| /\A-L/ =~ flag}
467
- path_flags = normalize_path_flags(path_flags, "-L")
468
- path_flags = path_flags.reject do |flag|
573
+ flags = split_lib_flags(libs_set.join(" "))
574
+ flags = flags.collect do |flag|
575
+ flag = normalize_path_flag(flag, "-L") if flag.start_with?("-L")
576
+ flag
577
+ end
578
+ flags = flags.reject do |flag|
469
579
  /\A-L\/usr\/lib(?:64|x32)?\z/ =~ flag
470
580
  end
471
- path_flags = path_flags.uniq
581
+ flags = flags.uniq
472
582
  if @msvc_syntax
473
- path_flags = path_flags.collect do |flag|
474
- flag.gsub(/\A-L/, "/libpath:")
475
- end
476
- other_flags = other_flags.collect do |flag|
477
- if /\A-l/ =~ flag
478
- "#{$POSTMATCH}.lib"
583
+ flags = flags.collect do |flag|
584
+ if flag.start_with?("-L")
585
+ flag.gsub(/\A-L/, "/libpath:")
586
+ elsif flag.start_with?("-l")
587
+ "#{flag[2..-1]}.lib"
479
588
  else
480
589
  flag
481
590
  end
482
591
  end
483
592
  end
484
- [path_flags, other_flags]
593
+ flags
485
594
  end
486
595
 
487
596
  def split_lib_flags(libs_command_line)
@@ -514,13 +623,18 @@ class PackageConfig
514
623
  @declarations = {}
515
624
  File.open(pc_path) do |input|
516
625
  input.each_line do |line|
626
+ if line.dup.force_encoding("UTF-8").valid_encoding?
627
+ line.force_encoding("UTF-8")
628
+ end
517
629
  line = line.gsub(/#.*/, "").strip
518
630
  next if line.empty?
519
631
  case line
520
632
  when /^(#{IDENTIFIER_RE})\s*=\s*/
521
- @variables[$1] = $POSTMATCH.strip
633
+ match = Regexp.last_match
634
+ @variables[match[1]] = match.post_match.strip
522
635
  when /^(#{IDENTIFIER_RE})\s*:\s*/
523
- @declarations[$1] = $POSTMATCH.strip
636
+ match = Regexp.last_match
637
+ @declarations[match[1]] = match.post_match.strip
524
638
  end
525
639
  end
526
640
  end
@@ -566,118 +680,3 @@ class PackageConfig
566
680
  end
567
681
  end
568
682
  end
569
-
570
- module PKGConfig
571
- @@paths = []
572
- @@override_variables = {}
573
-
574
- module_function
575
- def add_path(path)
576
- @@paths << path
577
- end
578
-
579
- def set_override_variable(key, value)
580
- @@override_variables[key] = value
581
- end
582
-
583
- def msvc?
584
- /mswin/.match(RUBY_PLATFORM) and /^cl\b/.match(RbConfig::CONFIG["CC"])
585
- end
586
-
587
- def package_config(package)
588
- PackageConfig.new(package,
589
- :msvc_syntax => msvc?,
590
- :override_variables => @@override_variables,
591
- :paths => @@paths)
592
- end
593
-
594
- def exist?(pkg)
595
- package_config(pkg).exist?
596
- end
597
-
598
- def libs(pkg)
599
- package_config(pkg).libs
600
- end
601
-
602
- def libs_only_l(pkg)
603
- package_config(pkg).libs_only_l
604
- end
605
-
606
- def libs_only_L(pkg)
607
- package_config(pkg).libs_only_L
608
- end
609
-
610
- def cflags(pkg)
611
- package_config(pkg).cflags
612
- end
613
-
614
- def cflags_only_I(pkg)
615
- package_config(pkg).cflags_only_I
616
- end
617
-
618
- def cflags_only_other(pkg)
619
- package_config(pkg).cflags_only_other
620
- end
621
-
622
- def modversion(pkg)
623
- package_config(pkg).version
624
- end
625
-
626
- def description(pkg)
627
- package_config(pkg).description
628
- end
629
-
630
- def variable(pkg, name)
631
- package_config(pkg).variable(name)
632
- end
633
-
634
- def check_version?(pkg, major=0, minor=0, micro=0)
635
- return false unless exist?(pkg)
636
- ver = modversion(pkg).split(".").collect {|item| item.to_i}
637
- (0..2).each {|i| ver[i] = 0 unless ver[i]}
638
-
639
- (ver[0] > major ||
640
- (ver[0] == major && ver[1] > minor) ||
641
- (ver[0] == major && ver[1] == minor &&
642
- ver[2] >= micro))
643
- end
644
-
645
- def have_package(pkg, major=nil, minor=0, micro=0)
646
- message = "#{pkg}"
647
- unless major.nil?
648
- message << " version (>= #{major}.#{minor}.#{micro})"
649
- end
650
- major ||= 0
651
- result = checking_for(checking_message(message), "%s") do
652
- if check_version?(pkg, major, minor, micro)
653
- "yes (#{modversion(pkg)})"
654
- else
655
- if exist?(pkg)
656
- "no (#{modversion(pkg)})"
657
- else
658
- "no (nonexistent)"
659
- end
660
- end
661
- end
662
- enough_version = result.start_with?("yes")
663
- if enough_version
664
- libraries = libs_only_l(pkg)
665
- dldflags = libs(pkg)
666
- dldflags = (Shellwords.shellwords(dldflags) -
667
- Shellwords.shellwords(libraries))
668
- dldflags = dldflags.map {|s| /\s/ =~ s ? "\"#{s}\"" : s }.join(" ")
669
- $libs += " " + libraries
670
- if /mswin/ =~ RUBY_PLATFORM
671
- $DLDFLAGS += " " + dldflags
672
- else
673
- $LDFLAGS += " " + dldflags
674
- end
675
- $CFLAGS += " " + cflags_only_other(pkg)
676
- if defined?($CXXFLAGS)
677
- $CXXFLAGS += " " + cflags_only_other(pkg)
678
- end
679
- $INCFLAGS += " " + cflags_only_I(pkg)
680
- end
681
- enough_version
682
- end
683
- end
@@ -16,8 +16,7 @@ class PkgConfigTest < Test::Unit::TestCase
16
16
  @pkgconf = find_program("pkgconf") || "pkg-config"
17
17
  @custom_libdir = "/tmp/local/lib"
18
18
  options = {:override_variables => {"libdir" => @custom_libdir}}
19
- @cairo = PackageConfig.new("cairo", options)
20
- @cairo_png = PackageConfig.new("cairo-png", options)
19
+ @glib = PackageConfig.new("glib-2.0", options)
21
20
  end
22
21
 
23
22
  def only_pkg_config_version(major, minor)
@@ -28,29 +27,21 @@ class PkgConfigTest < Test::Unit::TestCase
28
27
  end
29
28
 
30
29
  def test_exist?
31
- assert(system("#{@pkgconf} --exists cairo"))
32
- assert(@cairo.exist?)
33
-
34
- assert(system("#{@pkgconf} --exists cairo-png"))
35
- assert(@cairo_png.exist?)
30
+ assert(system("#{@pkgconf} --exists glib-2.0"))
36
31
  end
37
32
 
38
33
  def test_cflags
39
34
  omit("Fragile on macOS") if RUBY_PLATFORM.include?("darwin")
40
- assert_pkg_config("cairo", ["--cflags"], @cairo.cflags)
41
- only_pkg_config_version(0, 29)
42
- assert_pkg_config("cairo-png", ["--cflags"], @cairo_png.cflags)
35
+ assert_pkg_config("glib-2.0", ["--cflags"], @glib.cflags)
43
36
  end
44
37
 
45
38
  def test_cflags_only_I
46
39
  omit("Fragile on macOS") if RUBY_PLATFORM.include?("darwin")
47
- assert_pkg_config("cairo", ["--cflags-only-I"], @cairo.cflags_only_I)
48
- only_pkg_config_version(0, 29)
49
- assert_pkg_config("cairo-png", ["--cflags-only-I"], @cairo_png.cflags_only_I)
40
+ assert_pkg_config("glib-2.0", ["--cflags-only-I"], @glib.cflags_only_I)
50
41
  end
51
42
 
52
43
  def split_lib_flags(libs_command_line)
53
- @cairo.__send__(:split_lib_flags, libs_command_line)
44
+ @glib.__send__(:split_lib_flags, libs_command_line)
54
45
  end
55
46
 
56
47
  def test_split_libs
@@ -99,60 +90,57 @@ class PkgConfigTest < Test::Unit::TestCase
99
90
  end
100
91
 
101
92
  def test_libs
102
- assert_pkg_config("cairo", ["--libs"], @cairo.libs)
103
- assert_pkg_config("cairo-png", ["--libs"], @cairo_png.libs)
93
+ assert_pkg_config("glib-2.0", ["--libs"], @glib.libs)
104
94
  end
105
95
 
106
96
  def test_libs_msvc
107
- @cairo.msvc_syntax = true
108
- result = pkg_config("cairo", "--libs")
109
- msvc_result = result.gsub(/-lcairo\b/, "cairo.lib")
97
+ @glib.msvc_syntax = true
98
+ result = pkg_config("glib-2.0", "--libs")
99
+ msvc_result = result.gsub(/-l(glib-2\.0|intl)\b/, "\\1.lib")
110
100
  msvc_result = msvc_result.gsub(/-L/, "/libpath:")
111
101
  assert_not_equal(msvc_result, result)
112
- assert_equal(msvc_result, @cairo.libs)
102
+ assert_equal(msvc_result, @glib.libs)
113
103
  end
114
104
 
115
105
  def test_libs_only_l
116
- assert_pkg_config("cairo", ["--libs-only-l"], @cairo.libs_only_l)
117
- assert_pkg_config("cairo-png", ["--libs-only-l"], @cairo_png.libs_only_l)
106
+ assert_pkg_config("glib-2.0", ["--libs-only-l"], @glib.libs_only_l)
118
107
  end
119
108
 
120
109
  def test_libs_only_l_msvc
121
- @cairo_png.msvc_syntax = true
122
- result = pkg_config("cairo-png", "--libs-only-l")
123
- msvc_result = result.gsub(/-l(cairo|png[0-9]+|z)\b/, "\\1.lib")
110
+ @glib.msvc_syntax = true
111
+ result = pkg_config("glib-2.0", "--libs-only-l")
112
+ msvc_result = result.gsub(/-l(glib-2\.0|intl)\b/, "\\1.lib")
124
113
  assert_not_equal(msvc_result, result)
125
- assert_equal(msvc_result, @cairo_png.libs_only_l)
114
+ assert_equal(msvc_result, @glib.libs_only_l)
126
115
  end
127
116
 
128
117
  def test_libs_only_L
129
- assert_pkg_config("cairo", ["--libs-only-L"], @cairo.libs_only_L)
130
- assert_pkg_config("cairo-png", ["--libs-only-L"], @cairo_png.libs_only_L)
118
+ assert_pkg_config("glib-2.0", ["--libs-only-L"], @glib.libs_only_L)
131
119
  end
132
120
 
133
121
  def test_libs_only_L_msvc
134
- @cairo_png.msvc_syntax = true
135
- result = pkg_config("cairo-png", "--libs-only-L")
122
+ @glib.msvc_syntax = true
123
+ result = pkg_config("glib-2.0", "--libs-only-L")
136
124
  msvc_result = result.gsub(/-L/, "/libpath:")
137
125
  assert_not_equal(msvc_result, result)
138
- assert_equal(msvc_result, @cairo_png.libs_only_L)
126
+ assert_equal(msvc_result, @glib.libs_only_L)
139
127
  end
140
128
 
141
129
  def test_requires
142
- assert_equal([], @cairo.requires)
130
+ assert_equal([], @glib.requires)
143
131
  end
144
132
 
145
133
  def test_requires_private
146
- requires_private = pkg_config("cairo", "--print-requires-private")
134
+ requires_private = pkg_config("glib-2.0", "--print-requires-private")
147
135
  expected_requires = requires_private.split(/\n/).collect do |require|
148
136
  require.split(/\s/, 2)[0]
149
137
  end
150
138
  assert_equal(expected_requires,
151
- @cairo.requires_private)
139
+ @glib.requires_private)
152
140
  end
153
141
 
154
142
  def test_version
155
- assert_pkg_config("cairo", ["--modversion"], @cairo.version)
143
+ assert_pkg_config("glib-2.0", ["--modversion"], @glib.version)
156
144
  end
157
145
 
158
146
  def test_parse_override_variables
@@ -169,11 +157,11 @@ class PkgConfigTest < Test::Unit::TestCase
169
157
 
170
158
  def test_override_variables
171
159
  overridden_prefix = "c:\\\\gtk-dev"
172
- original_prefix = @cairo.variable("prefix")
160
+ original_prefix = @glib.variable("prefix")
173
161
  assert_not_equal(overridden_prefix, original_prefix)
174
162
  with_override_variables("prefix=#{overridden_prefix}") do
175
- cairo = PackageConfig.new("cairo")
176
- assert_equal(overridden_prefix, cairo.variable("prefix"))
163
+ glib = PackageConfig.new("glib-2.0")
164
+ assert_equal(overridden_prefix, glib.variable("prefix"))
177
165
  end
178
166
  end
179
167
 
@@ -214,8 +202,8 @@ class PkgConfigTest < Test::Unit::TestCase
214
202
 
215
203
  def assert_override_variables(expected, override_variables)
216
204
  with_override_variables(override_variables) do
217
- cairo = PackageConfig.new("cairo")
218
- assert_equal(expected, cairo.instance_variable_get("@override_variables"))
205
+ glib = PackageConfig.new("glib-2.0")
206
+ assert_equal(expected, glib.instance_variable_get("@override_variables"))
219
207
  end
220
208
  end
221
209
 
@@ -241,14 +229,14 @@ class PkgConfigTest < Test::Unit::TestCase
241
229
 
242
230
  sub_test_case("#parse_requires") do
243
231
  def parse_requires(requires)
244
- @cairo.__send__(:parse_requires, requires)
232
+ @glib.__send__(:parse_requires, requires)
245
233
  end
246
234
 
247
235
  def test_broken_version
248
236
  assert_equal(["fribidi"],
249
237
  parse_requires("fribidi >= fribidi_required_dep"))
250
238
  end
251
-
239
+
252
240
  def test_greater_than_or_equals_to
253
241
  assert_equal(["fribidi"],
254
242
  parse_requires("fribidi >= 1.0"))
metadata CHANGED
@@ -1,57 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pkg-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.8
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
- - Kouhei Sutou
8
- autorequire:
7
+ - Sutou Kouhei
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-11-21 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: test-unit
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: bundler
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
10
+ date: 2025-03-02 00:00:00.000000000 Z
11
+ dependencies: []
55
12
  description: pkg-config can be used in your extconf.rb to properly detect need libraries
56
13
  for compiling Ruby native extensions
57
14
  email:
@@ -66,15 +23,13 @@ files:
66
23
  - README.rdoc
67
24
  - Rakefile
68
25
  - lib/pkg-config.rb
69
- - lib/pkg-config/version.rb
70
- - test/run-test.rb
26
+ - test/run.rb
71
27
  - test/test-pkg-config.rb
72
28
  homepage: https://github.com/ruby-gnome/pkg-config
73
29
  licenses:
74
30
  - LGPLv2+
75
31
  metadata:
76
32
  msys2_mingw_dependencies: pkg-config
77
- post_install_message:
78
33
  rdoc_options: []
79
34
  require_paths:
80
35
  - lib
@@ -89,10 +44,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
44
  - !ruby/object:Gem::Version
90
45
  version: '0'
91
46
  requirements: []
92
- rubygems_version: 3.5.22
93
- signing_key:
47
+ rubygems_version: 3.6.2
94
48
  specification_version: 4
95
49
  summary: A pkg-config implementation for Ruby
96
50
  test_files:
97
- - test/run-test.rb
51
+ - test/run.rb
98
52
  - test/test-pkg-config.rb
@@ -1,19 +0,0 @@
1
- # Copyright (C) 2012-2024 Sutou Kouhei <kou@cozmixng.org>
2
- #
3
- # This library is free software; you can redistribute it and/or
4
- # modify it under the terms of the GNU Lesser General Public
5
- # License as published by the Free Software Foundation; either
6
- # version 2.1 of the License, or (at your option) any later version.
7
- #
8
- # This library is distributed in the hope that it will be useful,
9
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
- # Lesser General Public License for more details.
12
- #
13
- # You should have received a copy of the GNU Lesser General Public
14
- # License along with this library; if not, write to the Free Software
15
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
-
17
- module PKGConfig
18
- VERSION = "1.5.8"
19
- end
File without changes