summaryrefslogtreecommitdiff
path: root/wscript
blob: a0b18940bf560b1195bb577ab5ec22a9f6db20ac (plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# -*- python -*-

import os

APPNAME='pycairo'
VERSION='1.8.10'
cairo_version_required = '1.8.10'
srcdir = '.'
blddir = '../%s-build' % APPNAME

d = srcdir


def set_options(opt):
  print('  %s/set_options' %d)
  opt.tool_options('compiler_cc')
  opt.tool_options('python') # options for disabling pyc or pyo compilation


def init():
  print('  %s/init' %d)


def configure(conf):
  print('  %s/configure' %d)

  env = conf.env
  conf.check_tool('misc')
  conf.check_tool('compiler_cc')
  conf.check_tool('python')
  conf.check_python_version((2,6,0))
  conf.check_python_headers()
  conf.check_cfg(package='cairo', atleast_version=cairo_version_required,
                 args='--cflags --libs')

  # add gcc options
  if env['CC_NAME'] == 'gcc':
    for opt in ('-std=c99', '-Wall'):
      if opt not in env['CCFLAGS']:
        env.append_value('CCFLAGS', opt)

  version = [int(s) for s in VERSION.split('.')]
  conf.define('VERSION', VERSION)
  conf.define('PYCAIRO_VERSION_MAJOR', version[0])
  conf.define('PYCAIRO_VERSION_MINOR', version[1])
  conf.define('PYCAIRO_VERSION_MICRO', version[2])

  conf.write_config_header('src/config.h')


def build(bld):
  print('  %s/build' %d)
  bld.add_subdirs('src')

  # generate and install the .pc file
  obj = bld.new_task_gen('subst')
  obj.source = 'pycairo.pc.in'
  obj.target = 'pycairo.pc'
  obj.dict = {
    'VERSION'   : VERSION,
    'prefix'    : bld.env['PREFIX'],
    'includedir': os.path.join(bld.env['PREFIX'], 'include'),
    }
  obj.install_path = os.path.join(bld.env['PREFIX'], 'lib', 'pkgconfig')


def dist():  # create archives of project
  print('  %s/dist' %d)


def shutdown():
  print('  %s/shutdown' %d)