-
Notifications
You must be signed in to change notification settings - Fork 0
/
pkgconfig.py
32 lines (26 loc) · 1000 Bytes
/
pkgconfig.py
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
# -*- mode: python; coding: utf-8 -*-
import os
from SCons.Script import *
def getConf():
env = Environment(ENV=os.environ)
conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig,
'CheckPKG' : CheckPKG })
if not conf.CheckPKGConfig('0.15.0'):
print 'pkg-config >= 0.15.0 not found.'
Exit(1)
return conf
def ensure(conf, name, debian):
if not conf.CheckPKG(name):
print (name+' not found.')
print ("If you have Debian, try: apt-get install "+debian)
Exit(1)
def CheckPKGConfig(context, version):
context.Message( 'Checking for pkg-config... ' )
ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0]
context.Result( ret )
return ret
def CheckPKG(context, name):
context.Message( 'Checking for %s... ' % name )
ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0]
context.Result( ret )
return ret