summaryrefslogtreecommitdiff
path: root/wscript
diff options
context:
space:
mode:
Diffstat (limited to 'wscript')
-rw-r--r--wscript98
1 files changed, 61 insertions, 37 deletions
diff --git a/wscript b/wscript
index ff01ffe..d217650 100644
--- a/wscript
+++ b/wscript
@@ -2,71 +2,95 @@
import os
+top = '.'
+out = 'build_directory'
+d = top
+
APPNAME='py2cairo'
VERSION='1.8.11'
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 set_options(ctx):
+ print(' %s/set_options()' %d)
+ ctx.tool_options('gnu_dirs')
+ ctx.tool_options('compiler_cc')
+ ctx.tool_options('python') # options for disabling pyc or pyo compilation
def init():
- print(' %s/init' %d)
+ print(' %s/init()' %d)
+
+def shutdown():
+ print(' %s/shutdown()' %d)
-def configure(conf):
- print(' %s/configure' %d)
+def configure(ctx):
+ 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,
+ env = ctx.env
+ ctx.check_tool('gnu_dirs')
+ ctx.check_tool('misc')
+ ctx.check_tool('compiler_cc')
+ ctx.check_tool('python')
+ ctx.check_python_version((2,6,0))
+ ctx.check_python_headers()
+ ctx.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)
+ env.append_unique('CCFLAGS', ['-std=c99', '-Wall'])
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])
+ ctx.define('VERSION', VERSION)
+ ctx.define('PYCAIRO_VERSION_MAJOR', version[0])
+ ctx.define('PYCAIRO_VERSION_MINOR', version[1])
+ ctx.define('PYCAIRO_VERSION_MICRO', version[2])
- conf.write_config_header('src/config.h')
+ ctx.write_config_header('src/config.h')
+ print("Configuration:")
+ print("%-40s : %s" % ('PREFIX', env['PREFIX']))
+ print("%-40s : %s" % ('LIBDIR', env['LIBDIR']))
-def build(bld):
- print(' %s/build' %d)
- bld.add_subdirs('src')
+
+def build(ctx):
+ print(' %s/build()' %d)
+ ctx.add_subdirs('src')
# generate and install the .pc file
- obj = bld.new_task_gen('subst')
+ obj = ctx.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'),
+ 'prefix' : ctx.env['PREFIX'],
+ 'includedir': os.path.join(ctx.env['PREFIX'], 'include'),
}
- obj.install_path = os.path.join(bld.env['PREFIX'], 'lib', 'pkgconfig')
+ obj.install_path = os.path.join(ctx.env['PREFIX'], 'lib', 'pkgconfig')
-def dist(): # create archives of project
- print(' %s/dist' %d)
+def dist_hook():
+ # remove unwanted files from the archive
+ # individual files
+ for f in [
+ 'RELEASING',
+ 'examples/cairo_snippets/c_to_python.py',
+ 'doc/html_docs_create.sh',
+ 'doc/html_docs_upload.sh',
+ ]:
+ os.remove(f)
+
+ # rm examples/*.{pdf,png,ps,svg}
+ D='examples'
+ for f in os.listdir(D):
+ if f.endswith(('.pdf', '.png', '.ps', '.svg')):
+ os.remove(os.path.join(D, f))
+
+ D='examples/cairo_snippets/snippets'
+ for f in os.listdir(D):
+ if f.endswith(('.pdf', '.png', '.ps', '.svg')):
+ os.remove(os.path.join(D, f))
-def shutdown():
- print(' %s/shutdown' %d)