Skip to contentSkip to conversation

libcap-ng, swig: add packages

PATCH Superseded [email protected] 2 participants 7 messages Aug 19, 2015 – Aug 21, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover libcap-ng, swig: add packages

From: Wenzong Fan <[email protected]>

Add packages libcap-ng and swig.

They are from meta-oe and with adding them to oe-core, the copies from multiple layers could be removed: meta-oe, meta-selinux ...

* The swig is depended by libcap-ng to build python bindings

* The libcap-ng library is intended to make programming with posix capabilities much easier than the traditional libcap library.

It's not a replacement to libcap, it provides different library (libcap-ng.so) while packages explicitly look for libcap.so. It could be used by qemu, util-linux, libvirt, audit ... to work with posix capabilities.

The following changes since commit c348fa50186fb0796bc7b793c4b8d710419f2a0d:

bitbake: toaster: move code from setup_lv_tests to setUp (2015-08-17 14:41:45 +0100)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib wenzong/libcap-ng
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=wenzong/libcap-ng

Wenzong Fan (2):
swig: add package 3.0.2
libcap-ng: add package 0.7.7

 meta/recipes-devtools/swig/swig.inc                | 63 ++++++++++++++++++++
 ...lf-exe-for-swig-swiglib-on-non-Win32-plat.patch | 69 ++++++++++++++++++++++
 ...nfigure-use-pkg-config-for-pcre-detection.patch | 64 ++++++++++++++++++++
 meta/recipes-devtools/swig/swig_3.0.2.bb           |  8 +++
 .../libcap-ng/libcap-ng/python.patch               | 58 ++++++++++++++++++
 meta/recipes-support/libcap-ng/libcap-ng_0.7.7.bb  | 39 ++++++++++++
 6 files changed, 301 insertions(+)
 create mode 100644 meta/recipes-devtools/swig/swig.inc
 create mode 100644 meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch
 create mode 100644 meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch
 create mode 100644 meta/recipes-devtools/swig/swig_3.0.2.bb
 create mode 100644 meta/recipes-support/libcap-ng/libcap-ng/python.patch
 create mode 100644 meta/recipes-support/libcap-ng/libcap-ng_0.7.7.bb
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/2 swig: add package 3.0.2

From: Wenzong Fan <[email protected]>

Pull package from meta-oe to oe-core:
meta-oe commit: 8b7d90d8e4c3338f94c588fc7e4a88319bd9a9e8

It's required for libcap-ng to build python bindings.

With adding it to oe-core, the copies from following layers could be removed:

* meta-oe, meta-selinux, meta-intel-iot-middleware ...

---
 meta/recipes-devtools/swig/swig.inc                | 63 ++++++++++++++++++++
 ...lf-exe-for-swig-swiglib-on-non-Win32-plat.patch | 69 ++++++++++++++++++++++
 ...nfigure-use-pkg-config-for-pcre-detection.patch | 64 ++++++++++++++++++++
 meta/recipes-devtools/swig/swig_3.0.2.bb           |  8 +++
 4 files changed, 204 insertions(+)
 create mode 100644 meta/recipes-devtools/swig/swig.inc
 create mode 100644 meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch
 create mode 100644 meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch
 create mode 100644 meta/recipes-devtools/swig/swig_3.0.2.bb
meta/recipes-devtools/swig/swig.inc new file +63 -0
new file mode 100644
index 0000000..9821fa5
@@ -0,0 +1,63 @@
+DESCRIPTION = "SWIG - Simplified Wrapper and Interface Generator"
+HOMEPAGE = "http://swig.sourceforge.net/"
+LICENSE = "BSD & GPLv3"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=e7807a6282784a7dde4c846626b08fc6 \
+                    file://LICENSE-GPL;md5=d32239bcb673463ab874e80d47fae504 \
+                    file://LICENSE-UNIVERSITIES;md5=8ce9dcc8f7c994de4a408b205c72ba08"
+
+SECTION = "devel"
+
+DEPENDS = "libpcre python"
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz"
+
+inherit autotools pythonnative
+
+EXTRA_OECONF = " \
+    --with-python=${PYTHON} \
+    --without-allegrocl \
+    --without-android \
+    --without-boost \
+    --without-chicken \
+    --without-clisp \
+    --without-csharp \
+    --without-d \
+    --without-gcj \
+    --without-go \
+    --without-guile \
+    --without-java \
+    --without-lua \
+    --without-mzscheme \
+    --without-ocaml \
+    --without-octave \
+    --without-perl5 \
+    --without-pike \
+    --without-php \
+    --without-python3 \
+    --without-r \
+    --without-ruby \
+    --without-tcl \
+"
+
+BBCLASSEXTEND = "native nativesdk"
+
+do_configure() {
+    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S}/Tools/config
+    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S}/Tools/config
+    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S}
+    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S}
+    oe_runconf
+}
+
+do_install_append_class-nativesdk() {
+    cd ${D}${bindir}
+    ln -s swig swig2.0
+}
+
+def swiglib_relpath(d):
+    swiglib = d.getVar('datadir', True) + "/" + d.getVar('BPN', True) + "/" + d.getVar('PV', True)
+    return os.path.relpath(swiglib, d.getVar('bindir', True))
+
+do_install_append_class-native() {
+    create_wrapper ${D}${bindir}/swig SWIG_LIB='`dirname $''realpath`'/${@swiglib_relpath(d)}
+}
meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch new file +69 -0

69 lines not on this page · raw message

meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch new file +64 -0

64 lines not on this page · raw message

meta/recipes-devtools/swig/swig_3.0.2.bb new file +8 -0
new file mode 100644
index 0000000..ac41914
@@ -0,0 +1,8 @@
+require ${BPN}.inc
+
+SRC_URI += "file://0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch \
+            file://0001-configure-use-pkg-config-for-pcre-detection.patch \
+           "
+
+SRC_URI[md5sum] = "62f9b0d010cef36a13a010dc530d0d41"
+SRC_URI[sha256sum] = "a2669657cabcedc371f63c0457407a183e0b6b2ef4e7e303c1ec9a3964cc7813"
Signature · 1 line
1.9.1
#2 lore raw

Re: [PATCH 1/2] swig: add package 3.0.2

Quoted 4 lines · On Wed, Aug 19, 2015 at 03:29:28AM -0400, [email protected] wrote:

From: Wenzong Fan <[email protected]>

Pull package from meta-oe to oe-core:
meta-oe commit: 8b7d90d8e4c3338f94c588fc7e4a88319bd9a9e8

