pkg-config 1.5.6 → 1.6.2

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.
@@ -2,44 +2,46 @@ require "mkmf"
2
2
  require "pkg-config"
3
3
 
4
4
  class PkgConfigTest < Test::Unit::TestCase
5
+ def find_program(name)
6
+ exeext = RbConfig::CONFIG["EXEEXT"]
7
+ ENV["PATH"].split(File::PATH_SEPARATOR).each do |path|
8
+ program = File.join(path, name)
9
+ return name if File.exist?(program)
10
+ return name if File.exist?("#{program}.#{exeext}")
11
+ end
12
+ nil
13
+ end
14
+
5
15
  def setup
16
+ @pkgconf = find_program("pkgconf") || "pkg-config"
6
17
  @custom_libdir = "/tmp/local/lib"
7
18
  options = {:override_variables => {"libdir" => @custom_libdir}}
8
- @cairo = PackageConfig.new("cairo", options)
9
- @cairo_png = PackageConfig.new("cairo-png", options)
19
+ @glib = PackageConfig.new("glib-2.0", options)
10
20
  end
11
21
 
12
22
  def only_pkg_config_version(major, minor)
13
- pkg_config_version = `pkg-config --version`.chomp
23
+ pkg_config_version = `#{@pkgconf} --version`.chomp
14
24
  current_major, current_minor = pkg_config_version.split(".").collect(&:to_i)
15
25
  return if ([major, minor] <=> [current_major, current_minor]) <= 0
16
- omit("Require pkg-config #{pkg_config_version} or later")
26
+ omit("Require #{@pkgconf} #{pkg_config_version} or later")
17
27
  end
18
28
 
19
29
  def test_exist?
20
- assert(system("pkg-config --exists cairo"))
21
- assert(@cairo.exist?)
22
-
23
- assert(system("pkg-config --exists cairo-png"))
24
- assert(@cairo_png.exist?)
30
+ assert(system("#{@pkgconf} --exists glib-2.0"))
25
31
  end
26
32
 
27
33
  def test_cflags
28
34
  omit("Fragile on macOS") if RUBY_PLATFORM.include?("darwin")
29
- assert_pkg_config("cairo", ["--cflags"], @cairo.cflags)
30
- only_pkg_config_version(0, 29)
31
- assert_pkg_config("cairo-png", ["--cflags"], @cairo_png.cflags)
35
+ assert_pkg_config("glib-2.0", ["--cflags"], @glib.cflags)
32
36
  end
33
37
 
34
38
  def test_cflags_only_I
35
39
  omit("Fragile on macOS") if RUBY_PLATFORM.include?("darwin")
36
- assert_pkg_config("cairo", ["--cflags-only-I"], @cairo.cflags_only_I)
37
- only_pkg_config_version(0, 29)
38
- 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)
39
41
  end
40
42
 
41
43
  def split_lib_flags(libs_command_line)
42
- @cairo.__send__(:split_lib_flags, libs_command_line)
44
+ @glib.__send__(:split_lib_flags, libs_command_line)
43
45
  end
44
46
 
45
47
  def test_split_libs
@@ -88,60 +90,57 @@ class PkgConfigTest < Test::Unit::TestCase
88
90
  end
89
91
 
90
92
  def test_libs
91
- assert_pkg_config("cairo", ["--libs"], @cairo.libs)
92
- assert_pkg_config("cairo-png", ["--libs"], @cairo_png.libs)
93
+ assert_pkg_config("glib-2.0", ["--libs"], @glib.libs)
93
94
  end
94
95
 
95
96
  def test_libs_msvc
96
- @cairo.msvc_syntax = true
97
- result = pkg_config("cairo", "--libs")
98
- 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")
99
100
  msvc_result = msvc_result.gsub(/-L/, "/libpath:")
100
101
  assert_not_equal(msvc_result, result)
101
- assert_equal(msvc_result, @cairo.libs)
102
+ assert_equal(msvc_result, @glib.libs)
102
103
  end
103
104
 
104
105
  def test_libs_only_l
105
- assert_pkg_config("cairo", ["--libs-only-l"], @cairo.libs_only_l)
106
- 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)
107
107
  end
108
108
 
109
109
  def test_libs_only_l_msvc
110
- @cairo_png.msvc_syntax = true
111
- result = pkg_config("cairo-png", "--libs-only-l")
112
- 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")
113
113
  assert_not_equal(msvc_result, result)
114
- assert_equal(msvc_result, @cairo_png.libs_only_l)
114
+ assert_equal(msvc_result, @glib.libs_only_l)
115
115
  end
