summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXin Ouyang <Xin.Ouyang@windriver.com>2012-12-19 18:57:57 +0800
committerXin Ouyang <Xin.Ouyang@windriver.com>2012-12-19 19:00:02 +0800
commit104f048221788c5c33034b3ab63f096e5c3eaaa7 (patch)
treeb5e94c29b26572f52b98a56d87a8a62a4e67857a
parent1372e7b7d235cd8ebdfed504ca7960b07dfba351 (diff)
downloadmeta-selinux-104f048221788c5c33034b3ab63f096e5c3eaaa7.tar.gz
sed: fix parallel compile error with libselinux
Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com>
-rw-r--r--recipes-extended/sed/sed-4.2.1/sed-selinux-fix.patch68
-rw-r--r--recipes-extended/sed/sed_4.2.1.bbappend7
2 files changed, 75 insertions, 0 deletions
diff --git a/recipes-extended/sed/sed-4.2.1/sed-selinux-fix.patch b/recipes-extended/sed/sed-4.2.1/sed-selinux-fix.patch
new file mode 100644
index 0000000..9b9fcb7
--- /dev/null
+++ b/recipes-extended/sed/sed-4.2.1/sed-selinux-fix.patch
@@ -0,0 +1,68 @@
1Subject: [PATCH] sed: enable selinux only when incs and libs exist.
2
3Upstream-Status: Pending
4
5Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com>
6---
7 m4/selinux-selinux-h.m4 | 4 ++++
8 sed/execute.c | 8 ++++----
9 2 files changed, 8 insertions(+), 4 deletions(-)
10
11diff --git a/m4/selinux-selinux-h.m4 b/m4/selinux-selinux-h.m4
12index 20dc77c..542b4e6 100644
13--- a/m4/selinux-selinux-h.m4
14+++ b/m4/selinux-selinux-h.m4
15@@ -34,6 +34,10 @@ AC_DEFUN([gl_LIBSELINUX],
16 [test "$ac_cv_search_setfilecon" = "none required" ||
17 LIB_SELINUX=$ac_cv_search_setfilecon])
18 AC_SUBST([LIB_SELINUX])
19+ if test "$ac_cv_search_setfilecon" != no &&
20+ test "$ac_cv_header_selinux_selinux_h" != no ; then
21+ AC_DEFINE(HAVE_LIBSELINUX, 1, [libselinux enabled])
22+ fi
23 LIBS=$gl_save_LIBS
24
25 # Warn if SELinux is found but libselinux is absent;
26diff --git a/sed/execute.c b/sed/execute.c
27index 6fbfff6..7e55e18 100644
28--- a/sed/execute.c
29+++ b/sed/execute.c
30@@ -31,7 +31,7 @@
31 extern int errno;
32 #endif
33
34-#ifndef BOOTSTRAP
35+#ifdef HAVE_LIBSELINUX
36 #include <selinux/selinux.h>
37 #include <selinux/context.h>
38 #endif
39@@ -718,7 +718,7 @@ open_next_file(name, input)
40 {
41 int input_fd;
42 char *tmpdir, *p;
43-#ifndef BOOTSTRAP
44+#ifdef HAVE_LIBSELINUX
45 security_context_t old_fscreatecon;
46 int reset_fscreatecon = 0;
47 memset (&old_fscreatecon, 0, sizeof (old_fscreatecon));
48@@ -744,7 +744,7 @@ open_next_file(name, input)
49 if (!S_ISREG (input->st.st_mode))
50 panic(_("couldn't edit %s: not a regular file"), input->in_file_name);
51
52-#ifndef BOOTSTRAP
53+#ifdef HAVE_LIBSELINUX
54 if (is_selinux_enabled ())
55 {
56 security_context_t con;
57@@ -771,7 +771,7 @@ open_next_file(name, input)
58 output_file.missing_newline = false;
59 free (tmpdir);
60
61-#ifndef BOOTSTRAP
62+#ifdef HAVE_LIBSELINUX
63 if (reset_fscreatecon)
64 {
65 setfscreatecon (old_fscreatecon);
66--
671.7.9.5
68
diff --git a/recipes-extended/sed/sed_4.2.1.bbappend b/recipes-extended/sed/sed_4.2.1.bbappend
new file mode 100644
index 0000000..52243c2
--- /dev/null
+++ b/recipes-extended/sed/sed_4.2.1.bbappend
@@ -0,0 +1,7 @@
1PR .= ".1"
2
3FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:"
4
5SRC_URI += "file://sed-selinux-fix.patch"
6
7DEPENDS += "${@base_contains('DISTRO_FEATURES', 'selinux', 'libselinux', '', d)}"