There is patch for meta-oe to upgrade it to 3.0.6 (which isn't compatible with some recipes, but fixes for that were sent as well already).

Quoted 255 lines

It's required for libcap-ng to build python bindings.

With adding it to oe-core, the copies from following layers could be removed:

* meta-oe, meta-selinux, meta-intel-iot-middleware ...

---
 meta/recipes-devtools/swig/swig.inc                | 63 ++++++++++++++++++++
 ...lf-exe-for-swig-swiglib-on-non-Win32-plat.patch | 69 ++++++++++++++++++++++
 ...nfigure-use-pkg-config-for-pcre-detection.patch | 64 ++++++++++++++++++++
 meta/recipes-devtools/swig/swig_3.0.2.bb           |  8 +++
 4 files changed, 204 insertions(+)
 create mode 100644 meta/recipes-devtools/swig/swig.inc
 create mode 100644 meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch
 create mode 100644 meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch
 create mode 100644 meta/recipes-devtools/swig/swig_3.0.2.bb
meta/recipes-devtools/swig/swig.inc new file +63 -0
new file mode 100644
index 0000000..9821fa5
@@ -0,0 +1,63 @@
+DESCRIPTION = "SWIG - Simplified Wrapper and Interface Generator"
+HOMEPAGE = "http://swig.sourceforge.net/"
+LICENSE = "BSD & GPLv3"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=e7807a6282784a7dde4c846626b08fc6 \
+                    file://LICENSE-GPL;md5=d32239bcb673463ab874e80d47fae504 \
+                    file://LICENSE-UNIVERSITIES;md5=8ce9dcc8f7c994de4a408b205c72ba08"
+
+SECTION = "devel"
+
+DEPENDS = "libpcre python"
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz"
+
+inherit autotools pythonnative
+
+EXTRA_OECONF = " \
+    --with-python=${PYTHON} \
+    --without-allegrocl \
+    --without-android \
+    --without-boost \
+    --without-chicken \
+    --without-clisp \
+    --without-csharp \
+    --without-d \
+    --without-gcj \
+    --without-go \
+    --without-guile \
+    --without-java \
+    --without-lua \
+    --without-mzscheme \
+    --without-ocaml \
+    --without-octave \
+    --without-perl5 \
+    --without-pike \
+    --without-php \
+    --without-python3 \
+    --without-r \
+    --without-ruby \
+    --without-tcl \
+"
+
+BBCLASSEXTEND = "native nativesdk"
+
+do_configure() {
+    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S}/Tools/config
+    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S}/Tools/config
+    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S}
+    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S}
+    oe_runconf
+}
+
+do_install_append_class-nativesdk() {
+    cd ${D}${bindir}
+    ln -s swig swig2.0
+}
+
+def swiglib_relpath(d):
+    swiglib = d.getVar('datadir', True) + "/" + d.getVar('BPN', True) + "/" + d.getVar('PV', True)
+    return os.path.relpath(swiglib, d.getVar('bindir', True))
+
+do_install_append_class-native() {
+    create_wrapper ${D}${bindir}/swig SWIG_LIB='`dirname $''realpath`'/${@swiglib_relpath(d)}
+}
meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch new file +69 -0
new file mode 100644
index 0000000..81df3e2
@@ -0,0 +1,69 @@
+From a4a0440a644c6c5e5da096efe3cf05ba309a284f Mon Sep 17 00:00:00 2001
+From: "NODA, Kai" <[email protected]>
+Date: Sun, 22 Apr 2012 17:01:02 +0900
+Subject: [PATCH] Use /proc/self/exe for "swig -swiglib" on non-Win32
+ platforms.
+
+If it wasn't found, then fall back to a fixed string just as before.
+
+Upstream-Status: Submitted
+http://sourceforge.net/mailarchive/message.php?msg_id=29179733
+
+---
+ Source/Modules/main.cxx |   24 ++++++++++++++++++++++--
+ 1 file changed, 22 insertions(+), 2 deletions(-)
+
+diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx
+index d2f5d3b..cbb0a12 100644
+--- a/Source/Modules/main.cxx
++++ b/Source/Modules/main.cxx
+@@ -26,6 +26,11 @@ char cvsroot_main_cxx[] = "$Id$";
+ #include "cparse.h"
+ #include <ctype.h>
+ #include <limits.h>		// for INT_MAX
++#ifndef _WIN32
++#include <cstddef>
++#include <unistd.h>		// for readlink
++#include <sys/stat.h>		// for stat
++#endif
+ 
+ // Global variables
+ 
+@@ -902,9 +907,9 @@ int SWIG_main(int argc, char *argv[], Language *l) {
+ 
+   // Check for SWIG_LIB environment variable
+   if ((c = getenv("SWIG_LIB")) == (char *) 0) {
++    char *p;
+ #if defined(_WIN32)
+     char buf[MAX_PATH];
+-    char *p;
+     if (!(GetModuleFileName(0, buf, MAX_PATH) == 0 || (p = strrchr(buf, '\\')) == 0)) {
+       *(p + 1) = '\0';
+       SwigLib = NewStringf("%sLib", buf); // Native windows installation path
+@@ -914,7 +919,22 @@ int SWIG_main(int argc, char *argv[], Language *l) {
+     if (Len(SWIG_LIB_WIN_UNIX) > 0)
+       SwigLibWinUnix = NewString(SWIG_LIB_WIN_UNIX); // Unix installation path using a drive letter (for msys/mingw)
+ #else
+-    SwigLib = NewString(SWIG_LIB);
++    char buf[PATH_MAX];
++    if (0 < ::readlink("/proc/self/exe", buf, sizeof(buf)) &&
++        (p = ::strstr(buf, "/bin/swig"))) {
++        int major, minor, patch;
++        const int ret = ::sscanf(VERSION, "%d.%d.%d", &major, &minor, &patch);
++        if (3 == ret) {
++            const ::ptrdiff_t dir_part_len = p - buf;
++            ::snprintf(p, PATH_MAX - dir_part_len, "/share/swig/%d.%d.%d", major, minor, patch);
++            struct ::stat stat_res;
++            if (0 == ::stat(buf, &stat_res) && S_ISDIR(stat_res.st_mode)) {
++                SwigLib = NewString(buf);
++            }
++        }
++    }
++    if (NULL == SwigLib)
++        SwigLib = NewString(SWIG_LIB);
+ #endif
+   } else {
+     SwigLib = NewString(c);
+-- 
+1.7.9.5
+
meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch new file +64 -0
new file mode 100644
index 0000000..1b1128a
@@ -0,0 +1,64 @@
+From 5c4d6d8538994d5fe9b3b46bfafaf0a605e3bda6 Mon Sep 17 00:00:00 2001
+From: Koen Kooi <[email protected]>
+Date: Tue, 17 Jun 2014 08:18:17 +0200
+Subject: [PATCH] configure: use pkg-config for pcre detection
+
+Signed-off-by: Koen Kooi <[email protected]>
+Upstream-Status: pending
+---
+ configure.ac | 38 +++++++-------------------------------
+ 1 file changed, 7 insertions(+), 31 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 0c984b7..6edcec1 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -70,38 +70,14 @@ AC_MSG_RESULT([$with_pcre])
+ 
+ dnl To make configuring easier, check for a locally built PCRE using the Tools/pcre-build.sh script
+ if test x"${with_pcre}" = xyes ; then
+-  AC_MSG_CHECKING([whether to use local PCRE])
+-  local_pcre_config=no
+-  if test -z $PCRE_CONFIG; then
+-    if test -f `pwd`/pcre/pcre-swig-install/bin/pcre-config; then
+-      PCRE_CONFIG=`pwd`/pcre/pcre-swig-install/bin/pcre-config
+-      local_pcre_config=$PCRE_CONFIG
+-    fi
+-  fi
+-  AC_MSG_RESULT([$local_pcre_config])
+-fi
+-AS_IF([test "x$with_pcre" != xno],
+-  [AX_PATH_GENERIC([pcre],
+-    [], dnl Minimal version of PCRE we need -- accept any
+-    [], dnl custom sed script for version parsing is not needed
+-    [AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE library])
+-     LIBS="$LIBS $PCRE_LIBS"
+-     CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"
+-    ],
+-    [AC_MSG_FAILURE([
+-        Cannot find pcre-config script from PCRE (Perl Compatible Regular Expressions)
+-        library package. This dependency is needed for configure to complete,
+-        Either:
+-        - Install the PCRE developer package on your system (preferred approach).
+-        - Download the PCRE source tarball, build and install on your system
+-          as you would for any package built from source distribution.
+-        - Use the Tools/pcre-build.sh script to build PCRE just for SWIG to statically
+-          link against. Run 'Tools/pcre-build.sh --help' for instructions.
+-          (quite easy and does not require privileges to install PCRE on your system)
+-        - Use configure --without-pcre to disable regular expressions support in SWIG
+-          (not recommended).])
+-    ])
++  PKG_CHECK_MODULES([PCRE], [libpcre], [
++    AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE library])
++    LIBS="$LIBS $PCRE_LIBS"
++    CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"
++  ], [
++    AC_MSG_WARN([$PCRE_PKG_ERRORS])
+   ])
++fi
+ 
+ 
+ dnl CCache
+-- 
+1.9.3
+
meta/recipes-devtools/swig/swig_3.0.2.bb new file +8 -0
new file mode 100644
index 0000000..ac41914
@@ -0,0 +1,8 @@
+require ${BPN}.inc
+
+SRC_URI += "file://0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch \
+            file://0001-configure-use-pkg-config-for-pcre-detection.patch \
+           "
+
+SRC_URI[md5sum] = "62f9b0d010cef36a13a010dc530d0d41"
+SRC_URI[sha256sum] = "a2669657cabcedc371f63c0457407a183e0b6b2ef4e7e303c1ec9a3964cc7813"
Signature · 7 lines
1.9.1

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#3 lore raw

Re: [PATCH 1/2] swig: add package 3.0.2

Quoted 9 lines · Martin Jansa
Quoted 4 lines · On Wed, Aug 19, 2015 at 03:29:28AM -0400, [email protected] wrote:

From: Wenzong Fan <[email protected]>

Pull package from meta-oe to oe-core:
meta-oe commit: 8b7d90d8e4c3338f94c588fc7e4a88319bd9a9e8

There is patch for meta-oe to upgrade it to 3.0.6 (which isn't compatible with some recipes, but fixes for that were sent as well already).

Hi Martin,

Do you mean the fix for python-m2crypto?
----------------------------------------
commit 74de7be5a464e184fed64661e2a45f2f6fac58a5

Author: Li xin <[email protected]>
Date:   Thu Jul 30 18:31:25 2015 +0800

python-m2crypto: Error fix for swig >= 3.0.5

After swig upgrade to 3.0.6, build the recipes which depends on python-m2crypto will occur errors like this:
"SALT_LEN = m2.PKCS5_SALT_LEN
AttributeError: 'module' object has no attribute 'PKCS5_SALT_LEN'"

Reference

https://github.com/martinpaljak/M2Crypto/issues/60#issuecomment-75735489

-----------------------------------------

If the fixes are not applied to swig directly, I think this patch is OK. I'll consider to remove swig from meta-oe next step ...

Thanks
Wenzong

Quoted 257 lines
Quoted 256 lines

It's required for libcap-ng to build python bindings.

With adding it to oe-core, the copies from following layers could be removed:

* meta-oe, meta-selinux, meta-intel-iot-middleware ...

---
  meta/recipes-devtools/swig/swig.inc                | 63 ++++++++++++++++++++
  ...lf-exe-for-swig-swiglib-on-non-Win32-plat.patch | 69 ++++++++++++++++++++++
  ...nfigure-use-pkg-config-for-pcre-detection.patch | 64 ++++++++++++++++++++
  meta/recipes-devtools/swig/swig_3.0.2.bb           |  8 +++
  4 files changed, 204 insertions(+)

create mode 100644 meta/recipes-devtools/swig/swig.inc
create mode 100644 meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch create mode 100644 meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch create mode 100644 meta/recipes-devtools/swig/swig_3.0.2.bb

meta/recipes-devtools/swig/swig.inc new file +63 -0
new file mode 100644
index 0000000..9821fa5
@@ -0,0 +1,63 @@
+DESCRIPTION = "SWIG - Simplified Wrapper and Interface Generator"
+HOMEPAGE = "http://swig.sourceforge.net/"
+LICENSE = "BSD & GPLv3"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=e7807a6282784a7dde4c846626b08fc6 \
+                    file://LICENSE-GPL;md5=d32239bcb673463ab874e80d47fae504 \
+                    file://LICENSE-UNIVERSITIES;md5=8ce9dcc8f7c994de4a408b205c72ba08"
+
+SECTION = "devel"
+
+DEPENDS = "libpcre python"
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz"
+
+inherit autotools pythonnative
+
+EXTRA_OECONF = " \
+    --with-python=${PYTHON} \
+    --without-allegrocl \
+    --without-android \
+    --without-boost \
+    --without-chicken \
+    --without-clisp \
+    --without-csharp \
+    --without-d \
+    --without-gcj \
+    --without-go \
+    --without-guile \
+    --without-java \
+    --without-lua \
+    --without-mzscheme \
+    --without-ocaml \
+    --without-octave \
+    --without-perl5 \
+    --without-pike \
+    --without-php \
+    --without-python3 \
+    --without-r \
+    --without-ruby \
+    --without-tcl \
+"
+
+BBCLASSEXTEND = "native nativesdk"
+
+do_configure() {
+    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S}/Tools/config
+    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S}/Tools/config
+    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S}
+    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S}
+    oe_runconf
+}
+
+do_install_append_class-nativesdk() {
+    cd ${D}${bindir}
+    ln -s swig swig2.0
+}
+
+def swiglib_relpath(d):
+    swiglib = d.getVar('datadir', True) + "/" + d.getVar('BPN', True) + "/" + d.getVar('PV', True)
+    return os.path.relpath(swiglib, d.getVar('bindir', True))
+
+do_install_append_class-native() {
+    create_wrapper ${D}${bindir}/swig SWIG_LIB='`dirname $''realpath`'/${@swiglib_relpath(d)}
+}
meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch new file +69 -0
new file mode 100644
index 0000000..81df3e2
@@ -0,0 +1,69 @@
+From a4a0440a644c6c5e5da096efe3cf05ba309a284f Mon Sep 17 00:00:00 2001
+From: "NODA, Kai" <[email protected]>
+Date: Sun, 22 Apr 2012 17:01:02 +0900
+Subject: [PATCH] Use /proc/self/exe for "swig -swiglib" on non-Win32
+ platforms.
+
+If it wasn't found, then fall back to a fixed string just as before.
+
+Upstream-Status: Submitted
+http://sourceforge.net/mailarchive/message.php?msg_id=29179733
+
+---
+ Source/Modules/main.cxx |   24 ++++++++++++++++++++++--
+ 1 file changed, 22 insertions(+), 2 deletions(-)
+
+diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx
+index d2f5d3b..cbb0a12 100644
+--- a/Source/Modules/main.cxx
++++ b/Source/Modules/main.cxx
+@@ -26,6 +26,11 @@ char cvsroot_main_cxx[] = "$Id$";
+ #include "cparse.h"
+ #include <ctype.h>
+ #include <limits.h>		// for INT_MAX
++#ifndef _WIN32
++#include <cstddef>
++#include <unistd.h>		// for readlink
++#include <sys/stat.h>		// for stat
++#endif
+
+ // Global variables
+
+@@ -902,9 +907,9 @@ int SWIG_main(int argc, char *argv[], Language *l) {
+
+   // Check for SWIG_LIB environment variable
+   if ((c = getenv("SWIG_LIB")) == (char *) 0) {
++    char *p;
+ #if defined(_WIN32)
+     char buf[MAX_PATH];
+-    char *p;
+     if (!(GetModuleFileName(0, buf, MAX_PATH) == 0 || (p = strrchr(buf, '\\')) == 0)) {
+       *(p + 1) = '\0';
+       SwigLib = NewStringf("%sLib", buf); // Native windows installation path
+@@ -914,7 +919,22 @@ int SWIG_main(int argc, char *argv[], Language *l) {
+     if (Len(SWIG_LIB_WIN_UNIX) > 0)
+       SwigLibWinUnix = NewString(SWIG_LIB_WIN_UNIX); // Unix installation path using a drive letter (for msys/mingw)
+ #else
+-    SwigLib = NewString(SWIG_LIB);
++    char buf[PATH_MAX];
++    if (0 < ::readlink("/proc/self/exe", buf, sizeof(buf)) &&
++        (p = ::strstr(buf, "/bin/swig"))) {
++        int major, minor, patch;
++        const int ret = ::sscanf(VERSION, "%d.%d.%d", &major, &minor, &patch);
++        if (3 == ret) {
++            const ::ptrdiff_t dir_part_len = p - buf;
++            ::snprintf(p, PATH_MAX - dir_part_len, "/share/swig/%d.%d.%d", major, minor, patch);
++            struct ::stat stat_res;
++            if (0 == ::stat(buf, &stat_res) && S_ISDIR(stat_res.st_mode)) {
++                SwigLib = NewString(buf);
++            }
++        }
++    }
++    if (NULL == SwigLib)
++        SwigLib = NewString(SWIG_LIB);
+ #endif
+   } else {
+     SwigLib = NewString(c);
+--
+1.7.9.5
+
meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch new file +64 -0
new file mode 100644
index 0000000..1b1128a
@@ -0,0 +1,64 @@
+From 5c4d6d8538994d5fe9b3b46bfafaf0a605e3bda6 Mon Sep 17 00:00:00 2001
+From: Koen Kooi <[email protected]>
+Date: Tue, 17 Jun 2014 08:18:17 +0200
+Subject: [PATCH] configure: use pkg-config for pcre detection
+
+Signed-off-by: Koen Kooi <[email protected]>
+Upstream-Status: pending
+---
+ configure.ac | 38 +++++++-------------------------------
+ 1 file changed, 7 insertions(+), 31 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 0c984b7..6edcec1 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -70,38 +70,14 @@ AC_MSG_RESULT([$with_pcre])
+
+ dnl To make configuring easier, check for a locally built PCRE using the Tools/pcre-build.sh script
+ if test x"${with_pcre}" = xyes ; then
+-  AC_MSG_CHECKING([whether to use local PCRE])
+-  local_pcre_config=no
+-  if test -z $PCRE_CONFIG; then
+-    if test -f `pwd`/pcre/pcre-swig-install/bin/pcre-config; then
+-      PCRE_CONFIG=`pwd`/pcre/pcre-swig-install/bin/pcre-config
+-      local_pcre_config=$PCRE_CONFIG
+-    fi
+-  fi
+-  AC_MSG_RESULT([$local_pcre_config])
+-fi
+-AS_IF([test "x$with_pcre" != xno],
+-  [AX_PATH_GENERIC([pcre],
+-    [], dnl Minimal version of PCRE we need -- accept any
+-    [], dnl custom sed script for version parsing is not needed
+-    [AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE library])
+-     LIBS="$LIBS $PCRE_LIBS"
+-     CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"
+-    ],
+-    [AC_MSG_FAILURE([
+-        Cannot find pcre-config script from PCRE (Perl Compatible Regular Expressions)
+-        library package. This dependency is needed for configure to complete,
+-        Either:
+-        - Install the PCRE developer package on your system (preferred approach).
+-        - Download the PCRE source tarball, build and install on your system
+-          as you would for any package built from source distribution.
+-        - Use the Tools/pcre-build.sh script to build PCRE just for SWIG to statically
+-          link against. Run 'Tools/pcre-build.sh --help' for instructions.
+-          (quite easy and does not require privileges to install PCRE on your system)
+-        - Use configure --without-pcre to disable regular expressions support in SWIG
+-          (not recommended).])
+-    ])
++  PKG_CHECK_MODULES([PCRE], [libpcre], [
++    AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE library])
++    LIBS="$LIBS $PCRE_LIBS"
++    CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"
++  ], [
++    AC_MSG_WARN([$PCRE_PKG_ERRORS])
+   ])
++fi
+
+
+ dnl CCache
+--
+1.9.3
+
meta/recipes-devtools/swig/swig_3.0.2.bb new file +8 -1
new file mode 100644
index 0000000..ac41914
@@ -0,0 +1,8 @@
+require ${BPN}.inc
+
+SRC_URI += "file://0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch \
+            file://0001-configure-use-pkg-config-for-pcre-detection.patch \
+           "
+
+SRC_URI[md5sum] = "62f9b0d010cef36a13a010dc530d0d41"
+SRC_URI[sha256sum] = "a2669657cabcedc371f63c0457407a183e0b6b2ef4e7e303c1ec9a3964cc7813"
--

1.9.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#4 lore raw

Re: [PATCH 1/2] swig: add package 3.0.2

Quoted 28 lines · wenzong fan
Quoted 9 lines · Martin Jansa
Quoted 4 lines · On Wed, Aug 19, 2015 at 03:29:28AM -0400, [email protected] wrote:

From: Wenzong Fan <[email protected]>

Pull package from meta-oe to oe-core:
meta-oe commit: 8b7d90d8e4c3338f94c588fc7e4a88319bd9a9e8

There is patch for meta-oe to upgrade it to 3.0.6 (which isn't compatible with some recipes, but fixes for that were sent as well already).

Hi Martin,

Do you mean the fix for python-m2crypto?
----------------------------------------
commit 74de7be5a464e184fed64661e2a45f2f6fac58a5

Author: Li xin <[email protected]>
Date:   Thu Jul 30 18:31:25 2015 +0800

python-m2crypto: Error fix for swig >= 3.0.5

After swig upgrade to 3.0.6, build the recipes which depends on python-m2crypto will occur errors like this:
"SALT_LEN = m2.PKCS5_SALT_LEN
AttributeError: 'module' object has no attribute 'PKCS5_SALT_LEN'"

Reference

Quoted 8 lines

https://github.com/martinpaljak/M2Crypto/issues/60#issuecomment-75735489

-----------------------------------------

If the fixes are not applied to swig directly, I think this patch is OK. I'll consider to remove swig from meta-oe next step ...

Yes and this swig upgrade:

commit 9cc54e10efa5ca70d9980f833a8e5a310e5ad21d

Author: Li xin <[email protected]>
Date:   Thu Jul 23 18:03:31 2015 +0800

swig: upgrade 3.0.2 -> 3.0.6

both changes are now in meta-oe, so if you add swig-3.0.2 instead of 3.0.5 to oe-core then you will need to upgrade it first before removing it from meta-oe.

Quoted 260 lines

Thanks
Wenzong

Quoted 257 lines
Quoted 256 lines

It's required for libcap-ng to build python bindings.

With adding it to oe-core, the copies from following layers could be removed:

* meta-oe, meta-selinux, meta-intel-iot-middleware ...

---
  meta/recipes-devtools/swig/swig.inc                | 63 ++++++++++++++++++++
  ...lf-exe-for-swig-swiglib-on-non-Win32-plat.patch | 69 ++++++++++++++++++++++
  ...nfigure-use-pkg-config-for-pcre-detection.patch | 64 ++++++++++++++++++++
  meta/recipes-devtools/swig/swig_3.0.2.bb           |  8 +++
  4 files changed, 204 insertions(+)

create mode 100644 meta/recipes-devtools/swig/swig.inc
create mode 100644 meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch create mode 100644 meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch create mode 100644 meta/recipes-devtools/swig/swig_3.0.2.bb

meta/recipes-devtools/swig/swig.inc new file +63 -0
new file mode 100644
index 0000000..9821fa5
@@ -0,0 +1,63 @@
+DESCRIPTION = "SWIG - Simplified Wrapper and Interface Generator"
+HOMEPAGE = "http://swig.sourceforge.net/"
+LICENSE = "BSD & GPLv3"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=e7807a6282784a7dde4c846626b08fc6 \
+                    file://LICENSE-GPL;md5=d32239bcb673463ab874e80d47fae504 \
+                    file://LICENSE-UNIVERSITIES;md5=8ce9dcc8f7c994de4a408b205c72ba08"
+
+SECTION = "devel"
+
+DEPENDS = "libpcre python"
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz"
+
+inherit autotools pythonnative
+
+EXTRA_OECONF = " \
+    --with-python=${PYTHON} \
+    --without-allegrocl \
+    --without-android \
+    --without-boost \
+    --without-chicken \
+    --without-clisp \
+    --without-csharp \
+    --without-d \
+    --without-gcj \
+    --without-go \
+    --without-guile \
+    --without-java \
+    --without-lua \
+    --without-mzscheme \
+    --without-ocaml \
+    --without-octave \
+    --without-perl5 \
+    --without-pike \
+    --without-php \
+    --without-python3 \
+    --without-r \
+    --without-ruby \
+    --without-tcl \
+"
+
+BBCLASSEXTEND = "native nativesdk"
+
+do_configure() {
+    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S}/Tools/config
+    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S}/Tools/config
+    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S}
+    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S}
+    oe_runconf
+}
+
+do_install_append_class-nativesdk() {
+    cd ${D}${bindir}
+    ln -s swig swig2.0
+}
+
+def swiglib_relpath(d):
+    swiglib = d.getVar('datadir', True) + "/" + d.getVar('BPN', True) + "/" + d.getVar('PV', True)
+    return os.path.relpath(swiglib, d.getVar('bindir', True))
+
+do_install_append_class-native() {
+    create_wrapper ${D}${bindir}/swig SWIG_LIB='`dirname $''realpath`'/${@swiglib_relpath(d)}
+}
meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch new file +69 -0
new file mode 100644
index 0000000..81df3e2
@@ -0,0 +1,69 @@
+From a4a0440a644c6c5e5da096efe3cf05ba309a284f Mon Sep 17 00:00:00 2001
+From: "NODA, Kai" <[email protected]>
+Date: Sun, 22 Apr 2012 17:01:02 +0900
+Subject: [PATCH] Use /proc/self/exe for "swig -swiglib" on non-Win32
+ platforms.
+
+If it wasn't found, then fall back to a fixed string just as before.
+
+Upstream-Status: Submitted
+http://sourceforge.net/mailarchive/message.php?msg_id=29179733
+
+---
+ Source/Modules/main.cxx |   24 ++++++++++++++++++++++--
+ 1 file changed, 22 insertions(+), 2 deletions(-)
+
+diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx
+index d2f5d3b..cbb0a12 100644
+--- a/Source/Modules/main.cxx
++++ b/Source/Modules/main.cxx
+@@ -26,6 +26,11 @@ char cvsroot_main_cxx[] = "$Id$";
+ #include "cparse.h"
+ #include <ctype.h>
+ #include <limits.h>		// for INT_MAX
++#ifndef _WIN32
++#include <cstddef>
++#include <unistd.h>		// for readlink
++#include <sys/stat.h>		// for stat
++#endif
+
+ // Global variables
+
+@@ -902,9 +907,9 @@ int SWIG_main(int argc, char *argv[], Language *l) {
+
+   // Check for SWIG_LIB environment variable
+   if ((c = getenv("SWIG_LIB")) == (char *) 0) {
++    char *p;
+ #if defined(_WIN32)
+     char buf[MAX_PATH];
+-    char *p;
+     if (!(GetModuleFileName(0, buf, MAX_PATH) == 0 || (p = strrchr(buf, '\\')) == 0)) {
+       *(p + 1) = '\0';
+       SwigLib = NewStringf("%sLib", buf); // Native windows installation path
+@@ -914,7 +919,22 @@ int SWIG_main(int argc, char *argv[], Language *l) {
+     if (Len(SWIG_LIB_WIN_UNIX) > 0)
+       SwigLibWinUnix = NewString(SWIG_LIB_WIN_UNIX); // Unix installation path using a drive letter (for msys/mingw)
+ #else
+-    SwigLib = NewString(SWIG_LIB);
++    char buf[PATH_MAX];
++    if (0 < ::readlink("/proc/self/exe", buf, sizeof(buf)) &&
++        (p = ::strstr(buf, "/bin/swig"))) {
++        int major, minor, patch;
++        const int ret = ::sscanf(VERSION, "%d.%d.%d", &major, &minor, &patch);
++        if (3 == ret) {
++            const ::ptrdiff_t dir_part_len = p - buf;
++            ::snprintf(p, PATH_MAX - dir_part_len, "/share/swig/%d.%d.%d", major, minor, patch);
++            struct ::stat stat_res;
++            if (0 == ::stat(buf, &stat_res) && S_ISDIR(stat_res.st_mode)) {
++                SwigLib = NewString(buf);
++            }
++        }
++    }
++    if (NULL == SwigLib)
++        SwigLib = NewString(SWIG_LIB);
+ #endif
+   } else {
+     SwigLib = NewString(c);
+--
+1.7.9.5
+
meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch new file +64 -0
new file mode 100644
index 0000000..1b1128a
@@ -0,0 +1,64 @@
+From 5c4d6d8538994d5fe9b3b46bfafaf0a605e3bda6 Mon Sep 17 00:00:00 2001
+From: Koen Kooi <[email protected]>
+Date: Tue, 17 Jun 2014 08:18:17 +0200
+Subject: [PATCH] configure: use pkg-config for pcre detection
+
+Signed-off-by: Koen Kooi <[email protected]>
+Upstream-Status: pending
+---
+ configure.ac | 38 +++++++-------------------------------
+ 1 file changed, 7 insertions(+), 31 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 0c984b7..6edcec1 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -70,38 +70,14 @@ AC_MSG_RESULT([$with_pcre])
+
+ dnl To make configuring easier, check for a locally built PCRE using the Tools/pcre-build.sh script
+ if test x"${with_pcre}" = xyes ; then
+-  AC_MSG_CHECKING([whether to use local PCRE])
+-  local_pcre_config=no
+-  if test -z $PCRE_CONFIG; then
+-    if test -f `pwd`/pcre/pcre-swig-install/bin/pcre-config; then
+-      PCRE_CONFIG=`pwd`/pcre/pcre-swig-install/bin/pcre-config
+-      local_pcre_config=$PCRE_CONFIG
+-    fi
+-  fi
+-  AC_MSG_RESULT([$local_pcre_config])
+-fi
+-AS_IF([test "x$with_pcre" != xno],
+-  [AX_PATH_GENERIC([pcre],
+-    [], dnl Minimal version of PCRE we need -- accept any
+-    [], dnl custom sed script for version parsing is not needed
+-    [AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE library])
+-     LIBS="$LIBS $PCRE_LIBS"
+-     CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"
+-    ],
+-    [AC_MSG_FAILURE([
+-        Cannot find pcre-config script from PCRE (Perl Compatible Regular Expressions)
+-        library package. This dependency is needed for configure to complete,
+-        Either:
+-        - Install the PCRE developer package on your system (preferred approach).
+-        - Download the PCRE source tarball, build and install on your system
+-          as you would for any package built from source distribution.
+-        - Use the Tools/pcre-build.sh script to build PCRE just for SWIG to statically
+-          link against. Run 'Tools/pcre-build.sh --help' for instructions.
+-          (quite easy and does not require privileges to install PCRE on your system)
+-        - Use configure --without-pcre to disable regular expressions support in SWIG
+-          (not recommended).])
+-    ])
++  PKG_CHECK_MODULES([PCRE], [libpcre], [
++    AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE library])
++    LIBS="$LIBS $PCRE_LIBS"
++    CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"
++  ], [
++    AC_MSG_WARN([$PCRE_PKG_ERRORS])
+   ])
++fi
+
+
+ dnl CCache
+--
+1.9.3
+
meta/recipes-devtools/swig/swig_3.0.2.bb new file +8 -1
new file mode 100644
index 0000000..ac41914
@@ -0,0 +1,8 @@
+require ${BPN}.inc
+
+SRC_URI += "file://0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch \
+            file://0001-configure-use-pkg-config-for-pcre-detection.patch \
+           "
+
+SRC_URI[md5sum] = "62f9b0d010cef36a13a010dc530d0d41"
+SRC_URI[sha256sum] = "a2669657cabcedc371f63c0457407a183e0b6b2ef4e7e303c1ec9a3964cc7813"
--

1.9.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#5 lore raw

Re: [PATCH 1/2] swig: add package 3.0.2

Quoted 44 lines · Martin Jansa
Quoted 28 lines · wenzong fan
Quoted 9 lines · Martin Jansa
Quoted 4 lines · On Wed, Aug 19, 2015 at 03:29:28AM -0400, [email protected] wrote:

From: Wenzong Fan <[email protected]>

Pull package from meta-oe to oe-core:
meta-oe commit: 8b7d90d8e4c3338f94c588fc7e4a88319bd9a9e8

There is patch for meta-oe to upgrade it to 3.0.6 (which isn't compatible with some recipes, but fixes for that were sent as well already).

Hi Martin,

Do you mean the fix for python-m2crypto?
----------------------------------------
commit 74de7be5a464e184fed64661e2a45f2f6fac58a5

Author: Li xin <[email protected]>
Date:   Thu Jul 30 18:31:25 2015 +0800

python-m2crypto: Error fix for swig >= 3.0.5

After swig upgrade to 3.0.6, build the recipes which depends on python-m2crypto will occur errors like this:
"SALT_LEN = m2.PKCS5_SALT_LEN
AttributeError: 'module' object has no attribute 'PKCS5_SALT_LEN'"

Reference

Quoted 8 lines

https://github.com/martinpaljak/M2Crypto/issues/60#issuecomment-75735489

-----------------------------------------

If the fixes are not applied to swig directly, I think this patch is OK. I'll consider to remove swig from meta-oe next step ...

Yes and this swig upgrade:

commit 9cc54e10efa5ca70d9980f833a8e5a310e5ad21d

Author: Li xin <[email protected]>
Date:   Thu Jul 23 18:03:31 2015 +0800
Quoted 8 lines

swig: upgrade 3.0.2 -> 3.0.6

both changes are now in meta-oe, so if you add swig-3.0.2 instead of 3.0.5 to oe-core then you will need to upgrade it first before removing it from meta-oe.

Ah, yes. I'll update my patch and pick the 3.0.6 to oe-core.

Thanks
Wenzong

Quoted 262 lines
Quoted 261 lines

Thanks
Wenzong

Quoted 257 lines
Quoted 256 lines

It's required for libcap-ng to build python bindings.

With adding it to oe-core, the copies from following layers could be removed:

* meta-oe, meta-selinux, meta-intel-iot-middleware ...

---
   meta/recipes-devtools/swig/swig.inc                | 63 ++++++++++++++++++++
   ...lf-exe-for-swig-swiglib-on-non-Win32-plat.patch | 69 ++++++++++++++++++++++
   ...nfigure-use-pkg-config-for-pcre-detection.patch | 64 ++++++++++++++++++++
   meta/recipes-devtools/swig/swig_3.0.2.bb           |  8 +++
   4 files changed, 204 insertions(+)

create mode 100644 meta/recipes-devtools/swig/swig.inc
create mode 100644 meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch create mode 100644 meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch create mode 100644 meta/recipes-devtools/swig/swig_3.0.2.bb

meta/recipes-devtools/swig/swig.inc new file +63 -0
new file mode 100644
index 0000000..9821fa5
@@ -0,0 +1,63 @@
+DESCRIPTION = "SWIG - Simplified Wrapper and Interface Generator"
+HOMEPAGE = "http://swig.sourceforge.net/"
+LICENSE = "BSD & GPLv3"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=e7807a6282784a7dde4c846626b08fc6 \
+                    file://LICENSE-GPL;md5=d32239bcb673463ab874e80d47fae504 \
+                    file://LICENSE-UNIVERSITIES;md5=8ce9dcc8f7c994de4a408b205c72ba08"
+
+SECTION = "devel"
+
+DEPENDS = "libpcre python"
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz"
+
+inherit autotools pythonnative
+
+EXTRA_OECONF = " \
+    --with-python=${PYTHON} \
+    --without-allegrocl \
+    --without-android \
+    --without-boost \
+    --without-chicken \
+    --without-clisp \
+    --without-csharp \
+    --without-d \
+    --without-gcj \
+    --without-go \
+    --without-guile \
+    --without-java \
+    --without-lua \
+    --without-mzscheme \
+    --without-ocaml \
+    --without-octave \
+    --without-perl5 \
+    --without-pike \
+    --without-php \
+    --without-python3 \
+    --without-r \
+    --without-ruby \
+    --without-tcl \
+"
+
+BBCLASSEXTEND = "native nativesdk"
+
+do_configure() {
+    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S}/Tools/config
+    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S}/Tools/config
+    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S}
+    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S}
+    oe_runconf
+}
+
+do_install_append_class-nativesdk() {
+    cd ${D}${bindir}
+    ln -s swig swig2.0
+}
+
+def swiglib_relpath(d):
+    swiglib = d.getVar('datadir', True) + "/" + d.getVar('BPN', True) + "/" + d.getVar('PV', True)
+    return os.path.relpath(swiglib, d.getVar('bindir', True))
+
+do_install_append_class-native() {
+    create_wrapper ${D}${bindir}/swig SWIG_LIB='`dirname $''realpath`'/${@swiglib_relpath(d)}
+}
meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch new file +69 -0
new file mode 100644
index 0000000..81df3e2
@@ -0,0 +1,69 @@
+From a4a0440a644c6c5e5da096efe3cf05ba309a284f Mon Sep 17 00:00:00 2001
+From: "NODA, Kai" <[email protected]>
+Date: Sun, 22 Apr 2012 17:01:02 +0900
+Subject: [PATCH] Use /proc/self/exe for "swig -swiglib" on non-Win32
+ platforms.
+
+If it wasn't found, then fall back to a fixed string just as before.
+
+Upstream-Status: Submitted
+http://sourceforge.net/mailarchive/message.php?msg_id=29179733
+
+---
+ Source/Modules/main.cxx |   24 ++++++++++++++++++++++--
+ 1 file changed, 22 insertions(+), 2 deletions(-)
+
+diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx
+index d2f5d3b..cbb0a12 100644
+--- a/Source/Modules/main.cxx
++++ b/Source/Modules/main.cxx
+@@ -26,6 +26,11 @@ char cvsroot_main_cxx[] = "$Id$";
+ #include "cparse.h"
+ #include <ctype.h>
+ #include <limits.h>		// for INT_MAX
++#ifndef _WIN32
++#include <cstddef>
++#include <unistd.h>		// for readlink
++#include <sys/stat.h>		// for stat
++#endif
+
+ // Global variables
+
+@@ -902,9 +907,9 @@ int SWIG_main(int argc, char *argv[], Language *l) {
+
+   // Check for SWIG_LIB environment variable
+   if ((c = getenv("SWIG_LIB")) == (char *) 0) {
++    char *p;
+ #if defined(_WIN32)
+     char buf[MAX_PATH];
+-    char *p;
+     if (!(GetModuleFileName(0, buf, MAX_PATH) == 0 || (p = strrchr(buf, '\\')) == 0)) {
+       *(p + 1) = '\0';
+       SwigLib = NewStringf("%sLib", buf); // Native windows installation path
+@@ -914,7 +919,22 @@ int SWIG_main(int argc, char *argv[], Language *l) {
+     if (Len(SWIG_LIB_WIN_UNIX) > 0)
+       SwigLibWinUnix = NewString(SWIG_LIB_WIN_UNIX); // Unix installation path using a drive letter (for msys/mingw)
+ #else
+-    SwigLib = NewString(SWIG_LIB);
++    char buf[PATH_MAX];
++    if (0 < ::readlink("/proc/self/exe", buf, sizeof(buf)) &&
++        (p = ::strstr(buf, "/bin/swig"))) {
++        int major, minor, patch;
++        const int ret = ::sscanf(VERSION, "%d.%d.%d", &major, &minor, &patch);
++        if (3 == ret) {
++            const ::ptrdiff_t dir_part_len = p - buf;
++            ::snprintf(p, PATH_MAX - dir_part_len, "/share/swig/%d.%d.%d", major, minor, patch);
++            struct ::stat stat_res;
++            if (0 == ::stat(buf, &stat_res) && S_ISDIR(stat_res.st_mode)) {
++                SwigLib = NewString(buf);
++            }
++        }
++    }
++    if (NULL == SwigLib)
++        SwigLib = NewString(SWIG_LIB);
+ #endif
+   } else {
+     SwigLib = NewString(c);
+--
+1.7.9.5
+
meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch new file +64 -0
new file mode 100644
index 0000000..1b1128a
@@ -0,0 +1,64 @@
+From 5c4d6d8538994d5fe9b3b46bfafaf0a605e3bda6 Mon Sep 17 00:00:00 2001
+From: Koen Kooi <[email protected]>
+Date: Tue, 17 Jun 2014 08:18:17 +0200
+Subject: [PATCH] configure: use pkg-config for pcre detection
+
+Signed-off-by: Koen Kooi <[email protected]>
+Upstream-Status: pending
+---
+ configure.ac | 38 +++++++-------------------------------
+ 1 file changed, 7 insertions(+), 31 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 0c984b7..6edcec1 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -70,38 +70,14 @@ AC_MSG_RESULT([$with_pcre])
+
+ dnl To make configuring easier, check for a locally built PCRE using the Tools/pcre-build.sh script
+ if test x"${with_pcre}" = xyes ; then
+-  AC_MSG_CHECKING([whether to use local PCRE])
+-  local_pcre_config=no
+-  if test -z $PCRE_CONFIG; then
+-    if test -f `pwd`/pcre/pcre-swig-install/bin/pcre-config; then
+-      PCRE_CONFIG=`pwd`/pcre/pcre-swig-install/bin/pcre-config
+-      local_pcre_config=$PCRE_CONFIG
+-    fi
+-  fi
+-  AC_MSG_RESULT([$local_pcre_config])
+-fi
+-AS_IF([test "x$with_pcre" != xno],
+-  [AX_PATH_GENERIC([pcre],
+-    [], dnl Minimal version of PCRE we need -- accept any
+-    [], dnl custom sed script for version parsing is not needed
+-    [AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE library])
+-     LIBS="$LIBS $PCRE_LIBS"
+-     CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"
+-    ],
+-    [AC_MSG_FAILURE([
+-        Cannot find pcre-config script from PCRE (Perl Compatible Regular Expressions)
+-        library package. This dependency is needed for configure to complete,
+-        Either:
+-        - Install the PCRE developer package on your system (preferred approach).
+-        - Download the PCRE source tarball, build and install on your system
+-          as you would for any package built from source distribution.
+-        - Use the Tools/pcre-build.sh script to build PCRE just for SWIG to statically
+-          link against. Run 'Tools/pcre-build.sh --help' for instructions.
+-          (quite easy and does not require privileges to install PCRE on your system)
+-        - Use configure --without-pcre to disable regular expressions support in SWIG
+-          (not recommended).])
+-    ])
++  PKG_CHECK_MODULES([PCRE], [libpcre], [
++    AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE library])
++    LIBS="$LIBS $PCRE_LIBS"
++    CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"
++  ], [
++    AC_MSG_WARN([$PCRE_PKG_ERRORS])
+   ])
++fi
+
+
+ dnl CCache
+--
+1.9.3
+
meta/recipes-devtools/swig/swig_3.0.2.bb new file +8 -1
new file mode 100644
index 0000000..ac41914
@@ -0,0 +1,8 @@
+require ${BPN}.inc
+
+SRC_URI += "file://0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch \
+            file://0001-configure-use-pkg-config-for-pcre-detection.patch \
+           "
+
+SRC_URI[md5sum] = "62f9b0d010cef36a13a010dc530d0d41"
+SRC_URI[sha256sum] = "a2669657cabcedc371f63c0457407a183e0b6b2ef4e7e303c1ec9a3964cc7813"
--

1.9.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#6 lore raw

PATCH 2/2 libcap-ng: add package 0.7.7

In reply to [email protected]

From: Wenzong Fan <[email protected]>

Pull package from meta-oe to oe-core:
meta-oe commit: bce4dba5546480c8e43c6442959ac7d0a4ef32f6

The libcap-ng library is intended to make programming with posix capabilities much easier than the traditional libcap library.

It's not a replacement to libcap, it provides different library (libcap-ng.so) while packages explicitly look for libcap.so. It could be used by qemu, util-linux, libvirt, audit ...

With adding it to oe-core, the copies from following layers could be removed:

* meta-oe, meta-selinux, meta-security-framework ...

---
 .../libcap-ng/libcap-ng/python.patch               | 58 ++++++++++++++++++++++
 meta/recipes-support/libcap-ng/libcap-ng_0.7.7.bb  | 39 +++++++++++++++
 2 files changed, 97 insertions(+)
 create mode 100644 meta/recipes-support/libcap-ng/libcap-ng/python.patch
 create mode 100644 meta/recipes-support/libcap-ng/libcap-ng_0.7.7.bb
meta/recipes-support/libcap-ng/libcap-ng/python.patch new file +58 -0
new file mode 100644
index 0000000..59591eb
@@ -0,0 +1,58 @@
+From b01bb2694f66cd981e6d61523433dc3eb5ed32f2 Mon Sep 17 00:00:00 2001
+From: Li xin <[email protected]>
+Date: Sat, 18 Jul 2015 23:03:30 +0900
+Subject: [PATCH] configure.ac - Avoid an incorrect check for python.
+ Makefile.am - avoid hard coded host include paths.
+
+Upstream-Status: pending
+
+Signed-off-by: Mark Hatle <[email protected]>
+Signed-off-by: Li Xin <[email protected]>
+---
+ bindings/python/Makefile.am |  3 ++-
+ configure.ac                | 15 ++-------------
+ 2 files changed, 4 insertions(+), 14 deletions(-)
+
+diff --git a/bindings/python/Makefile.am b/bindings/python/Makefile.am
+index 82b9bb8..f9fe7a8 100644
+--- a/bindings/python/Makefile.am
++++ b/bindings/python/Makefile.am
+@@ -23,7 +23,8 @@ SUBDIRS = test
+ CONFIG_CLEAN_FILES = *.loT *.rej *.orig
+ AM_CFLAGS = -fPIC -DPIC
+ PYLIBVER ?= python$(PYTHON_VERSION)
+-AM_CPPFLAGS = -I. -I$(top_builddir) -I@PYINCLUDEDIR@
++PYINC ?= /usr/include/$(PYLIBVER)
++AM_CPPFLAGS = -I. -I$(top_builddir) -I$(PYINC)
+ LIBS = $(top_builddir)/src/libcap-ng.la
+ SWIG_FLAGS = -python
+ SWIG_INCLUDES = ${AM_CPPFLAGS}
+diff --git a/configure.ac b/configure.ac
+index 1d777d5..9d90f64 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -123,19 +123,8 @@ if test x$use_python = xno ; then
+ else
+ AC_MSG_RESULT(testing)
+ AM_PATH_PYTHON
+-PYINCLUDEDIR=`python${am_cv_python_version} -c "from distutils import sysconfig; print(sysconfig.get_config_var('INCLUDEPY'))"`
+-if test -f ${PYINCLUDEDIR}/Python.h ; then
+-	python_found="yes"
+-	AC_SUBST(PYINCLUDEDIR)
+-	AC_MSG_NOTICE(Python bindings will be built)
+-else
+-	python_found="no"
+-	if test x$use_python = xyes ; then
+-		AC_MSG_ERROR([Python explicitly required and python headers found])
+-	else
+-		AC_MSG_WARN("Python headers not found - python bindings will not be made")
+-	fi
+-fi
++python_found="yes"
++AC_MSG_NOTICE(Python bindings will be built)
+ fi
+ AM_CONDITIONAL(HAVE_PYTHON, test ${python_found} = "yes")
+ 
+-- 
+1.8.4.2
+
meta/recipes-support/libcap-ng/libcap-ng_0.7.7.bb new file +39 -0
new file mode 100644
index 0000000..a31d5dc
@@ -0,0 +1,39 @@
+SUMMARY = "An alternate posix capabilities library"
+DESCRIPTION = "The libcap-ng library is intended to make programming \
+with POSIX capabilities much easier than the traditional libcap library."
+HOMEPAGE = "http://freecode.com/projects/libcap-ng"
+SECTION = "base"
+LICENSE = "GPLv2+ & LGPLv2.1+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
+		    file://COPYING.LIB;md5=e3eda01d9815f8d24aae2dbd89b68b06"
+
+SRC_URI = "http://people.redhat.com/sgrubb/libcap-ng/libcap-ng-${PV}.tar.gz \
+           file://python.patch"
+
+inherit lib_package autotools pythonnative
+
+SRC_URI[md5sum] = "3d7d126b29e2869a0257c17c8b0d9b2e"
+SRC_URI[sha256sum] = "615549ce39b333f6b78baee0c0b4ef18bc726c6bf1cca123dfd89dd963f6d06b"
+
+DEPENDS += "swig-native python"
+
+EXTRA_OECONF += "--without-python3"
+
+EXTRA_OEMAKE += "PYLIBVER='python${PYTHON_BASEVERSION}' PYINC='${STAGING_INCDIR}/${PYLIBVER}'"
+
+PACKAGES += "${PN}-python"
+
+FILES_${PN}-dbg += "${libdir}/python${PYTHON_BASEVERSION}/*/.debug"
+FILES_${PN}-python = "${libdir}/python${PYTHON_BASEVERSION}"
+
+BBCLASSEXTEND = "native"
+
+do_install_append() {
+	# Moving libcap-ng to base_libdir
+	if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then
+		mkdir -p ${D}/${base_libdir}/
+		mv -f ${D}${libdir}/libcap-ng.so.* ${D}${base_libdir}/
+		relpath=${@os.path.relpath("${base_libdir}", "${libdir}")}
+		ln -sf ${relpath}/libcap-ng.so.0.0.0 ${D}${libdir}/libcap-ng.so
+	fi
+}
Signature · 1 line
1.9.1