Add buildroot 2018-02
This commit is contained in:
@@ -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) \
|
||||
30
buildroot/package/libselinux/0002-fix-musl-build.patch
Normal file
30
buildroot/package/libselinux/0002-fix-musl-build.patch
Normal file
@@ -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,137 @@
|
||||
libselinux: build: follow standard semantics for DESTDIR and PREFIX
|
||||
|
||||
This patch solves the following issues:
|
||||
- The pkg-config files generates odd paths when using DESTDIR without PREFIX
|
||||
- DESTDIR is needed during compile time to compute library and header paths which it should not.
|
||||
- Installing with both DESTDIR and PREFIX set gives us odd paths
|
||||
- Make usage of DESTDIR and PREFIX more standard
|
||||
|
||||
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
|
||||
|
||||
diff -durN libselinux.orig/include/Makefile libselinux/include/Makefile
|
||||
--- libselinux.orig/include/Makefile 2018-01-12 12:42:30.898709792 +0100
|
||||
+++ libselinux/include/Makefile 2018-01-12 10:02:57.745478435 +0100
|
||||
@@ -1,6 +1,6 @@
|
||||
# Installation directories.
|
||||
-PREFIX ?= $(DESTDIR)/usr
|
||||
-INCDIR ?= $(PREFIX)/include/selinux
|
||||
+PREFIX ?= /usr
|
||||
+INCDIR = $(DESTDIR)$(PREFIX)/include/selinux
|
||||
|
||||
all:
|
||||
|
||||
diff -durN libselinux.orig/man/Makefile libselinux/man/Makefile
|
||||
--- libselinux.orig/man/Makefile 2018-01-12 12:42:30.898709792 +0100
|
||||
+++ libselinux/man/Makefile 2018-01-12 10:02:57.745478435 +0100
|
||||
@@ -1,7 +1,8 @@
|
||||
# Installation directories.
|
||||
-MAN8DIR ?= $(DESTDIR)/usr/share/man/man8
|
||||
-MAN5DIR ?= $(DESTDIR)/usr/share/man/man5
|
||||
-MAN3DIR ?= $(DESTDIR)/usr/share/man/man3
|
||||
+PREFIX ?= /usr
|
||||
+MAN8DIR ?= $(DESTDIR)$(PREFIX)/share/man/man8
|
||||
+MAN5DIR ?= $(DESTDIR)$(PREFIX)/share/man/man5
|
||||
+MAN3DIR ?= $(DESTDIR)$(PREFIX)/share/man/man3
|
||||
|
||||
all:
|
||||
|
||||
diff -durN libselinux.orig/src/libselinux.pc.in libselinux/src/libselinux.pc.in
|
||||
--- libselinux.orig/src/libselinux.pc.in 2018-01-12 12:42:30.905376458 +0100
|
||||
+++ libselinux/src/libselinux.pc.in 2018-01-12 10:02:57.745478435 +0100
|
||||
@@ -1,6 +1,6 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=${prefix}
|
||||
-libdir=${exec_prefix}/@libdir@
|
||||
+libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: libselinux
|
||||
diff -durN libselinux.orig/src/Makefile libselinux/src/Makefile
|
||||
--- libselinux.orig/src/Makefile 2018-01-12 12:42:30.902043126 +0100
|
||||
+++ libselinux/src/Makefile 2018-01-12 10:02:57.745478435 +0100
|
||||
@@ -8,10 +8,10 @@
|
||||
PKG_CONFIG ?= pkg-config
|
||||
|
||||
# Installation directories.
|
||||
-PREFIX ?= $(DESTDIR)/usr
|
||||
+PREFIX ?= /usr
|
||||
LIBDIR ?= $(PREFIX)/lib
|
||||
-SHLIBDIR ?= $(DESTDIR)/lib
|
||||
INCLUDEDIR ?= $(PREFIX)/include
|
||||
+LIBINSTALL = $(DESTDIR)$(LIBDIR)
|
||||
PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX))
|
||||
PYLIBS ?= $(shell $(PKG_CONFIG) --libs $(PYPREFIX))
|
||||
PYSITEDIR ?= $(DESTDIR)$(shell $(PYTHON) -c 'import site; print(site.getsitepackages()[0])')
|
||||
@@ -19,8 +19,6 @@
|
||||
RUBYINC ?= $(shell $(RUBY) -e 'puts "-I" + RbConfig::CONFIG["rubyarchhdrdir"] + " -I" + RbConfig::CONFIG["rubyhdrdir"]')
|
||||
RUBYLIBS ?= $(shell $(RUBY) -e 'puts "-L" + RbConfig::CONFIG["libdir"] + " -L" + RbConfig::CONFIG["archlibdir"] + " " + RbConfig::CONFIG["LIBRUBYARG_SHARED"]')
|
||||
RUBYINSTALL ?= $(DESTDIR)$(shell $(RUBY) -e 'puts RbConfig::CONFIG["vendorarchdir"]')
|
||||
-LIBBASE ?= $(shell basename $(LIBDIR))
|
||||
-LIBSEPOLA ?= $(LIBDIR)/libsepol.a
|
||||
|
||||
VERSION = $(shell cat ../VERSION)
|
||||
LIBVERSION = 1
|
||||
@@ -148,7 +146,7 @@
|
||||
ln -sf $@ $(TARGET)
|
||||
|
||||
$(LIBPC): $(LIBPC).in ../VERSION
|
||||
- sed -e 's/@VERSION@/$(VERSION)/; s:@prefix@:$(PREFIX):; s:@libdir@:$(LIBBASE):; s:@includedir@:$(INCLUDEDIR):' < $< > $@
|
||||
+ sed -e 's/@VERSION@/$(VERSION)/; s:@prefix@:$(PREFIX):; s:@libdir@:$(LIBDIR):; s:@includedir@:$(INCLUDEDIR):' < $< > $@
|
||||
|
||||
selinuxswig_python_exception.i: ../include/selinux/selinux.h
|
||||
bash -e exception.sh > $@ || (rm -f $@ ; false)
|
||||
@@ -156,8 +154,8 @@
|
||||
$(AUDIT2WHYLOBJ): audit2why.c
|
||||
$(CC) $(filter-out -Werror, $(CFLAGS)) $(PYINC) -fPIC -DSHARED -c -o $@ $<
|
||||
|
||||
-$(AUDIT2WHYSO): $(AUDIT2WHYLOBJ) $(LIBSEPOLA)
|
||||
- $(CC) $(CFLAGS) $(LDFLAGS) -L. -shared -o $@ $^ -lselinux $(PYLIBS)
|
||||
+$(AUDIT2WHYSO): $(AUDIT2WHYLOBJ)
|
||||
+ $(CC) $(CFLAGS) $(LDFLAGS) -L. -shared -o $@ $^ -lselinux $(PYLIBS) -l:libsepol.a
|
||||
|
||||
%.o: %.c policy.h
|
||||
$(CC) $(CFLAGS) $(TLSFLAGS) -c -o $@ $<
|
||||
@@ -177,13 +175,13 @@
|
||||
$(SWIG) $<
|
||||
|
||||
install: all
|
||||
- test -d $(LIBDIR) || install -m 755 -d $(LIBDIR)
|
||||
- install -m 644 $(LIBA) $(LIBDIR)
|
||||
- test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR)
|
||||
- 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)
|
||||
+ test -d $(LIBINSTALL) || install -m 755 -d $(LIBINSTALL)
|
||||
+ install -m 644 $(LIBA) $(LIBINSTALL)
|
||||
+ test -d $(LIBINSTALL) || install -m 755 -d $(LIBINSTALL)
|
||||
+ install -m 755 $(LIBSO) $(LIBINSTALL)
|
||||
+ test -d $(LIBINSTALL)/pkgconfig || install -m 755 -d $(LIBINSTALL)/pkgconfig
|
||||
+ install -m 644 $(LIBPC) $(LIBINSTALL)/pkgconfig
|
||||
+ ln -sf --relative $(LIBINSTALL)/$(LIBSO) $(LIBINSTALL)/$(TARGET)
|
||||
|
||||
install-pywrap: pywrap
|
||||
test -d $(PYSITEDIR)/selinux || install -m 755 -d $(PYSITEDIR)/selinux
|
||||
@@ -196,7 +194,7 @@
|
||||
install -m 755 $(SWIGRUBYSO) $(RUBYINSTALL)/selinux.so
|
||||
|
||||
relabel:
|
||||
- /sbin/restorecon $(SHLIBDIR)/$(LIBSO)
|
||||
+ /sbin/restorecon $(LIBINSTALL)/$(LIBSO)
|
||||
|
||||
clean-pywrap:
|
||||
-rm -f $(SWIGLOBJ) $(SWIGSO) $(AUDIT2WHYLOBJ) $(AUDIT2WHYSO)
|
||||
diff -durN libselinux.orig/utils/Makefile libselinux/utils/Makefile
|
||||
--- libselinux.orig/utils/Makefile 2018-01-12 12:42:30.905376458 +0100
|
||||
+++ libselinux/utils/Makefile 2018-01-12 10:02:57.745478435 +0100
|
||||
@@ -1,8 +1,6 @@
|
||||
# Installation directories.
|
||||
-PREFIX ?= $(DESTDIR)/usr
|
||||
-LIBDIR ?= $(PREFIX)/lib
|
||||
-SBINDIR ?= $(PREFIX)/sbin
|
||||
-INCLUDEDIR ?= $(PREFIX)/include
|
||||
+PREFIX ?= /usr
|
||||
+SBINDIR ?= $(DESTDIR)$(PREFIX)/sbin
|
||||
|
||||
OS ?= $(shell uname)
|
||||
|
||||
24
buildroot/package/libselinux/0004-revert-ln-relative.patch
Normal file
24
buildroot/package/libselinux/0004-revert-ln-relative.patch
Normal file
@@ -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 -durNw libselinux-2.7.orig/src/Makefile libselinux-2.7/src/Makefile
|
||||
--- libselinux-2.7.orig/src/Makefile 2018-01-15 20:53:50.168525700 +0100
|
||||
+++ libselinux-2.7/src/Makefile 2018-01-15 20:55:27.061858005 +0100
|
||||
@@ -181,7 +181,7 @@
|
||||
install -m 755 $(LIBSO) $(LIBINSTALL)
|
||||
test -d $(LIBINSTALL)/pkgconfig || install -m 755 -d $(LIBINSTALL)/pkgconfig
|
||||
install -m 644 $(LIBPC) $(LIBINSTALL)/pkgconfig
|
||||
- ln -sf --relative $(LIBINSTALL)/$(LIBSO) $(LIBINSTALL)/$(TARGET)
|
||||
+ cd $(LIBINSTALL) && ln -sf $(LIBSO) $(TARGET)
|
||||
|
||||
install-pywrap: pywrap
|
||||
test -d $(PYSITEDIR)/selinux || install -m 755 -d $(PYSITEDIR)/selinux
|
||||
25
buildroot/package/libselinux/Config.in
Normal file
25
buildroot/package/libselinux/Config.in
Normal file
@@ -0,0 +1,25 @@
|
||||
config BR2_PACKAGE_LIBSELINUX
|
||||
bool "libselinux"
|
||||
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
|
||||
select BR2_PACKAGE_LIBSEPOL
|
||||
select BR2_PACKAGE_PCRE
|
||||
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
|
||||
2
buildroot/package/libselinux/libselinux.hash
Normal file
2
buildroot/package/libselinux/libselinux.hash
Normal file
@@ -0,0 +1,2 @@
|
||||
# From: https://github.com/SELinuxProject/selinux/wiki/Releases
|
||||
sha256 d0fec0769b3ad60aa7baf9b9a4b7a056827769dc2dadda0dc0eb59b3d1c18c57 libselinux-2.7.tar.gz
|
||||
112
buildroot/package/libselinux/libselinux.mk
Normal file
112
buildroot/package/libselinux/libselinux.mk
Normal file
@@ -0,0 +1,112 @@
|
||||
################################################################################
|
||||
#
|
||||
# libselinux
|
||||
#
|
||||
################################################################################
|
||||
|
||||
LIBSELINUX_VERSION = 2.7
|
||||
LIBSELINUX_SITE = https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20170804
|
||||
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)
|
||||
|
||||
LIBSELINUX_MAKE_INSTALL_TARGETS = install
|
||||
|
||||
ifeq ($(BR2_PACKAGE_PYTHON)$(BR2_PACKAGE_PYTHON3),y)
|
||||
ifeq ($(BR2_PACKAGE_PYTHON3),y)
|
||||
LIBSELINUX_DEPENDENCIES += python3 host-swig
|
||||
LIBSELINUX_PYINC = -I$(STAGING_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR)m
|
||||
LIBSELINUX_PYLIBVER = python$(PYTHON3_VERSION_MAJOR)
|
||||
else ifeq ($(BR2_PACKAGE_PYTHON),y)
|
||||
LIBSELINUX_DEPENDENCIES += python host-swig
|
||||
LIBSELINUX_PYINC = -I$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR)
|
||||
LIBSELINUX_PYLIBVER = python$(PYTHON_VERSION_MAJOR)
|
||||
endif
|
||||
|
||||
LIBSELINUX_MAKE_OPTS += \
|
||||
PYINC="$(LIBSELINUX_PYINC)" \
|
||||
PYSITEDIR=$(TARGET_DIR)/usr/lib/$(LIBSELINUX_PYLIBVER)/site-packages \
|
||||
SWIG_LIB="$(HOST_DIR)/share/swig/$(SWIG_VERSION)/"
|
||||
|
||||
LIBSELINUX_MAKE_INSTALL_TARGETS += install-pywrap
|
||||
|
||||
# dependencies are broken and result in file truncation errors at link
|
||||
# time if the Python bindings are built through the same make
|
||||
# invocation as the rest of the library.
|
||||
define LIBSELINUX_BUILD_PYTHON_BINDINGS
|
||||
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
|
||||
$(LIBSELINUX_MAKE_OPTS) swigify pywrap
|
||||
endef
|
||||
endif # python || python3
|
||||
|
||||
define LIBSELINUX_BUILD_CMDS
|
||||
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
|
||||
$(LIBSELINUX_MAKE_OPTS) all
|
||||
$(LIBSELINUX_BUILD_PYTHON_BINDINGS)
|
||||
endef
|
||||
|
||||
define LIBSELINUX_INSTALL_STAGING_CMDS
|
||||
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
|
||||
$(LIBSELINUX_MAKE_OPTS) DESTDIR=$(STAGING_DIR) \
|
||||
$(LIBSELINUX_MAKE_INSTALL_TARGETS)
|
||||
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)/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)/include/python$(PYTHON_VERSION_MAJOR)/
|
||||
HOST_LIBSELINUX_PYLIBVER = python$(PYTHON_VERSION_MAJOR)
|
||||
endif
|
||||
|
||||
HOST_LIBSELINUX_MAKE_OPTS = \
|
||||
$(HOST_CONFIGURE_OPTS) \
|
||||
PREFIX=$(HOST_DIR) \
|
||||
LDFLAGS="$(HOST_LDFLAGS) -lpcre -lpthread" \
|
||||
PYINC="$(HOST_LIBSELINUX_PYINC)" \
|
||||
PYSITEDIR="$(HOST_DIR)/lib/$(HOST_LIBSELINUX_PYLIBVER)/site-packages" \
|
||||
SWIG_LIB="$(HOST_DIR)/share/swig/$(SWIG_VERSION)/"
|
||||
|
||||
define HOST_LIBSELINUX_BUILD_CMDS
|
||||
$(HOST_MAKE_ENV) $(MAKE1) -C $(@D) \
|
||||
$(HOST_LIBSELINUX_MAKE_OPTS) all
|
||||
# Generate python interface wrapper
|
||||
$(HOST_MAKE_ENV) $(MAKE1) -C $(@D) \
|
||||
$(HOST_LIBSELINUX_MAKE_OPTS) swigify pywrap
|
||||
endef
|
||||
|
||||
define HOST_LIBSELINUX_INSTALL_CMDS
|
||||
$(HOST_MAKE_ENV) $(MAKE) -C $(@D) \
|
||||
$(HOST_LIBSELINUX_MAKE_OPTS) install
|
||||
ln -sf libselinux.so.1 $(HOST_DIR)/lib/libselinux.so
|
||||
# Install python interface wrapper
|
||||
$(HOST_MAKE_ENV) $(MAKE) -C $(@D) \
|
||||
$(HOST_LIBSELINUX_MAKE_OPTS) install-pywrap
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
||||
$(eval $(host-generic-package))
|
||||
Reference in New Issue
Block a user