pkg-config 1.5.9 → 1.6.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: 568c790e6c8520f9e99712aa1589824a4338b70a7c4f2de671ba5ad5aa6a96f2
4
- data.tar.gz: 4e98a0c87e9449d3864f433ca38f48bfaad836567eee3f9d82d60263e4d2c640
3
+ metadata.gz: ef8beac3c87c96d3308aa5f2f8ef54f7f9036a70641609d523068ee9867c0703
4
+ data.tar.gz: ef4c71b465bb7c533629b85a300a1e258320ac1f4eea7bb042f8a378fb3a56f5
5
5
  SHA512:
6
- metadata.gz: e25b477c8c8ea1612547120a36e974a8aabf898c5dcf4fa5d4eb78b00db2ab805adc69870bcc00e2ba5a9ff10d35d4b913d6180c50fcde466ad75669afe79909
7
- data.tar.gz: 6b774c150ea79e3d5c6122373cdf368e439ac54d15a18bae06d188a56062daaaf82f2a2b369ac0a41149d962cd4627cfe9efee771d010e772eee778e95642d00
6
+ metadata.gz: f633d31398dc965c562933ecc42fa04c83451a5c7701fbed586534fbd0ecd740ae44b678c6dab666e2461c55b6601b126eb154d49be4965aacb7e0bcee0e6821
7
+ data.tar.gz: 7284c972962f75e0b6147ee338ab4ad8c4791e93c74d7857af535293b32bfd74bb2e03d4671951176bf889965df3abb34f0a43c5d9008eb1c7e7f1a90701374d
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,25 @@
1
1
  # NEWS
2
2
 
