[Pkg-ime-devel] Bug#646001: sunpinyin: breaks if LDFLAGS in environment contains multiple words
Colin Watson
cjwatson at ubuntu.com
Thu Oct 20 13:46:32 UTC 2011
Package: sunpinyin
Version: 2.0.3-5
Severity: normal
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch precise
If LDFLAGS is set in the environment to a string composed of multiple
words when building sunpinyin, then scons will fail to detect C library
functions because it tries to build test programs with a command of the
form:
gcc "-Wl,... -Wl,..." -Wl,...
... i.e. the original value of LDFLAGS is passed in as a single argument
rather than split on whitespace in the usual way. This happens because
PassVariables copies LDFLAGS from the process environment into LINKFLAGS
in the SCons environment, and then uses env.Append(LINKFLAGS=[...]),
which ends up constructing a list whose first element is the entire
value of LDFLAGS.
The problem is fairly obscure, but the fix is fortunately
straightforward: split the value of LDFLAGS.
* If LDFLAGS is set in the environment, split it on whitespace since we
later want to append lists to it. This stops function detection going
horribly wrong if LDFLAGS contains more than one word.
diff -Nru sunpinyin-2.0.3/debian/patches/fix-ldflags-handling.patch sunpinyin-2.0.3/debian/patches/fix-ldflags-handling.patch
--- sunpinyin-2.0.3/debian/patches/fix-ldflags-handling.patch 1970-01-01 01:00:00.000000000 +0100
+++ sunpinyin-2.0.3/debian/patches/fix-ldflags-handling.patch 2011-10-20 14:45:35.000000000 +0100
@@ -0,0 +1,24 @@
+Description: Split LDFLAGS on whitespace
+ If LDFLAGS is set in the environment, split it on whitespace since we later
+ want to append lists to it. This stops function detection going horribly
+ wrong if LDFLAGS contains more than one word.
+Author: Colin Watson <cjwatson at ubuntu.com>
+Forwarded: no
+Last-Update: 2011-10-20
+
+Index: b/SConstruct
+===================================================================
+--- a/SConstruct
++++ b/SConstruct
+@@ -158,7 +158,10 @@
+ for (x, y) in envvar:
+ if x in os.environ:
+ print 'Warning: you\'ve set %s in the environmental variable!' % x
+- env[y] = os.environ[x]
++ if y == 'LINKFLAGS':
++ env[y] = os.environ[x].split()
++ else:
++ env[y] = os.environ[x]
+
+ env = CreateEnvironment()
+ opts.Update(env)
diff -Nru sunpinyin-2.0.3/debian/patches/series sunpinyin-2.0.3/debian/patches/series
--- sunpinyin-2.0.3/debian/patches/series 2011-09-27 15:03:57.000000000 +0100
+++ sunpinyin-2.0.3/debian/patches/series 2011-10-20 14:32:59.000000000 +0100
@@ -3,3 +3,4 @@
fix-ftbfs-on-sh.patch
fix-ftbfs-on-mipsel.patch
remove-10-candidate-words-limitation.patch
+fix-ldflags-handling.patch
Thanks,
--
Colin Watson [cjwatson at ubuntu.com]
More information about the Pkg-ime-devel
mailing list