summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kanavin <alex@linutronix.de>2024-04-22 13:03:18 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-04-22 22:05:58 +0100
commit1bdcdfeefadfaef358d59ce68121695c93c60ee8 (patch)
treec257cbc90b57ffcea70ef49b01b29f1260a75ea3
parente31f5ce727abe63bd3b086fefa623c88c6cdcd47 (diff)
downloadpoky-1bdcdfeefadfaef358d59ce68121695c93c60ee8.tar.gz
swig: convert from autotools to cmake
Drop patches: 0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch (superseded long time ago by native wrapper) 0001-configure-use-pkg-config-for-pcre-detection.patch (autotools-specific) Drop all autoconf options and native python dependency as cmake configuration doesn't contain those. (From OE-Core rev: 1317b042812cc926546b05cf1e2179549ea3e5ca) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch65
-rw-r--r--meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch63
-rw-r--r--meta/recipes-devtools/swig/swig_4.2.1.bb45
3 files changed, 9 insertions, 164 deletions
diff --git a/meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch b/meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch
deleted file mode 100644
index 5e83e92725..0000000000
--- a/meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch
+++ /dev/null
@@ -1,65 +0,0 @@
1From b88a98348b3841f0b702e314631883d46f9f362d Mon Sep 17 00:00:00 2001
2From: "NODA, Kai" <nodakai@gmail.com>
3Date: Sun, 22 Apr 2012 17:01:02 +0900
4Subject: [PATCH] Use /proc/self/exe for "swig -swiglib" on non-Win32
5 platforms.
6
7If it wasn't found, then fall back to a fixed string just as before.
8
9Upstream-Status: Submitted
10http://sourceforge.net/mailarchive/message.php?msg_id=29179733
11---
12 Source/Modules/main.cxx | 24 ++++++++++++++++++++++--
13 1 file changed, 22 insertions(+), 2 deletions(-)
14
15diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx
16index 76b4f9d..de0a512 100644
17--- a/Source/Modules/main.cxx
18+++ b/Source/Modules/main.cxx
19@@ -25,6 +25,11 @@
20 #include <ctype.h>
21 #include <errno.h>
22 #include <limits.h> // for INT_MAX
23+#ifndef _WIN32
24+#include <cstddef>
25+#include <unistd.h> // for readlink
26+#include <sys/stat.h> // for stat
27+#endif
28
29 // Global variables
30
31@@ -895,9 +900,9 @@ int SWIG_main(int argc, char *argv[], const TargetLanguageModule *tlm) {
32
33 // Check for SWIG_LIB environment variable
34 if ((c = getenv("SWIG_LIB")) == (char *) 0) {
35+ char *p;
36 #if defined(_WIN32)
37 char buf[MAX_PATH];
38- char *p;
39 if (!(GetModuleFileName(0, buf, MAX_PATH) == 0 || (p = strrchr(buf, '\\')) == 0)) {
40 *(p + 1) = '\0';
41 SwigLib = NewStringf("%sLib", buf); // Native windows installation path
42@@ -907,7 +912,22 @@ int SWIG_main(int argc, char *argv[], const TargetLanguageModule *tlm) {
43 if (Len(SWIG_LIB_WIN_UNIX) > 0)
44 SwigLibWinUnix = NewString(SWIG_LIB_WIN_UNIX); // Unix installation path using a drive letter (for msys/mingw)
45 #else
46- SwigLib = NewString(SWIG_LIB);
47+ char buf[PATH_MAX];
48+ if (0 < ::readlink("/proc/self/exe", buf, sizeof(buf)) &&
49+ (p = ::strstr(buf, "/bin/swig"))) {
50+ int major, minor, patch;
51+ const int ret = ::sscanf(VERSION, "%d.%d.%d", &major, &minor, &patch);
52+ if (3 == ret) {
53+ const ::ptrdiff_t dir_part_len = p - buf;
54+ ::snprintf(p, PATH_MAX - dir_part_len, "/share/swig/%d.%d.%d", major, minor, patch);
55+ struct ::stat stat_res;
56+ if (0 == ::stat(buf, &stat_res) && S_ISDIR(stat_res.st_mode)) {
57+ SwigLib = NewString(buf);
58+ }
59+ }
60+ }
61+ if (NULL == SwigLib)
62+ SwigLib = NewString(SWIG_LIB);
63 #endif
64 } else {
65 SwigLib = NewString(c);
diff --git a/meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch b/meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch
deleted file mode 100644
index 9e16caecca..0000000000
--- a/meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch
+++ /dev/null
@@ -1,63 +0,0 @@
1From 57a15651b46a0f1f84a4dd15d67d104fbfbe3f6e Mon Sep 17 00:00:00 2001
2From: Koen Kooi <koen.kooi@linaro.org>
3Date: Tue, 17 Jun 2014 08:18:17 +0200
4Subject: [PATCH] configure: use pkg-config for pcre detection
5
6Signed-off-by: Koen Kooi <koen.kooi@linaro.org>
7Upstream-Status: Pending
8
9---
10 configure.ac | 39 +++++++--------------------------------
11 1 file changed, 7 insertions(+), 32 deletions(-)
12
13diff --git a/configure.ac b/configure.ac
14index c060028..a330266 100644
15--- a/configure.ac
16+++ b/configure.ac
17@@ -49,39 +49,14 @@ AC_MSG_RESULT([$with_pcre])
18
19 dnl To make configuring easier, check for a locally built PCRE using the Tools/pcre-build.sh script
20 if test x"${with_pcre}" = xyes ; then
21- AC_MSG_CHECKING([whether to use local PCRE2])
22- local_pcre_config=no
23- if test -z "$PCRE2_CONFIG"; then
24- if test -f `pwd`/pcre/pcre-swig-install/bin/pcre2-config; then
25- PCRE2_CONFIG=`pwd`/pcre/pcre-swig-install/bin/pcre2-config
26- local_pcre_config=$PCRE2_CONFIG
27- fi
28- fi
29- AC_MSG_RESULT([$local_pcre_config])
30-fi
31-AS_IF([test "x$with_pcre" != xno],
32- [AX_PATH_GENERIC([pcre2],
33- [], dnl Minimal version of PCRE we need -- accept any
34- [], dnl custom sed script for version parsing is not needed
35- [AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE2 library])
36- LIBS="$LIBS $PCRE2_LIBS"
37- CPPFLAGS="$CPPFLAGS $PCRE2_CFLAGS"
38- ],
39- [AC_MSG_FAILURE([
40- Cannot find pcre2-config script from PCRE2 (Perl Compatible Regular Expressions)
41- library package. This dependency is needed for configure to complete,
42- Either:
43- - Install the PCRE2 developer package on your system (preferred approach).
44- - Download the PCRE2 source tarball, build and install on your system
45- as you would for any package built from source distribution.
46- - Use the Tools/pcre-build.sh script to build PCRE2 just for SWIG to statically
47- link against. Run 'Tools/pcre-build.sh --help' for instructions.
48- (quite easy and does not require privileges to install PCRE2 on your system)
49- - Use configure --without-pcre to disable regular expressions support in SWIG
50- (not recommended).])
51- ],
52- [],[],[--libs8])
53+ PKG_CHECK_MODULES([PCRE], [libpcre2], [
54+ AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE library])
55+ LIBS="$LIBS $PCRE_LIBS"
56+ CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"
57+ ], [
58+ AC_MSG_WARN([$PCRE_PKG_ERRORS])
59 ])
60+fi
61
62
63 dnl CCache
diff --git a/meta/recipes-devtools/swig/swig_4.2.1.bb b/meta/recipes-devtools/swig/swig_4.2.1.bb
index 7062d4e9aa..b564be9b36 100644
--- a/meta/recipes-devtools/swig/swig_4.2.1.bb
+++ b/meta/recipes-devtools/swig/swig_4.2.1.bb
@@ -13,51 +13,16 @@ SECTION = "devel"
13DEPENDS = "libpcre2 bison-native" 13DEPENDS = "libpcre2 bison-native"
14 14
15SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz \ 15SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz \
16 file://0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch \
17 file://0001-configure-use-pkg-config-for-pcre-detection.patch \
18 file://determinism.patch \ 16 file://determinism.patch \
19 " 17 "
20SRC_URI[sha256sum] = "fa045354e2d048b2cddc69579e4256245d4676894858fcf0bab2290ecf59b7d8" 18SRC_URI[sha256sum] = "fa045354e2d048b2cddc69579e4256245d4676894858fcf0bab2290ecf59b7d8"
21UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/swig/files/swig/" 19UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/swig/files/swig/"
22UPSTREAM_CHECK_REGEX = "swig-(?P<pver>\d+(\.\d+)+)" 20UPSTREAM_CHECK_REGEX = "swig-(?P<pver>\d+(\.\d+)+)"
23 21
24inherit autotools python3native pkgconfig 22inherit cmake pkgconfig
25
26EXTRA_OECONF = " \
27 --with-python3=${PYTHON} \
28 --without-allegrocl \
29 --without-android \
30 --without-boost \
31 --without-chicken \
32 --without-clisp \
33 --without-csharp \
34 --without-d \
35 --without-gcj \
36 --without-go \
37 --without-guile \
38 --without-java \
39 --without-lua \
40 --without-mzscheme \
41 --without-ocaml \
42 --without-octave \
43 --without-perl5 \
44 --without-pike \
45 --without-php \
46 --without-r \
47 --without-ruby \
48 --without-tcl \
49"
50
51EXTRA_AUTORECONF += "-I Tools/config"
52 23
53BBCLASSEXTEND = "native nativesdk" 24BBCLASSEXTEND = "native nativesdk"
54 25
55# necessary together with bison dependency until a new upstream version after
56# 3.0.12 includes 0001-Fix-generated-code-for-constant-expressions-containi.patch
57do_configure:append() {
58 mkdir -p ${B}/Source/CParse
59}
60
61do_install:append:class-nativesdk() { 26do_install:append:class-nativesdk() {
62 cd ${D}${bindir} 27 cd ${D}${bindir}
63 ln -s swig swig2.0 28 ln -s swig swig2.0
@@ -70,3 +35,11 @@ def swiglib_relpath(d):
70do_install:append:class-native() { 35do_install:append:class-native() {
71 create_wrapper ${D}${bindir}/swig SWIG_LIB='`dirname $''realpath`'/${@swiglib_relpath(d)} 36 create_wrapper ${D}${bindir}/swig SWIG_LIB='`dirname $''realpath`'/${@swiglib_relpath(d)}
72} 37}
38
39PACKAGE_PREPROCESS_FUNCS += "src_package_preprocess"
40src_package_preprocess () {
41 # Trim build paths from comments and defines in generated sources to ensure reproducibility
42 sed -i -e "s,${WORKDIR},,g" \
43 -e "s,YY_YY_.*_CPARSE_PARSER_H_INCLUDED,YY_YY_CPARSE_PARSER_H_INCLUDED,g" \
44 ${B}/Source/CParse/parser.*
45}