Add waf files.

This commit is contained in:
Steve Chaplin 2009-08-26 13:05:05 +08:00 committed by Christoph Reiter
parent 998eeafd7c
commit 36b4cf221c
4 changed files with 118 additions and 13 deletions

3
.gitignore vendored
View File

@ -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?

32
INSTALL
View File

@ -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

32
src/wscript Normal file
View File

@ -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 ?

64
wscript Normal file
View File

@ -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)