* Luk Claes | 2009-03-25 19:17:57 [+0100]:

>Julien Cristau wrote:
>> On Wed, 2009-03-25 at 09:45 +0100, Sebastian Andrzej Siewior wrote:
>>> The problem here is that it is not just a library. libkatze itself is a
>>> .a static library which is merged into midori and this is fine. But it
>>> is also merged into a few add-ons which are .so and that's where you
>>> need the -fPIC because now the static library becomes suddenly a shared
>>> library as well.
>> 
>> Then one possible fix is to build it twice, once with -fPIC to use in
>> shared objects, and once without it for midori.
>
>Which is the only sane way to do it if you need both static and shared
>objects.

please see attached. Tested here on amd64 and it looks like working.

>Cheers
>
>Luk

Sebastian
>From 83144898f3c88e68f2a71e417181c71db5529da2 Mon Sep 17 00:00:00 2001
From: Sebastian Andrzej Siewior <sebast...@breakpoint.cc>
Date: Wed, 25 Mar 2009 21:59:29 +0100
Subject: [PATCH] build: use -fPIC when needed

change the build process a little for libkatze:
- build it once with -fPIC. This version is used by the .so /extensions
- build it again without -fPIC. This version is used by midori binary
  itself

This is a litle cleanup & fix for build problems on hppa & mips.
Signed-off-by: Sebastian Andrzej Siewior <sebast...@breakpoint.cc>
---
 extensions/wscript_build |    2 +-
 katze/wscript_build      |   25 +++++++++++++------------
 midori/wscript_build     |   10 +---------
 3 files changed, 15 insertions(+), 22 deletions(-)

diff --git a/extensions/wscript_build b/extensions/wscript_build
index 8ce7027..64c6132 100644
--- a/extensions/wscript_build
+++ b/extensions/wscript_build
@@ -26,5 +26,5 @@ for extension in extensions:
     obj.includes = '..'
     obj.source = source
     obj.uselib = 'UNIQUE LIBSOUP GIO GTK SQLITE WEBKIT LIBXML'
-    obj.uselib_local = 'katze'
+    obj.uselib_local = 'katze_dynamic'
     obj.install_path = '${LIBDIR}/midori'
diff --git a/katze/wscript_build b/katze/wscript_build
index 128fd35..73a07b1 100644
--- a/katze/wscript_build
+++ b/katze/wscript_build
@@ -2,15 +2,16 @@
 # WAF build script for midori
 # This file is licensed under the terms of the expat license, see the file 
EXPAT.
 
-import platform
-
-obj = bld.new_task_gen ('cc', 'staticlib')
-obj.name = 'katze'
-obj.target = 'katze'
-obj.includes = '. ../.'
-obj.find_sources_in_dirs ('.')
-obj.uselib = 'GMODULE LIBSOUP GTK LIBXML'
-obj.install_path = None
-
-if platform.architecture ()[0] == '64bit':
-    obj.env.append_value ('CCFLAGS', '-fPIC')
+for run in [0, 1]:
+       obj = bld.new_task_gen ('cc', 'staticlib')
+       if run == 0:
+               obj.name = 'katze_dynamic'
+               obj.target = 'katze_dynamic'
+               obj.env.append_value ('CCFLAGS', '-fPIC')
+       else:
+               obj.name = 'katze_static'
+               obj.target = 'katze_static'
+       obj.includes = '. ../.'
+       obj.find_sources_in_dirs ('.')
+       obj.uselib = 'GMODULE LIBSOUP GTK LIBXML'
+       obj.install_path = None
diff --git a/midori/wscript_build b/midori/wscript_build
index 91f5302..b9797d7 100644
--- a/midori/wscript_build
+++ b/midori/wscript_build
@@ -2,8 +2,6 @@
 # WAF build script for midori
 # This file is licensed under the terms of the expat license, see the file 
EXPAT.
 
-import platform
-
 obj = bld.new_task_gen ('cc', 'staticlib')
 obj.name = 'midori'
 obj.target = 'midori'
@@ -11,12 +9,9 @@ obj.includes = '. ..'
 obj.find_sources_in_dirs ('.', excludes=['main.c'])
 obj.add_marshal_file ('marshal.list', 'midori_cclosure_marshal')
 obj.uselib = 'UNIQUE LIBSOUP LIBIDN GIO GTK SQLITE WEBKIT LIBXML HILDON'
-obj.uselib_local = 'katze'
+obj.uselib_local = 'katze_static'
 obj.install_path = None
 
-if platform.architecture ()[0] == '64bit':
-    obj.env.append_value ('CCFLAGS', '-fPIC')
-
 obj = bld.new_task_gen ('cc', 'staticlib')
 obj.name = 'panels'
 obj.target = 'panels'
@@ -26,9 +21,6 @@ obj.uselib = 'UNIQUE LIBSOUP GMODULE GTHREAD GIO GTK SQLITE 
WEBKIT LIBXML'
 obj.uselib_local = 'midori'
 obj.install_path = None
 
-if platform.architecture ()[0] == '64bit':
-    obj.env.append_value ('CCFLAGS', '-fPIC')
-
 obj = bld.new_task_gen ('cc', 'program')
 obj.target = 'midori'
 obj.includes = '. .. ../panels'
-- 
1.6.2.1

Reply via email to