pkg-config 1.5.9 → 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: 568c790e6c8520f9e99712aa1589824a4338b70a7c4f2de671ba5ad5aa6a96f2
4
- data.tar.gz: 4e98a0c87e9449d3864f433ca38f48bfaad836567eee3f9d82d60263e4d2c640
3
+ metadata.gz: 9271911be7ad02986afe55f8d4f0500c71ee9c0041ac3d04848ef77db62db6d1
4
+ data.tar.gz: 6e85abd87a218c0ceb11ec08d80aa5bced06be9af3dea3ec2b142b394b33f058
5
5
  SHA512:
6
- metadata.gz: e25b477c8c8ea1612547120a36e974a8aabf898c5dcf4fa5d4eb78b00db2ab805adc69870bcc00e2ba5a9ff10d35d4b913d6180c50fcde466ad75669afe79909
7
- data.tar.gz: 6b774c150ea79e3d5c6122373cdf368e439ac54d15a18bae06d188a56062daaaf82f2a2b369ac0a41149d962cd4627cfe9efee771d010e772eee778e95642d00
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,13 @@
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
+
3
11
  ## 1.5.9 - 2025-01-08
4
12
 
5
13
  ### 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.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)
@@ -521,9 +630,11 @@ class PackageConfig
521
630
  next if line.empty?
522
631
  case line
523
632
  when /^(#{IDENTIFIER_RE})\s*=\s*/
524
- @variables[$1] = $POSTMATCH.strip
633
+ match = Regexp.last_match
634
+ @variables[match[1]] = match.post_match.strip
525
635
  when /^(#{IDENTIFIER_RE})\s*:\s*/
526
- @declarations[$1] = $POSTMATCH.strip
636
+ match = Regexp.last_match
637
+ @declarations[match[1]] = match.post_match.strip
527
638
  end
528
639
  end
529
640
  end
@@ -569,118 +680,3 @@ class PackageConfig
569
680
  end
570
681
  end
571
682
  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.0
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: 2025-03-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:
@@ -91,5 +48,5 @@ rubygems_version: 3.6.2
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