116
116
 
117
117
  def test_libs_only_L
118
- assert_pkg_config("cairo", ["--libs-only-L"], @cairo.libs_only_L)
119
- 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)
120
119
  end
121
120
 
122
121
  def test_libs_only_L_msvc
123
- @cairo_png.msvc_syntax = true
124
- result = pkg_config("cairo-png", "--libs-only-L")
122
+ @glib.msvc_syntax = true
123
+ result = pkg_config("glib-2.0", "--libs-only-L")
125
124
  msvc_result = result.gsub(/-L/, "/libpath:")
126
125
  assert_not_equal(msvc_result, result)
127
- assert_equal(msvc_result, @cairo_png.libs_only_L)
126
+ assert_equal(msvc_result, @glib.libs_only_L)
128
127
  end
129
128
 
130
129
  def test_requires
131
- assert_equal([], @cairo.requires)
130
+ assert_equal([], @glib.requires)
132
131
  end
133
132
 
134
133
  def test_requires_private
135
- requires_private = pkg_config("cairo", "--print-requires-private")
134
+ requires_private = pkg_config("glib-2.0", "--print-requires-private")
136
135
  expected_requires = requires_private.split(/\n/).collect do |require|
137
136
  require.split(/\s/, 2)[0]
138
137
  end
139
138
  assert_equal(expected_requires,
140
- @cairo.requires_private)
139
+ @glib.requires_private)
141
140
  end
142
141
 
143
142
  def test_version
144
- assert_pkg_config("cairo", ["--modversion"], @cairo.version)
143
+ assert_pkg_config("glib-2.0", ["--modversion"], @glib.version)
145
144
  end
146
145
 
147
146
  def test_parse_override_variables
@@ -158,11 +157,11 @@ class PkgConfigTest < Test::Unit::TestCase
158
157
 
159
158
  def test_override_variables
160
159
  overridden_prefix = "c:\\\\gtk-dev"
161
- original_prefix = @cairo.variable("prefix")
160
+ original_prefix = @glib.variable("prefix")
162
161
  assert_not_equal(overridden_prefix, original_prefix)
163
162
  with_override_variables("prefix=#{overridden_prefix}") do
164
- cairo = PackageConfig.new("cairo")
165
- assert_equal(overridden_prefix, cairo.variable("prefix"))
163
+ glib = PackageConfig.new("glib-2.0")
164
+ assert_equal(overridden_prefix, glib.variable("prefix"))
166
165
  end
167
166
  end
168
167
 
@@ -177,7 +176,7 @@ class PkgConfigTest < Test::Unit::TestCase
177
176
  def pkg_config(package, *args)
178
177
  args.unshift("--define-variable=libdir=#{@custom_libdir}")
179
178
  args = args.collect {|arg| arg.dump}.join(" ")
180
- normalize_pkg_config_result(`pkg-config #{args} #{package}`.strip)
179
+ normalize_pkg_config_result(`#{@pkgconf} #{args} #{package}`.strip)
181
180
  end
182
181
 
183
182
  def normalize_pkg_config_result(result)
@@ -203,8 +202,8 @@ class PkgConfigTest < Test::Unit::TestCase
203
202
 
204
203
  def assert_override_variables(expected, override_variables)
205
204
  with_override_variables(override_variables) do
206
- cairo = PackageConfig.new("cairo")
207
- 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"))
208
207
  end
209
208
  end
210
209
 
@@ -230,14 +229,14 @@ class PkgConfigTest < Test::Unit::TestCase
230
229
 
231
230
  sub_test_case("#parse_requires") do
232
231
  def parse_requires(requires)
233
- @cairo.__send__(:parse_requires, requires)
232
+ @glib.__send__(:parse_requires, requires)
234
233
  end
235
234
 
236
235
  def test_broken_version
237
236
  assert_equal(["fribidi"],
238
237
  parse_requires("fribidi >= fribidi_required_dep"))
239
238
  end
240
-
239
+
241
240
  def test_greater_than_or_equals_to
242
241
  assert_equal(["fribidi"],
243
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.6
4
+ version: 1.6.2
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: 2023-11-18 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: 1980-01-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:
@@ -62,19 +19,17 @@ extra_rdoc_files: []
62
19
  files:
63
20
  - Gemfile
64
21
  - LGPL-2.1
65
- - NEWS
22
+ - NEWS.md
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.0.dev
93
- signing_key:
47
+ rubygems_version: 3.6.7
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 2012-2023 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.6"
19
- end
File without changes