summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/swig
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@microsoft.com>2019-03-04 12:42:08 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-03-04 22:57:05 +0000
commitc3acb677fa5b262511716446ed9330a87508774f (patch)
tree14e0838b3affb7104cbfea758a4f44a170d4ca7f /meta/recipes-devtools/swig
parent74a8b244ded9a914ca3f2cfca917a223b9e628c9 (diff)
downloadpoky-c3acb677fa5b262511716446ed9330a87508774f.tar.gz
swig: fix build with musl
Building with musl currently fails. The fix has been committed upstream, so backport it. Note that it requires running yacc again to regenerate the parser file, so a bison-native dependency is needed. Also the upstream's configure step creates the directory where the parser file is generated at make-dist time, and for some reason running through bitbake does not create it, so do it manually. All of this can be reverted once a new swig version that includes the fix is released and rebased onto. (From OE-Core rev: 92d23674587fb9c6634b9ba88b8399b0ec40bd1c) Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/swig')
-rw-r--r--meta/recipes-devtools/swig/swig.inc8
-rw-r--r--meta/recipes-devtools/swig/swig/0001-Fix-generated-code-for-constant-expressions-containi.patch179
-rw-r--r--meta/recipes-devtools/swig/swig_3.0.12.bb1
3 files changed, 187 insertions, 1 deletions
diff --git a/meta/recipes-devtools/swig/swig.inc b/meta/recipes-devtools/swig/swig.inc
index f7de40866a..00b9c5b605 100644
--- a/meta/recipes-devtools/swig/swig.inc
+++ b/meta/recipes-devtools/swig/swig.inc
@@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=e7807a6282784a7dde4c846626b08fc6 \
7 7
8SECTION = "devel" 8SECTION = "devel"
9 9
10DEPENDS = "libpcre" 10DEPENDS = "libpcre bison-native"
11 11
12SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz" 12SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz"
13 13
@@ -42,6 +42,12 @@ EXTRA_AUTORECONF += "-I Tools/config"
42 42
43BBCLASSEXTEND = "native nativesdk" 43BBCLASSEXTEND = "native nativesdk"
44 44
45# necessary together with bison dependency until a new upstream version after
46# 3.0.12 includes 0001-Fix-generated-code-for-constant-expressions-containi.patch
47do_configure_append() {
48 mkdir -p ${B}/Source/CParse
49}
50
45do_install_append_class-nativesdk() { 51do_install_append_class-nativesdk() {
46 cd ${D}${bindir} 52 cd ${D}${bindir}
47 ln -s swig swig2.0 53 ln -s swig swig2.0
diff --git a/meta/recipes-devtools/swig/swig/0001-Fix-generated-code-for-constant-expressions-containi.patch b/meta/recipes-devtools/swig/swig/0001-Fix-generated-code-for-constant-expressions-containi.patch
new file mode 100644
index 0000000000..f4ed782a82
--- /dev/null
+++ b/meta/recipes-devtools/swig/swig/0001-Fix-generated-code-for-constant-expressions-containi.patch
@@ -0,0 +1,179 @@
1From 90ba174fcea1618af57aa594199541d47a89b7f6 Mon Sep 17 00:00:00 2001
2From: William S Fulton <wsf@fultondesigns.co.uk>
3Date: Sun, 17 Sep 2017 19:02:55 +0100
4Subject: [PATCH 1/2] Fix generated code for constant expressions containing
5 wchar_t L literals.
6
7Such as:
8 # define __WCHAR_MAX (0x7fffffff + L'\0')
9
10Reported on swig-user mailing list.
11---
12 CHANGES.current | 5 +++++
13 Examples/test-suite/csharp/preproc_constants_c_runme.cs | 3 ++-
14 Examples/test-suite/csharp/preproc_constants_runme.cs | 2 ++
15 Examples/test-suite/d/preproc_constants_c_runme.1.d | 2 ++
16 Examples/test-suite/d/preproc_constants_c_runme.2.d | 2 ++
17 Examples/test-suite/d/preproc_constants_runme.1.d | 2 ++
18 Examples/test-suite/d/preproc_constants_runme.2.d | 2 ++
19 Examples/test-suite/php/preproc_constants_c_runme.php | 2 ++
20 Examples/test-suite/php/preproc_constants_runme.php | 2 ++
21 Examples/test-suite/php5/preproc_constants_c_runme.php | 2 ++
22 Examples/test-suite/php5/preproc_constants_runme.php | 2 ++
23 Examples/test-suite/preproc_constants.i | 3 +++
24 Source/CParse/parser.y | 2 +-
25 13 files changed, 29 insertions(+), 2 deletions(-)
26
27Upstream-Status: Backport
28[https://github.com/swig/swig/commit/90ba174fcea1618af57aa594199541d47a89b7f6]
29Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
30
31diff --git a/Examples/test-suite/csharp/preproc_constants_c_runme.cs b/Examples/test-suite/csharp/preproc_constants_c_runme.cs
32index 76c684d..1c28e49 100644
33--- a/Examples/test-suite/csharp/preproc_constants_c_runme.cs
34+++ b/Examples/test-suite/csharp/preproc_constants_c_runme.cs
35@@ -61,7 +61,8 @@ public class runme {
36 assert( typeof(int) == preproc_constants_c.EXPR_LAND.GetType() );
37 assert( typeof(int) == preproc_constants_c.EXPR_LOR.GetType() );
38 assert( typeof(double) == preproc_constants_c.EXPR_CONDITIONAL.GetType() );
39-
40+ assert( typeof(int) == preproc_constants_c.EXPR_WCHAR_MAX.GetType() );
41+ assert( typeof(int) == preproc_constants_c.EXPR_WCHAR_MIN.GetType() );
42 }
43 static void assert(bool assertion) {
44 if (!assertion)
45diff --git a/Examples/test-suite/csharp/preproc_constants_runme.cs b/Examples/test-suite/csharp/preproc_constants_runme.cs
46index 9fae591..6b02e30 100644
47--- a/Examples/test-suite/csharp/preproc_constants_runme.cs
48+++ b/Examples/test-suite/csharp/preproc_constants_runme.cs
49@@ -60,6 +60,8 @@ public class runme {
50 assert( typeof(bool) == preproc_constants.EXPR_LAND.GetType() );
51 assert( typeof(bool) == preproc_constants.EXPR_LOR.GetType() );
52 assert( typeof(double) == preproc_constants.EXPR_CONDITIONAL.GetType() );
53+ assert( typeof(int) == preproc_constants.EXPR_WCHAR_MAX.GetType() );
54+ assert( typeof(int) == preproc_constants.EXPR_WCHAR_MIN.GetType() );
55
56 }
57 static void assert(bool assertion) {
58diff --git a/Examples/test-suite/d/preproc_constants_c_runme.1.d b/Examples/test-suite/d/preproc_constants_c_runme.1.d
59index d846c71..2b349af 100644
60--- a/Examples/test-suite/d/preproc_constants_c_runme.1.d
61+++ b/Examples/test-suite/d/preproc_constants_c_runme.1.d
62@@ -61,4 +61,6 @@ void main() {
63 static assert(is(int == typeof(EXPR_LAND())));
64 static assert(is(int == typeof(EXPR_LOR())));
65 static assert(is(double == typeof(EXPR_CONDITIONAL())));
66+ static assert(is(int == typeof(EXPR_WCHAR_MAX())));
67+ static assert(is(int == typeof(EXPR_WCHAR_MIN())));
68 }
69diff --git a/Examples/test-suite/d/preproc_constants_c_runme.2.d b/Examples/test-suite/d/preproc_constants_c_runme.2.d
70index 9bdbb93..1bac525 100644
71--- a/Examples/test-suite/d/preproc_constants_c_runme.2.d
72+++ b/Examples/test-suite/d/preproc_constants_c_runme.2.d
73@@ -61,4 +61,6 @@ void main() {
74 static assert(is(int == typeof(EXPR_LAND())));
75 static assert(is(int == typeof(EXPR_LOR())));
76 static assert(is(double == typeof(EXPR_CONDITIONAL())));
77+ static assert(is(int == typeof(EXPR_WCHAR_MAX())));
78+ static assert(is(int == typeof(EXPR_WCHAR_MIN())));
79 }
80diff --git a/Examples/test-suite/d/preproc_constants_runme.1.d b/Examples/test-suite/d/preproc_constants_runme.1.d
81index 009405f..f743f48 100644
82--- a/Examples/test-suite/d/preproc_constants_runme.1.d
83+++ b/Examples/test-suite/d/preproc_constants_runme.1.d
84@@ -60,4 +60,6 @@ void main() {
85 static assert(is(bool == typeof(EXPR_LAND())));
86 static assert(is(bool == typeof(EXPR_LOR())));
87 static assert(is(double == typeof(EXPR_CONDITIONAL())));
88+ static assert(is(int == typeof(EXPR_WCHAR_MAX())));
89+ static assert(is(int == typeof(EXPR_WCHAR_MIN())));
90 }
91diff --git a/Examples/test-suite/d/preproc_constants_runme.2.d b/Examples/test-suite/d/preproc_constants_runme.2.d
92index 2d92ef0..0d96c37 100644
93--- a/Examples/test-suite/d/preproc_constants_runme.2.d
94+++ b/Examples/test-suite/d/preproc_constants_runme.2.d
95@@ -60,4 +60,6 @@ void main() {
96 static assert(is(bool == typeof(EXPR_LAND())));
97 static assert(is(bool == typeof(EXPR_LOR())));
98 static assert(is(double == typeof(EXPR_CONDITIONAL())));
99+ static assert(is(int == typeof(EXPR_WCHAR_MAX())));
100+ static assert(is(int == typeof(EXPR_WCHAR_MIN())));
101 }
102diff --git a/Examples/test-suite/php/preproc_constants_c_runme.php b/Examples/test-suite/php/preproc_constants_c_runme.php
103index af9b76e..e59fe18 100644
104--- a/Examples/test-suite/php/preproc_constants_c_runme.php
105+++ b/Examples/test-suite/php/preproc_constants_c_runme.php
106@@ -62,5 +62,7 @@ check::equal(gettype(preproc_constants_c::EXPR_OR), "integer", "preproc_constant
107 check::equal(gettype(preproc_constants_c::EXPR_LAND), "integer", "preproc_constants.EXPR_LAND has unexpected type");
108 check::equal(gettype(preproc_constants_c::EXPR_LOR), "integer", "preproc_constants.EXPR_LOR has unexpected type");
109 check::equal(gettype(preproc_constants_c::EXPR_CONDITIONAL), "double", "preproc_constants.EXPR_CONDITIONAL has unexpected type");
110+check::equal(gettype(preproc_constants_c::EXPR_WCHAR_MAX), "integer", "preproc_constants.EXPR_WCHAR_MAX has unexpected type");
111+check::equal(gettype(preproc_constants_c::EXPR_WCHAR_MIN), "integer", "preproc_constants.EXPR_WCHAR_MIN has unexpected type");
112
113 ?>
114diff --git a/Examples/test-suite/php/preproc_constants_runme.php b/Examples/test-suite/php/preproc_constants_runme.php
115index 5c9119b..8e117ea 100644
116--- a/Examples/test-suite/php/preproc_constants_runme.php
117+++ b/Examples/test-suite/php/preproc_constants_runme.php
118@@ -61,5 +61,7 @@ check::equal(gettype(preproc_constants::EXPR_OR), "integer", "preproc_constants.
119 check::equal(gettype(preproc_constants::EXPR_LAND), "boolean", "preproc_constants.EXPR_LAND has unexpected type");
120 check::equal(gettype(preproc_constants::EXPR_LOR), "boolean", "preproc_constants.EXPR_LOR has unexpected type");
121 check::equal(gettype(preproc_constants::EXPR_CONDITIONAL), "double", "preproc_constants.EXPR_CONDITIONAL has unexpected type");
122+check::equal(gettype(preproc_constants::EXPR_WCHAR_MAX), "integer", "preproc_constants.EXPR_WCHAR_MAX has unexpected type");
123+check::equal(gettype(preproc_constants::EXPR_WCHAR_MIN), "integer", "preproc_constants.EXPR_WCHAR_MIN has unexpected type");
124
125 ?>
126diff --git a/Examples/test-suite/php5/preproc_constants_c_runme.php b/Examples/test-suite/php5/preproc_constants_c_runme.php
127index 1ea0195..d978fab 100644
128--- a/Examples/test-suite/php5/preproc_constants_c_runme.php
129+++ b/Examples/test-suite/php5/preproc_constants_c_runme.php
130@@ -62,5 +62,7 @@ check::equal(gettype(preproc_constants_c::EXPR_OR), "integer", "preproc_constant
131 check::equal(gettype(preproc_constants_c::EXPR_LAND), "integer", "preproc_constants.EXPR_LAND has unexpected type");
132 check::equal(gettype(preproc_constants_c::EXPR_LOR), "integer", "preproc_constants.EXPR_LOR has unexpected type");
133 check::equal(gettype(preproc_constants_c::EXPR_CONDITIONAL), "double", "preproc_constants.EXPR_CONDITIONAL has unexpected type");
134+check::equal(gettype(preproc_constants_c::EXPR_WCHAR_MAX), "integer", "preproc_constants.EXPR_WCHAR_MAX has unexpected type");
135+check::equal(gettype(preproc_constants_c::EXPR_WCHAR_MIN), "integer", "preproc_constants.EXPR_WCHAR_MIN has unexpected type");
136
137 ?>
138diff --git a/Examples/test-suite/php5/preproc_constants_runme.php b/Examples/test-suite/php5/preproc_constants_runme.php
139index fb9ee4f..7527026 100644
140--- a/Examples/test-suite/php5/preproc_constants_runme.php
141+++ b/Examples/test-suite/php5/preproc_constants_runme.php
142@@ -70,5 +70,7 @@ check::equal(gettype(preproc_constants::EXPR_LAND), "integer", "preproc_constant
143 check::equal(gettype(preproc_constants::EXPR_LOR), "integer", "preproc_constants.EXPR_LOR has unexpected type");
144
145 check::equal(gettype(preproc_constants::EXPR_CONDITIONAL), "double", "preproc_constants.EXPR_CONDITIONAL has unexpected type");
146+check::equal(gettype(preproc_constants::EXPR_WCHAR_MAX), "integer", "preproc_constants.EXPR_WCHAR_MAX has unexpected type");
147+check::equal(gettype(preproc_constants::EXPR_WCHAR_MIN), "integer", "preproc_constants.EXPR_WCHAR_MIN has unexpected type");
148
149 ?>
150diff --git a/Examples/test-suite/preproc_constants.i b/Examples/test-suite/preproc_constants.i
151index 3a999ad..16b44c9 100644
152--- a/Examples/test-suite/preproc_constants.i
153+++ b/Examples/test-suite/preproc_constants.i
154@@ -87,6 +87,9 @@
155 #define EXPR_LOR 0xFF || 1
156 #define EXPR_CONDITIONAL true ? 2 : 2.2
157
158+#define EXPR_WCHAR_MAX (0x7fffffff + L'\0')
159+#define EXPR_WCHAR_MIN (-EXPR_WCHAR_MAX - 1)
160+
161 #define EXPR_CHAR_COMPOUND_ADD 'A' + 12
162 #define EXPR_CHAR_COMPOUND_LSHIFT 'B' << 6
163 #define H_SUPPRESS_SCALING_MAGIC (('s'<<24) | ('u'<<16) | ('p'<<8) | 'p')
164diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y
165index 2e92cd0..273dadb 100644
166--- a/Source/CParse/parser.y
167+++ b/Source/CParse/parser.y
168@@ -194,7 +194,7 @@ int SWIG_cparse_template_reduce(int treduce) {
169 * ----------------------------------------------------------------------------- */
170
171 static int promote_type(int t) {
172- if (t <= T_UCHAR || t == T_CHAR) return T_INT;
173+ if (t <= T_UCHAR || t == T_CHAR || t == T_WCHAR) return T_INT;
174 return t;
175 }
176
177--
1782.9.5
179
diff --git a/meta/recipes-devtools/swig/swig_3.0.12.bb b/meta/recipes-devtools/swig/swig_3.0.12.bb
index fe9d0747f2..45026c9700 100644
--- a/meta/recipes-devtools/swig/swig_3.0.12.bb
+++ b/meta/recipes-devtools/swig/swig_3.0.12.bb
@@ -5,6 +5,7 @@ SRC_URI += "file://0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.pat
5 file://0001-Add-Node-7.x-aka-V8-5.2-support.patch \ 5 file://0001-Add-Node-7.x-aka-V8-5.2-support.patch \
6 file://swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_FixMetho.patch \ 6 file://swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_FixMetho.patch \
7 file://Python-Fix-new-GCC8-warnings-in-generated-code.patch \ 7 file://Python-Fix-new-GCC8-warnings-in-generated-code.patch \
8 file://0001-Fix-generated-code-for-constant-expressions-containi.patch \
8 " 9 "
9SRC_URI[md5sum] = "82133dfa7bba75ff9ad98a7046be687c" 10SRC_URI[md5sum] = "82133dfa7bba75ff9ad98a7046be687c"
10SRC_URI[sha256sum] = "7cf9f447ae7ed1c51722efc45e7f14418d15d7a1e143ac9f09a668999f4fc94d" 11SRC_URI[sha256sum] = "7cf9f447ae7ed1c51722efc45e7f14418d15d7a1e143ac9f09a668999f4fc94d"