Blob Blame History Raw
From 2fbc506f34ea0844b9cda366a8031dd022efcc09 Mon Sep 17 00:00:00 2001
From: Steve Chaplin <>
Date: Sat, 18 Sep 2010 04:29:45 +0800
Subject: [PATCH 1/4] Add support for
   ./waf configure --libdir=XXX
 Fixes #30230.

---

diff --git a/src/wscript b/src/wscript
index 7fdeffc..ca51a88 100644
--- a/src/wscript
+++ b/src/wscript
@@ -7,12 +7,15 @@ d = 'src'
 
 def build(ctx):
   print('  %s/build()' %d)
+  pycairoLibDir = os.path.join(ctx.env['LIBDIR'],
+                               'python'+ctx.env['PYTHON_VERSION'],
+                               'site-packages', 'cairo')
 
   # .py files
   ctx.new_task_gen(
     features     = 'py',
     source       = '__init__.py',
-    install_path = '${PYTHONDIR}/cairo',
+    install_path = pycairoLibDir,
     )
 
   # C extension module
@@ -22,7 +25,7 @@ def build(ctx):
     target = '_cairo',
     includes = '.',
     uselib = 'CAIRO',
-    install_path = '${PYTHONDIR}/cairo',
+    install_path = pycairoLibDir,
     )
 
   # C API
diff --git a/wscript b/wscript
index 91ebe93..a55ae55 100644
--- a/wscript
+++ b/wscript
@@ -13,6 +13,7 @@ cairo_version_required = '1.8.10'
 
 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
 
@@ -28,6 +29,7 @@ def configure(ctx):
   print('  %s/configure()' %d)
 
   env = ctx.env
+  ctx.check_tool('gnu_dirs')
   ctx.check_tool('misc')
   ctx.check_tool('compiler_cc')
   ctx.check_tool('python')
@@ -48,8 +50,8 @@ def configure(ctx):
 
   ctx.write_config_header('src/config.h')
 
-  import Options
-  print("%-40s : %s" % ('Prefix', Options.options.prefix))
+  print("%-40s : %s" % ('PREFIX', env['PREFIX']))
+  print("%-40s : %s" % ('LIBDIR', env['LIBDIR']))
 
 
 def build(ctx):
@@ -65,12 +67,7 @@ def build(ctx):
     'prefix'    : ctx.env['PREFIX'],
     'includedir': os.path.join(ctx.env['PREFIX'], 'include'),
     }
-  obj.install_path = os.path.join(ctx.env['PREFIX'], 'lib', 'pkgconfig')
-
-
-#def dist():  # create archives of project
-#  print('  %s/dist()' %d)
-# dist is predefined
+  obj.install_path = os.path.join(ctx.env['LIBDIR'], 'pkgconfig')
 
 
 def dist_hook():
-- 
1.7.2.3