diff options
author | Steve Chaplin <stevech1097@yahoo.com.au> | 2009-08-26 13:05:05 +0800 |
---|---|---|
committer | Steve Chaplin <stevech1097@yahoo.com.au> | 2009-08-26 13:05:05 +0800 |
commit | c6d000b7082546aeb3b964a89465e72bf52f9809 (patch) | |
tree | 75f71194afa682dd15238ad5adfc96a4843b62f4 | |
parent | ac97a979a5a446749682effd127a6d9ba23ea26a (diff) | |
download | py2cairo-c6d000b7082546aeb3b964a89465e72bf52f9809.tar.gz |
Add waf files.
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | INSTALL | 32 | ||||
-rw-r--r-- | src/wscript | 32 | ||||
-rw-r--r-- | wscript | 64 |
4 files changed, 118 insertions, 13 deletions
@@ -1,7 +1,9 @@ # .deps .libs +.lock-wscript .perf +.waf* # aclocal.m4 autom4te.cache @@ -27,6 +29,7 @@ releases stamp-h stamp-h1 stamp-h.in +waf # *~ .*.sw? @@ -1,26 +1,32 @@ -Install method1 - preferred method ---------------- +GNU Autotools - install method 1 - preferred method +-------------------------------- Using the same install method of install as cairo - GNU autotools. - $ python -c "import sys; print sys.prefix" - # make a note of the python prefix - $ ./configure --prefix=<python_prefix> - $ make - $ make install # may require superuser access + $ python -c "import sys; print sys.prefix" + # make a note of the python prefix + $ ./configure --prefix=<python_prefix> + $ make + $ make install # may require superuser access To build from CVS, use this line instead of the configure line above: - $ ./autogen.sh --prefix=<python_prefix> + $ ./autogen.sh --prefix=<python_prefix> If you're installing to another prefix than the one where Python is installed Python will not be able to find the cairo module until you add $prefix/lib/pythonX.Y/site-packages to the PYTHONPATH variable. -Install method2 - alternative install method ---------------- - 1. Untar the .tar.gz file - 2. cd into the resulting directory - 3. python setup.py install +Waf - install method 2 - alternative install method +---------------------- +$ ./waf --help # shows available waf options +$ ./waf configure +$ ./waf build +$ ./waf install + + +Python distutils - install method 3 - alternative install method +----------------------------------- +$ python setup.py install Testing diff --git a/src/wscript b/src/wscript new file mode 100644 index 0000000..0680c1c --- /dev/null +++ b/src/wscript @@ -0,0 +1,32 @@ +# -*- python -*- + +import os + + +d = 'src' + +def build(bld): + print(' %s/build' %d) + + # .py files + bld.new_task_gen( + features = 'py', + source = '__init__.py', + install_path = '${PYTHONDIR}/cairo', + ) + + # C extension module + bld.new_task_gen( + features = 'cc cshlib pyext', + source = 'cairomodule.c context.c font.c path.c pattern.c matrix.c surface.c', + target = '_cairo', + includes = '.', + uselib = 'CAIRO', + install_path = '${PYTHONDIR}/cairo', + ) + + # C API + bld.install_files(os.path.join(bld.env['PREFIX'], 'include', 'pycairo'), + 'pycairo.h') + + # how to strip binaries ? @@ -0,0 +1,64 @@ +# -*- python -*- + +import io +import os + +APPNAME='pycairo' +VERSION='1.8.7' +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='1.8.8', + 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) + + +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) |