File: utils.rb

package info (click to toggle)
liblastfm 0.4.0~git20090710-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 808 kB
  • sloc: cpp: 7,614; ruby: 397; ansic: 108; makefile: 49; sh: 5
file content (40 lines) | stat: -rw-r--r-- 729 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
cwd = File.dirname( __FILE__ )
require "#{cwd}/platform.rb"

def h(s, n)
  case Platform::IMPL
  when :mswin
    puts '==> '+s
  else
    puts "\033[0;#{n}m==>\033[0;0;1m #{s} \033[0;0m"
  end
end

def h1 s
    h(s, 34)
end

def h2 s
    h(s, 33)
    yield
end

def qmake_env(env, qenv)
  env=Array.new(1,env) if env.instance_of? String
  values=Array.new
  env.each { |x| values << ENV[x] if ENV[x] }
  if values.size > 0
    "#{qenv} = #{values.join(' ')}\n"
  else
    nil
  end
end

class PkgConfigNotFound < RuntimeError; end
class PkgNotFound < RuntimeError; end

def pkgconfig pkg, prettyname
  system "pkg-config --exists '#{pkg}'"
  raise PkgConfigNotFound if $? == 127
  raise PkgNotFound.new(prettyname) if $? != 0
end