3
+ ## 1.6.1 - 2025-04-17
4
+
5
+ ### Improvements
6
+
7
+ * Added support for `--with-pkg-config-path`.
8
+ * [ruby-gnome/ruby-gnome#1670](https://github.com/ruby-gnome/ruby-gnome/issues/1670)
9
+ * Reported by Stanisław Pitucha
10
+
11
+ ### Thanks
12
+
13
+ * Stanisław Pitucha
14
+
15
+ ## 1.6.0 - 2025-03-02
16
+
17
+ ### Improvements
18
+
19
+ * Changed to use only one file: `pkg-config.rb`
20
+
21
+ * Removed `English` dependency.
22
+
3
23
  ## 1.5.9 - 2025-01-08
4
24
 
5
25
  ### 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,7 +33,7 @@ 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
38
 
39
39
  release_task = Rake.application["release"]
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.1"
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
@@ -243,7 +354,10 @@ class PackageConfig
243
354
  end
244
355
  end
245
356
  paths.concat(default_paths)
246
- paths.join(SEPARATOR)
357
+ [
358
+ with_config("pkg-config-path") || ENV["PKG_CONFIG_PATH"],
359
+ *paths,
360
+ ].compact.join(SEPARATOR)
247
361
  end
248
362
 
249
363
  def run_command(*command_line)
@@ -277,8 +391,10 @@ class PackageConfig
277
391
  @name = name
278
392
  end
279
393
  @options = options
280
- path = @options[:path] || ENV["PKG_CONFIG_PATH"]
281
- @paths = [path, self.class.default_path].compact.join(SEPARATOR).split(SEPARATOR)
394
+ @paths = [
395
+ @options[:path],
396
+ self.class.default_path,
397
+ ].compact.join(SEPARATOR).split(SEPARATOR)
282
398
  @paths.unshift(*(@options[:paths] || []))
283
399
  @paths = normalize_paths(@paths)
284
400
  @msvc_syntax = @options[:msvc_syntax]
@@ -289,6 +405,14 @@ class PackageConfig
289
405
  @override_variables = default_override_variables.merge(@override_variables)
290
406
  end
291
407
 
408
+ def eql?(other)
409
+ other.is_a?(self.class) and @name == other.name
410
+ end
411
+
412
+ def hash
413
+ @name.hash
414
+ end
415
+
292
416
  def exist?
293
417
  not pc_path.nil?
294
418
  end
@@ -303,7 +427,7 @@ class PackageConfig
303
427
 
304
428
  def cflags
305
429
  path_flags, other_flags = collect_cflags
306
- (other_flags + path_flags).join(" ")
430
+ (path_flags + other_flags).join(" ")
307
431
  end
308
432
 
309
433
  def cflags_only_I
@@ -315,26 +439,25 @@ class PackageConfig
315
439
  end
316
440
 
317
441
  def libs
318
- path_flags, other_flags = collect_libs
319
- (path_flags + other_flags).join(" ")
442
+ collect_libs.join(" ")
320
443
  end
321
444
 
322
445
  def libs_only_l
323
- collect_libs[1].find_all do |arg|
446
+ collect_libs.find_all do |arg|
324
447
  if @msvc_syntax
325
- /\.lib\z/ =~ arg
448
+ arg.end_with?(".lib")
326
449
  else
327
- /\A-l/ =~ arg
450
+ arg.start_with?("-l")
328
451
  end
329
452
  end.join(" ")
330
453
  end
331
454
 
332
455
  def libs_only_L
333
- collect_libs[0].find_all do |arg|
456
+ collect_libs.find_all do |arg|
334
457
  if @msvc_syntax
335
- /\A\/libpath:/ =~ arg
458
+ arg.start_with?("/libpath:")
336
459
  else
337
- /\A-L/ =~ arg
460
+ arg.start_with?("-L")
338
461
  end
339
462
  end.join(" ")
340
463
  end
@@ -377,40 +500,32 @@ class PackageConfig
377
500
  @path_position
378
501
  end
379
502
 
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
503
+ def collect_requires(&block)
504
+ dependencies = {}
505
+ pending_packages = yield(self).collect {|name| self.class.new(name, @options)}
506
+ until pending_packages.empty?
507
+ package = pending_packages.shift
508
+ next if dependencies.key?(package)
509
+ dependencies[package] = true
510
+ targets = yield(package)
511
+ targets.each do |name|
512
+ require_package = self.class.new(name, @options)
513
+ pending_packages.push(require_package)
514
+ end
395
515
  end
516
+ dependencies.keys
396
517
  end
397
518
 
398
519
  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
520
  def collect_cflags
406
- target_packages = sort_packages([self, *all_required_packages])
521
+ target_packages = [self, *all_required_packages]
407
522
  cflags_set = []
408
523
  target_packages.each do |package|
409
524
  cflags_set << package.declaration("Cflags")
410
525
  end
411
526
  all_cflags = normalize_cflags(Shellwords.split(cflags_set.join(" ")))
412
527
  path_flags, other_flags = all_cflags.partition {|flag| /\A-I/ =~ flag}
413
- path_flags = normalize_path_flags(path_flags, "-I")
528
+ path_flags = path_flags.collect {|flag| normalize_path_flag(flag, "-I")}
414
529
  path_flags = path_flags.reject do |flag|
415
530
  flag == "-I/usr/include"
416
531
  end
@@ -423,20 +538,18 @@ class PackageConfig
423
538
  [path_flags, other_flags]
424
539
  end
425
540
 
426
- def normalize_path_flags(path_flags, flag_option)
427
- return path_flags unless /-mingw(?:32|-ucrt)\z/ === RUBY_PLATFORM
541
+ def normalize_path_flag(path_flag, flag_option)
542
+ return path_flag unless /-mingw(?:32|-ucrt)\z/ === RUBY_PLATFORM
428
543
 
429
544
  pkg_config_prefix = self.class.native_pkg_config_prefix
430
- return path_flags unless pkg_config_prefix
545
+ return path_flag unless pkg_config_prefix
431
546
 
432
547
  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}"
548
+ path = path_flag.sub(/\A#{Regexp.escape(flag_option)}/, "")
549
+ path = path.sub(/\A\/#{Regexp.escape(mingw_dir)}/i) do
550
+ pkg_config_prefix.to_s
439
551
  end
552
+ "#{flag_option}#{path}"
440
553
  end
441
554
 
442
555
  def normalize_cflags(cflags)
@@ -457,31 +570,32 @@ class PackageConfig
457
570
  end
458
571
 
459
572
  def collect_libs
460
- target_packages = sort_packages(required_packages + [self])
573
+ target_packages = [*required_packages, self]
461
574
  libs_set = []
462
575
  target_packages.each do |package|
463
576
  libs_set << package.declaration("Libs")
464
577
  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|
578
+ flags = split_lib_flags(libs_set.join(" "))
579
+ flags = flags.collect do |flag|
580
+ flag = normalize_path_flag(flag, "-L") if flag.start_with?("-L")
581
+ flag
582
+ end
583
+ flags = flags.reject do |flag|
469
584
  /\A-L\/usr\/lib(?:64|x32)?\z/ =~ flag
470
585
  end
471
- path_flags = path_flags.uniq
586
+ flags = flags.uniq
472
587
  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"
588
+ flags = flags.collect do |flag|
589
+ if flag.start_with?("-L")
590
+ flag.gsub(/\A-L/, "/libpath:")
591
+ elsif flag.start_with?("-l")
592
+ "#{flag[2..-1]}.lib"
479
593
  else
480
594
  flag
481
595
  end
482
596
  end
483
597
  end
484
- [path_flags, other_flags]
598
+ flags
485
599
  end
486
600
 
487
601
  def split_lib_flags(libs_command_line)
@@ -521,9 +635,11 @@ class PackageConfig
521
635
  next if line.empty?
522
636
  case line
523
637
  when /^(#{IDENTIFIER_RE})\s*=\s*/
524
- @variables[$1] = $POSTMATCH.strip
638
+ match = Regexp.last_match
639
+ @variables[match[1]] = match.post_match.strip
525
640
  when /^(#{IDENTIFIER_RE})\s*:\s*/
526
- @declarations[$1] = $POSTMATCH.strip
641
+ match = Regexp.last_match
642
+ @declarations[match[1]] = match.post_match.strip
527
643
  end
528
644
  end
529
645
  end
@@ -569,118 +685,3 @@ class PackageConfig
569
685
  end
570
686
  end
571
687
  end
572
-
573
- module PKGConfig
574
- @@paths = []
575
- @@override_variables = {}
576
-
577
- module_function
578
- def add_path(path)
579
- @@paths << path
580
- end
581
-
582
- def set_override_variable(key, value)
583
- @@override_variables[key] = value
584
- end
585
-
586
- def msvc?
587
- /mswin/.match(RUBY_PLATFORM) and /^cl\b/.match(RbConfig::CONFIG["CC"])
588
- end
589
-
590
- def package_config(package)
591
- PackageConfig.new(package,
592
- :msvc_syntax => msvc?,
593
- :override_variables => @@override_variables,
594
- :paths => @@paths)
595
- end
596
-
597
- def exist?(pkg)
598
- package_config(pkg).exist?
599
- end
600
-
601
- def libs(pkg)
602
- package_config(pkg).libs
603
- end
604
-
605
- def libs_only_l(pkg)
606
- package_config(pkg).libs_only_l
607
- end
608
-
609
- def libs_only_L(pkg)
610
- package_config(pkg).libs_only_L
611
- end
612
-
613
- def cflags(pkg)
614
- package_config(pkg).cflags
615
- end
616
-
617
- def cflags_only_I(pkg)
618
- package_config(pkg).cflags_only_I
619
- end
620
-
621
- def cflags_only_other(pkg)
622
- package_config(pkg).cflags_only_other
623
- end
624
-
625
- def modversion(pkg)
626
- package_config(pkg).version
627
- end
628
-
629
- def description(pkg)
630
- package_config(pkg).description
631
- end
632
-
633
- def variable(pkg, name)
634
- package_config(pkg).variable(name)
635
- end
636
-
637
- def check_version?(pkg, major=0, minor=0, micro=0)
638
- return false unless exist?(pkg)
639
- ver = modversion(pkg).split(".").collect {|item| item.to_i}
640
- (0..2).each {|i| ver[i] = 0 unless ver[i]}
641
-
642
- (ver[0] > major ||
643
- (ver[0] == major && ver[1] > minor) ||
644
- (ver[0] == major && ver[1] == minor &&
645
- ver[2] >= micro))
646
- end
647
-
648
- def have_package(pkg, major=nil, minor=0, micro=0)
649
- message = "#{pkg}"
650
- unless major.nil?
651
- message << " version (>= #{major}.#{minor}.#{micro})"
652
- end
653
- major ||= 0
654
- result = checking_for(checking_message(message), "%s") do
655
- if check_version?(pkg, major, minor, micro)
656
- "yes (#{modversion(pkg)})"
657
- else
658
- if exist?(pkg)
659
- "no (#{modversion(pkg)})"
660
- else
661
- "no (nonexistent)"
662
- end
663
- end
664
- end
665
- enough_version = result.start_with?("yes")
666
- if enough_version
667
- libraries = libs_only_l(pkg)
668
- dldflags = libs(pkg)
669
- dldflags = (Shellwords.shellwords(dldflags) -
670
- Shellwords.shellwords(libraries))
671
- dldflags = dldflags.map {|s| /\s/ =~ s ? "\"#{s}\"" : s }.join(" ")
672
- $libs += " " + libraries
673
- if /mswin/ =~ RUBY_PLATFORM
674
- $DLDFLAGS += " " + dldflags
675
- else
676
- $LDFLAGS += " " + dldflags
677
- end
678
- $CFLAGS += " " + cflags_only_other(pkg)
679
- if defined?($CXXFLAGS)
680
- $CXXFLAGS += " " + cflags_only_other(pkg)
681
- end
682
- $INCFLAGS += " " + cflags_only_I(pkg)
683
- end
684
- enough_version
685
- end
686
- 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,56 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pkg-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.9
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
- - Kouhei Sutou
7
+ - Sutou Kouhei
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-01-08 00:00:00.000000000 Z
11
- dependencies:
12
- - !ruby/object:Gem::Dependency
13
- name: test-unit
14
- requirement: !ruby/object:Gem::Requirement
15
- requirements:
16
- - - ">="
17
- - !ruby/object:Gem::Version
18
- version: '0'
19
- type: :development
20
- prerelease: false
21
- version_requirements: !ruby/object:Gem::Requirement
22
- requirements:
23
- - - ">="
24
- - !ruby/object:Gem::Version
25
- version: '0'
26
- - !ruby/object:Gem::Dependency
27
- name: rake
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: '0'
33
- type: :development
34
- prerelease: false
35
- version_requirements: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: '0'
40
- - !ruby/object:Gem::Dependency
41
- name: bundler
42
- requirement: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: '0'
47
- type: :development
48
- prerelease: false
49
- version_requirements: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: '0'
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
54
12
  description: pkg-config can be used in your extconf.rb to properly detect need libraries
55
13
  for compiling Ruby native extensions
56
14
  email:
@@ -65,8 +23,7 @@ files:
65
23
  - README.rdoc
66
24
  - Rakefile
67
25
  - lib/pkg-config.rb
68
- - lib/pkg-config/version.rb
69
- - test/run-test.rb
26
+ - test/run.rb
70
27
  - test/test-pkg-config.rb
71
28
  homepage: https://github.com/ruby-gnome/pkg-config
72
29
  licenses:
@@ -87,9 +44,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
44
  - !ruby/object:Gem::Version
88
45
  version: '0'
89
46
  requirements: []
90
- rubygems_version: 3.6.2
47
+ rubygems_version: 3.6.7
91
48
  specification_version: 4
92
49
  summary: A pkg-config implementation for Ruby
93
50
  test_files:
94
- - test/run-test.rb
51
+ - test/run.rb
95
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.9"
19
- end
File without changes