update buildroot to 2017.02.11
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
From e0803c0bdbb1abf06b6b5bb1b52fdb733505b8f7 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
Date: Wed, 25 Jan 2017 22:41:02 +1300
|
||||
Subject: [PATCH] src/regex.c: support old compilers for the endian
|
||||
check
|
||||
|
||||
libselinux 2.6 has added some code in regex.c that uses __BYTE_ORDER__
|
||||
to determine the system endianness. Unfortunately, this definition
|
||||
provided directly by the compiler doesn't exist in older gcc versions
|
||||
such as gcc 4.4.
|
||||
|
||||
In order to address this, this commit extends the logic to use
|
||||
<endian.h> definitions if __BYTE_ORDER__ is not provided by the
|
||||
compiler. This allows libselinux to build properly with gcc 4.4.
|
||||
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
---
|
||||
src/regex.c | 13 ++++++++++++-
|
||||
1 file changed, 12 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/regex.c b/src/regex.c
|
||||
index a3b427b..0c5ad27 100644
|
||||
--- a/src/regex.c
|
||||
+++ b/src/regex.c
|
||||
@@ -13,7 +13,18 @@
|
||||
#endif
|
||||
|
||||
#ifndef __BYTE_ORDER__
|
||||
-#error __BYTE_ORDER__ not defined. Unable to determine endianness.
|
||||
+
|
||||
+/* If the compiler doesn't define __BYTE_ORDER__, try to use the C
|
||||
+ * library <endian.h> header definitions. */
|
||||
+#include <endian.h>
|
||||
+#ifndef __BYTE_ORDER
|
||||
+#error Neither __BYTE_ORDER__ nor __BYTE_ORDER defined. Unable to determine endianness.
|
||||
+#endif
|
||||
+
|
||||
+#define __ORDER_LITTLE_ENDIAN __LITTLE_ENDIAN
|
||||
+#define __ORDER_BIG_ENDIAN __BIG_ENDIAN
|
||||
+#define __BYTE_ORDER__ __BYTE_ORDER
|
||||
+
|
||||
#endif
|
||||
|
||||
#ifdef USE_PCRE2
|
||||
--
|
||||
2.7.4
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
Do not make symbols hidden on Blackfin
|
||||
|
||||
The libselinux logic to hide internal symbols from the DSO doesn't
|
||||
work properly on Blackfin due to the USER_LABEL_PREFIX not being
|
||||
handled properly. A real fix is not that simple, so this patch simply
|
||||
disables the internal symbol hiding mechanism. This means that those
|
||||
symbols are visible in the final DSO, which is not a problem for
|
||||
proper execution, it just isn't as clean.
|
||||
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
|
||||
Index: b/src/dso.h
|
||||
===================================================================
|
||||
--- a/src/dso.h
|
||||
+++ b/src/dso.h
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef _SELINUX_DSO_H
|
||||
#define _SELINUX_DSO_H 1
|
||||
|
||||
-#ifdef SHARED
|
||||
+#if defined(SHARED) && !defined(__bfin__)
|
||||
# define hidden __attribute__ ((visibility ("hidden")))
|
||||
# define hidden_proto(fct) __hidden_proto (fct, fct##_internal)
|
||||
# define __hidden_proto(fct, internal) \
|
||||
@@ -0,0 +1,30 @@
|
||||
fix undefined macros in musl
|
||||
|
||||
musl does not define glibc-specific macros, so use a simple version of
|
||||
the macro when it is not defined.
|
||||
|
||||
This is very inefficient, however, but copying the code from glibc is
|
||||
not really possible because it is LGPL while libselinux in Public
|
||||
Domain, and we want to avoid license propagation, so this macro is
|
||||
completely written from scratch, and non-optimal.
|
||||
|
||||
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
|
||||
|
||||
diff -durN libselinux-2.1.13.orig/src/booleans.c libselinux-2.1.13/src/booleans.c
|
||||
--- libselinux-2.1.13.orig/src/booleans.c 2013-02-06 02:43:22.000000000 +0100
|
||||
+++ libselinux-2.1.13/src/booleans.c 2015-07-26 20:40:41.311801914 +0200
|
||||
@@ -62,6 +62,14 @@
|
||||
goto bad;
|
||||
}
|
||||
|
||||
+/* Simple (but inefficient) version of _D_ALLOC_NAMLEN when
|
||||
+ * building with a C library that misses it (e.g. musl).
|
||||
+ * Note: glibc does a strlen on (d)->d_name, so assume it is safe.
|
||||
+ */
|
||||
+#ifndef _D_ALLOC_NAMLEN
|
||||
+#define _D_ALLOC_NAMLEN(d) (strlen((d)->d_name)+1)
|
||||
+#endif
|
||||
+
|
||||
for (i = 0; i < *len; i++) {
|
||||
n[i] = (char *)malloc(_D_ALLOC_NAMLEN(namelist[i]));
|
||||
if (!n[i]) {
|
||||
@@ -0,0 +1,24 @@
|
||||
Makefile: revert libselinux: use ln --relative to create .so symlinks
|
||||
|
||||
This reverts 71393a181d63c9baae5fe8dcaeb9411d1f253998
|
||||
|
||||
ln --relative is too recent to be available in all distributions,
|
||||
especially enterprise-grade distros that can stick around as long as
|
||||
they are maintained (up to 10 years in some cases?).
|
||||
|
||||
For the sake of Buildroot, revert the upstream patch.
|
||||
|
||||
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
|
||||
|
||||
diff -durN a/src/Makefile b/src/Makefile
|
||||
--- a/src/Makefile
|
||||
+++ b/src/Makefile
|
||||
@@ -151,7 +151,7 @@
|
||||
install -m 755 $(LIBSO) $(SHLIBDIR)
|
||||
test -d $(LIBDIR)/pkgconfig || install -m 755 -d $(LIBDIR)/pkgconfig
|
||||
install -m 644 $(LIBPC) $(LIBDIR)/pkgconfig
|
||||
- ln -sf --relative $(SHLIBDIR)/$(LIBSO) $(LIBDIR)/$(TARGET)
|
||||
+ cd $(LIBDIR) && ln -sf ../../`basename $(SHLIBDIR)`/$(LIBSO) $(TARGET)
|
||||
|
||||
install-pywrap: pywrap
|
||||
test -d $(PYLIBDIR)/site-packages/selinux || install -m 755 -d $(PYLIBDIR)/site-packages/selinux
|
||||
25
bsp/buildroot-2017.02.11/package/libselinux/Config.in
Normal file
25
bsp/buildroot-2017.02.11/package/libselinux/Config.in
Normal file
@@ -0,0 +1,25 @@
|
||||
config BR2_PACKAGE_LIBSELINUX
|
||||
bool "libselinux"
|
||||
select BR2_PACKAGE_LIBSEPOL
|
||||
select BR2_PACKAGE_PCRE
|
||||
depends on BR2_TOOLCHAIN_HAS_THREADS
|
||||
depends on !BR2_STATIC_LIBS
|
||||
# Uses <fts.h>, not available in musl or uClibc
|
||||
depends on BR2_TOOLCHAIN_USES_GLIBC
|
||||
# Toolchain issue: "fixup not contained within frag"
|
||||
depends on !BR2_arc
|
||||
help
|
||||
libselinux is the runtime SELinux library that provides
|
||||
interfaces (e.g. library functions for the SELinux kernel
|
||||
APIs like getcon(), other support functions like
|
||||
getseuserbyname()) to SELinux-aware applications. libselinux
|
||||
may use the shared libsepol to manipulate the binary policy
|
||||
if necessary (e.g. to downgrade the policy format to an
|
||||
older version supported by the kernel) when loading policy.
|
||||
|
||||
http://selinuxproject.org/page/Main_Page
|
||||
|
||||
comment "libselinux needs a glibc toolchain w/ threads, dynamic library"
|
||||
depends on !BR2_arc
|
||||
depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS || \
|
||||
!BR2_TOOLCHAIN_USES_GLIBC
|
||||
@@ -0,0 +1,2 @@
|
||||
# Locally computed
|
||||
sha256 4ea2dde50665c202253ba5caac7738370ea0337c47b251ba981c60d24e1a118a libselinux-2.6.tar.gz
|
||||
86
bsp/buildroot-2017.02.11/package/libselinux/libselinux.mk
Normal file
86
bsp/buildroot-2017.02.11/package/libselinux/libselinux.mk
Normal file
@@ -0,0 +1,86 @@
|
||||
################################################################################
|
||||
#
|
||||
# libselinux
|
||||
#
|
||||
################################################################################
|
||||
|
||||
LIBSELINUX_VERSION = 2.6
|
||||
LIBSELINUX_SITE = https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20161014
|
||||
LIBSELINUX_LICENSE = Public Domain
|
||||
LIBSELINUX_LICENSE_FILES = LICENSE
|
||||
|
||||
LIBSELINUX_DEPENDENCIES = libsepol pcre
|
||||
|
||||
LIBSELINUX_INSTALL_STAGING = YES
|
||||
|
||||
# Filter out D_FILE_OFFSET_BITS=64. This fixes errors caused by glibc 2.22.
|
||||
LIBSELINUX_MAKE_OPTS = \
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
CFLAGS="$(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CFLAGS))" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS) -lpcre -lpthread" \
|
||||
ARCH=$(KERNEL_ARCH)
|
||||
|
||||
define LIBSELINUX_BUILD_CMDS
|
||||
# DESTDIR is needed during the compile to compute library and
|
||||
# header paths.
|
||||
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
|
||||
$(LIBSELINUX_MAKE_OPTS) DESTDIR=$(STAGING_DIR) all
|
||||
endef
|
||||
|
||||
define LIBSELINUX_INSTALL_STAGING_CMDS
|
||||
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
|
||||
$(LIBSELINUX_MAKE_OPTS) DESTDIR=$(STAGING_DIR) install
|
||||
endef
|
||||
|
||||
define LIBSELINUX_INSTALL_TARGET_CMDS
|
||||
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
|
||||
$(LIBSELINUX_MAKE_OPTS) DESTDIR=$(TARGET_DIR) install
|
||||
# Create the selinuxfs mount point
|
||||
if [ ! -d "$(TARGET_DIR)/selinux" ]; then mkdir $(TARGET_DIR)/selinux; fi
|
||||
if ! grep -q "selinuxfs" $(TARGET_DIR)/etc/fstab; then \
|
||||
echo "none /selinux selinuxfs noauto 0 0" >> $(TARGET_DIR)/etc/fstab ; fi
|
||||
endef
|
||||
|
||||
HOST_LIBSELINUX_DEPENDENCIES = \
|
||||
host-libsepol host-pcre host-swig
|
||||
|
||||
ifeq ($(BR2_PACKAGE_PYTHON3),y)
|
||||
HOST_LIBSELINUX_DEPENDENCIES += host-python3
|
||||
HOST_LIBSELINUX_PYINC = -I$(HOST_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR)m/
|
||||
HOST_LIBSELINUX_PYLIBVER = python$(PYTHON3_VERSION_MAJOR)
|
||||
else
|
||||
HOST_LIBSELINUX_DEPENDENCIES += host-python
|
||||
HOST_LIBSELINUX_PYINC = -I$(HOST_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR)/
|
||||
HOST_LIBSELINUX_PYLIBVER = python$(PYTHON_VERSION_MAJOR)
|
||||
endif
|
||||
|
||||
HOST_LIBSELINUX_MAKE_OPTS = \
|
||||
$(HOST_CONFIGURE_OPTS) \
|
||||
LDFLAGS="$(HOST_LDFLAGS) -lpcre -lpthread" \
|
||||
PYINC="$(HOST_LIBSELINUX_PYINC)" \
|
||||
PYSITEDIR="$(HOST_DIR)/usr/lib/$(HOST_LIBSELINUX_PYLIBVER)/site-packages" \
|
||||
SWIG_LIB="$(HOST_DIR)/usr/share/swig/$(SWIG_VERSION)/"
|
||||
|
||||
define HOST_LIBSELINUX_BUILD_CMDS
|
||||
# DESTDIR is needed during the compile to compute library and
|
||||
# header paths.
|
||||
$(HOST_MAKE_ENV) $(MAKE1) -C $(@D) \
|
||||
$(HOST_LIBSELINUX_MAKE_OPTS) DESTDIR=$(HOST_DIR) \
|
||||
SHLIBDIR=$(HOST_DIR)/usr/lib all
|
||||
# Generate python interface wrapper
|
||||
$(HOST_MAKE_ENV) $(MAKE1) -C $(@D) \
|
||||
$(HOST_LIBSELINUX_MAKE_OPTS) DESTDIR=$(HOST_DIR) swigify pywrap
|
||||
endef
|
||||
|
||||
define HOST_LIBSELINUX_INSTALL_CMDS
|
||||
$(HOST_MAKE_ENV) $(MAKE) -C $(@D) \
|
||||
$(HOST_LIBSELINUX_MAKE_OPTS) DESTDIR=$(HOST_DIR) \
|
||||
SHLIBDIR=$(HOST_DIR)/usr/lib SBINDIR=$(HOST_DIR)/usr/sbin install
|
||||
(cd $(HOST_DIR)/usr/lib; $(HOSTLN) -sf libselinux.so.1 libselinux.so)
|
||||
# Install python interface wrapper
|
||||
$(HOST_MAKE_ENV) $(MAKE) -C $(@D) \
|
||||
$(HOST_LIBSELINUX_MAKE_OPTS) DESTDIR=$(HOST_DIR) install-pywrap
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
||||
$(eval $(host-generic-package))
|
||||
Reference in New Issue
Block a user