summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2019-11-26 23:08:29 +0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-12-04 12:30:58 +0000
commit8f21b6d0d5d43c81c9cd992af94daf4e966dac76 (patch)
tree8e1e62f1a7a82bb0f99c2e49c20a1862813e7629 /meta
parent1fb4aa42f9c3b9738d78d198ad695fe4fcb6dc2f (diff)
downloadpoky-8f21b6d0d5d43c81c9cd992af94daf4e966dac76.tar.gz
libcap-ng: add pthread library if header is found
If the pthread.h header is found, make sure library containing "pthread_atfork" is added to the list of libraries against which to link. On some hosts (e.g. openSUSE 15.1) "-lpthread" needs to be explicitly added in order for the code to compile correctly. We already had a workaround for this for native builds, but using some external toolchains, we can be bit by this for the target recipe as well. Most of this is courtesy Trevor Woerner <twoerner@gmail.com>, via his patch at stevegrubb/libcap-ng#10, the last thanks to Khem Raj. (From OE-Core rev: 8d84fdea1c26ed5f8f8261c89070df44da3f1855) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-support/libcap-ng/libcap-ng.inc2
-rw-r--r--meta/recipes-support/libcap-ng/libcap-ng/0001-configure.ac-add-library-if-header-found.patch30
-rw-r--r--meta/recipes-support/libcap-ng/libcap-ng/0002-Wrap-pthread_atfork-usage-in-HAVE_PTHREAD_H.patch24
-rw-r--r--meta/recipes-support/libcap-ng/libcap-ng_0.7.10.bb1
4 files changed, 56 insertions, 1 deletions
diff --git a/meta/recipes-support/libcap-ng/libcap-ng.inc b/meta/recipes-support/libcap-ng/libcap-ng.inc
index aec83896e4..002915ad48 100644
--- a/meta/recipes-support/libcap-ng/libcap-ng.inc
+++ b/meta/recipes-support/libcap-ng/libcap-ng.inc
@@ -9,6 +9,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
9 9
10SRC_URI = "http://people.redhat.com/sgrubb/libcap-ng/libcap-ng-${PV}.tar.gz \ 10SRC_URI = "http://people.redhat.com/sgrubb/libcap-ng/libcap-ng-${PV}.tar.gz \
11 file://python.patch \ 11 file://python.patch \
12 file://0001-configure.ac-add-library-if-header-found.patch \
13 file://0002-Wrap-pthread_atfork-usage-in-HAVE_PTHREAD_H.patch \
12" 14"
13 15
14SRC_URI[md5sum] = "57dc267e2949cdecb651a929f9206572" 16SRC_URI[md5sum] = "57dc267e2949cdecb651a929f9206572"
diff --git a/meta/recipes-support/libcap-ng/libcap-ng/0001-configure.ac-add-library-if-header-found.patch b/meta/recipes-support/libcap-ng/libcap-ng/0001-configure.ac-add-library-if-header-found.patch
new file mode 100644
index 0000000000..0fcb032f90
--- /dev/null
+++ b/meta/recipes-support/libcap-ng/libcap-ng/0001-configure.ac-add-library-if-header-found.patch
@@ -0,0 +1,30 @@
1From 0230e2e374bb71aed0181ccd9ebd13c0c5125a5d Mon Sep 17 00:00:00 2001
2From: Trevor Woerner <twoerner@gmail.com>
3Date: Fri, 25 Oct 2019 17:01:20 -0400
4Subject: [PATCH] configure.ac: add library if header found
5
6If the pthread.h header is found, make sure library containing
7"pthread_atfork" is added to the list of libraries against which to link.
8On some hosts (e.g. openSUSE 15.1) "-lpthread" needs to be explicitly added
9in order for the code to compile correctly.
10
11Signed-off-by: Trevor Woerner <twoerner@gmail.com>
12---
13 configure.ac | 4 +++-
14 1 file changed, 3 insertions(+), 1 deletion(-)
15
16diff --git a/configure.ac b/configure.ac
17index 63088f4..639b464 100644
18--- a/configure.ac
19+++ b/configure.ac
20@@ -56,7 +56,9 @@ AC_CHECK_HEADERS(sys/xattr.h, [], [
21 AC_CHECK_HEADERS(attr/xattr.h, [], [AC_MSG_WARN(attr/xattr.h not found, disabling file system capabilities.)])
22 ])
23 AC_CHECK_HEADERS(linux/securebits.h, [], [])
24-AC_CHECK_HEADERS(pthread.h, [], [AC_MSG_WARN(pthread.h not found, disabling pthread_atfork.)])
25+AC_CHECK_HEADERS(pthread.h,
26+ [AC_SEARCH_LIBS(pthread_atfork, pthread)],
27+ [AC_MSG_WARN(pthread.h not found, disabling pthread_atfork.)])
28
29 AC_C_CONST
30 AC_C_INLINE
diff --git a/meta/recipes-support/libcap-ng/libcap-ng/0002-Wrap-pthread_atfork-usage-in-HAVE_PTHREAD_H.patch b/meta/recipes-support/libcap-ng/libcap-ng/0002-Wrap-pthread_atfork-usage-in-HAVE_PTHREAD_H.patch
new file mode 100644
index 0000000000..7eb950f159
--- /dev/null
+++ b/meta/recipes-support/libcap-ng/libcap-ng/0002-Wrap-pthread_atfork-usage-in-HAVE_PTHREAD_H.patch
@@ -0,0 +1,24 @@
1From d95c4018ad57c37f6272dbedfa5217776567c329 Mon Sep 17 00:00:00 2001
2From: Christopher Larson <chris_larson@mentor.com>
3Date: Tue, 26 Nov 2019 22:34:34 +0500
4Subject: [PATCH] Wrap pthread_atfork usage in HAVE_PTHREAD_H
5
6Signed-off-by: Christopher Larson <chris_larson@mentor.com>
7---
8 src/cap-ng.c | 2 ++
9 1 file changed, 2 insertions(+)
10
11diff --git a/src/cap-ng.c b/src/cap-ng.c
12index 35fcd7a..97a3dbd 100644
13--- a/src/cap-ng.c
14+++ b/src/cap-ng.c
15@@ -166,7 +166,9 @@ static void deinit(void)
16 static void init_lib(void) __attribute__ ((constructor));
17 static void init_lib(void)
18 {
19+#ifdef HAVE_PTHREAD_H
20 pthread_atfork(NULL, NULL, deinit);
21+#endif
22 }
23
24 static void init(void)
diff --git a/meta/recipes-support/libcap-ng/libcap-ng_0.7.10.bb b/meta/recipes-support/libcap-ng/libcap-ng_0.7.10.bb
index a9a046571f..6e6de45494 100644
--- a/meta/recipes-support/libcap-ng/libcap-ng_0.7.10.bb
+++ b/meta/recipes-support/libcap-ng/libcap-ng_0.7.10.bb
@@ -3,7 +3,6 @@ require libcap-ng.inc
3inherit lib_package autotools 3inherit lib_package autotools
4 4
5EXTRA_OECONF += "--without-python --without-python3" 5EXTRA_OECONF += "--without-python --without-python3"
6LDFLAGS_append_class-native = " -pthread"
7 6
8BBCLASSEXTEND = "native nativesdk" 7BBCLASSEXTEND = "native nativesdk"
9 8