pkg-config 1.0.3 → 1.0.4

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.
Files changed (5) hide show
  1. data/NEWS +4 -0
  2. data/Rakefile +1 -0
  3. data/lib/pkg-config.rb +20 -16
  4. data/test/run-test.rb +0 -7
  5. metadata +4 -4
data/NEWS CHANGED
@@ -1,5 +1,9 @@
1
1
  = NEWS
2
2
 
3
+ == 1.0.4 - 2010/09/23
4
+
5
+ * add PKGConfig.variable.
6
+
3
7
  == 1.0.3 - 2010/09/07
4
8
 
5
9
  * add path and override_variable customize API.
data/Rakefile CHANGED
@@ -52,4 +52,5 @@ end
52
52
  desc "tag the current veresion"
53
53
  task :tag do
54
54
  sh("git", "tag", "-a", version.to_s, "-m", "release #{version}!!!")
55
+ sh("git", "push", "--tags")
55
56
  end
data/lib/pkg-config.rb CHANGED
@@ -22,12 +22,16 @@ require 'English'
22
22
  require 'pathname'
23
23
 
24
24
  class PackageConfig
25
+ SEPARATOR = File::PATH_SEPARATOR
26
+
27
+ attr_reader :paths
25
28
  attr_accessor :msvc_syntax
26
29
  def initialize(name, options={})
27
30
  @name = name
28
31
  @options = options
29
- @path = @options[:path] || ENV["PKG_CONFIG_PATH"]
30
- @path = [@path, guess_default_path].compact.join(separator)
32
+ path = @options[:path] || ENV["PKG_CONFIG_PATH"]
33
+ @paths = [path, guess_default_path].compact.join(SEPARATOR).split(SEPARATOR)
34
+ @paths.unshift(@options[:paths] || [])
31
35
  @msvc_syntax = @options[:msvc_syntax]
32
36
  @variables = @declarations = nil
33
37
  override_variables = with_config("override-variables", "")
@@ -92,17 +96,13 @@ class PackageConfig
92
96
 
93
97
  private
94
98
  def pc
95
- @path.split(separator).each do |path|
99
+ @paths.each do |path|
96
100
  pc_name = File.join(path, "#{@name}.pc")
97
101
  return pc_name if File.exist?(pc_name)
98
102
  end
99
103
  return nil
100
104
  end
101
105
 
102
- def separator
103
- File::PATH_SEPARATOR
104
- end
105
-
106
106
  def collect_cflags
107
107
  all_cflags = (requires_private + requires.reverse).collect do |package|
108
108
  self.class.new(package, @options).cflags
@@ -188,7 +188,7 @@ class PackageConfig
188
188
  end
189
189
 
190
190
  def search_pkg_config_from_path(pkg_config)
191
- (ENV["PATH"] || "").split(separator).each do |path|
191
+ (ENV["PATH"] || "").split(SEPARATOR).each do |path|
192
192
  try_pkg_config = Pathname(path) + pkg_config
193
193
  return try_pkg_config if try_pkg_config.exist?
194
194
  end
@@ -235,9 +235,9 @@ class PackageConfig
235
235
  "/usr/lib64/pkgconfig",
236
236
  "/usr/lib/pkgconfig",
237
237
  "/usr/X11/lib/pkgconfig/",
238
- "/usr/share/pkgconfig"].join(separator)
238
+ "/usr/share/pkgconfig"].join(SEPARATOR)
239
239
  libdir = ENV["PKG_CONFIG_LIBDIR"]
240
- default_path = [libdir, default_path].join(separator) if libdir
240
+ default_path = [libdir, default_path].join(SEPARATOR) if libdir
241
241
 
242
242
  pkg_config = with_config("pkg-config", ENV["PKG_CONFIG"] || "pkg-config")
243
243
  pkg_config = Pathname.new(pkg_config)
@@ -253,19 +253,19 @@ class PackageConfig
253
253
  return default_path unless pkg_config.absolute?
254
254
  [(pkg_config.parent.parent + "lib" + "pkgconfig").to_s,
255
255
  (pkg_config.parent.parent + "libdata" + "pkgconfig").to_s,
256
- default_path].join(separator)
256
+ default_path].join(SEPARATOR)
257
257
  end
258
258
  end
259
259
 
260
260
  module PKGConfig
261
- VERSION = "1.0.3"
261
+ VERSION = "1.0.4"
262
262
 
263
- @@path = nil
263
+ @@paths = []
264
264
  @@override_variables = {}
265
265
 
266
266
  module_function
267
267
  def add_path(path)
268
- @@path = [path, @@path || ''].join(File::PATH_SEPARATOR)
268
+ @@paths << path
269
269
  end
270
270
 
271
271
  def set_override_variable(key, value)
@@ -278,9 +278,9 @@ module PKGConfig
278
278
 
279
279
  def package_config(package)
280
280
  PackageConfig.new(package,
281
- :path => @@path,
282
281
  :msvc_syntax => msvc?,
283
- :override_variables => @@override_variables)
282
+ :override_variables => @@override_variables,
283
+ :paths => @@paths)
284
284
  end
285
285
 
286
286
  def exist?(pkg)
@@ -311,6 +311,10 @@ module PKGConfig
311
311
  package_config(pkg).description
312
312
  end
313
313
 
314
+ def variable(pkg, name)
315
+ package_config(pkg).variable(name)
316
+ end
317
+
314
318
  def check_version?(pkg, major = 0, minor = 0, micro = 0)
315
319
  return false unless exist?(pkg)
316
320
  ver = modversion(pkg).split(".").collect{|item| item.to_i}
data/test/run-test.rb CHANGED
@@ -2,24 +2,17 @@
2
2
 
3
3
  base_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
4
4
  test_unit_dir = File.join(base_dir, "test-unit", "lib")
5
- ext_dir = File.join(base_dir, "ext", "cairo")
6
5
  lib_dir = File.join(base_dir, "lib")
7
6
  test_dir = File.join(base_dir, "test")
8
7
 
9
- if system("which make > /dev/null")
10
- system("cd #{base_dir.dump} && make > /dev/null") or exit(1)
11
- end
12
-
13
8
  $LOAD_PATH.unshift(test_unit_dir)
14
9
 
15
10
  require 'test/unit'
16
11
 
17
12
  $LOAD_PATH.unshift(base_dir)
18
- $LOAD_PATH.unshift(ext_dir)
19
13
  $LOAD_PATH.unshift(lib_dir)
20
14
 
21
15
  $LOAD_PATH.unshift(test_dir)
22
- require 'cairo-test-utils'
23
16
 
24
17
  Dir.glob("test/**/test_*.rb") do |file|
25
18
  require file.sub(/\.rb$/, '')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pkg-config
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 3
10
- version: 1.0.3
9
+ - 4
10
+ version: 1.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kouhei Sutou
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-07 00:00:00 +09:00
18
+ date: 2010-09-23 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency