commit: 8255eca15436b10fcc35958e97680088d7a163e4 Author: Aric Belsito <lluixhi <AT> gmail <DOT> com> AuthorDate: Sun Jan 8 21:31:25 2017 +0000 Commit: Aric Belsito <lluixhi <AT> gmail <DOT> com> CommitDate: Sun Jan 8 21:31:25 2017 +0000 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=8255eca1
sys-libs/libselinux: Add most recent version The only issue this package has with musl is that it requires libfts. In order to fix this a variable, "FTS_LDFLAGS" was added in the build-related-fixes patch and in the ebuild. sys-libs/libselinux/Manifest | 4 + ...x-2.6-0007-build-related-fixes-bug-500674.patch | 91 ++++++++++++ sys-libs/libselinux/libselinux-2.6.ebuild | 160 +++++++++++++++++++++ sys-libs/libselinux/metadata.xml | 19 +++ 4 files changed, 274 insertions(+) diff --git a/sys-libs/libselinux/Manifest b/sys-libs/libselinux/Manifest new file mode 100644 index 0000000..57a6f49 --- /dev/null +++ b/sys-libs/libselinux/Manifest @@ -0,0 +1,4 @@ +AUX libselinux-2.6-0007-build-related-fixes-bug-500674.patch 3580 SHA256 a9803f0f0876b12d909aa16da3968f80ed44fd56a59e2737df6196097ea59c4d SHA512 51c3b1bc1541b8b97ef7a25b01740cc6d05ee7bf7f6264e1f5d78e4fba02c957d48c437826d797354f295a92e53f51957e3e8c68d7ea1ba1113458c0b964ea23 WHIRLPOOL b8bf31c73401950afd7b11e57746399b214fb77cd8a1c3cc853d86c95f30665941e736782fd625b37af976c905cd467f9304c8c115ee541bd896edd8e1cec4df +DIST libselinux-2.6.tar.gz 203119 SHA256 4ea2dde50665c202253ba5caac7738370ea0337c47b251ba981c60d24e1a118a SHA512 906e1bf98c669862ab4f4e883d511db8d739a5763dc857c9405ad3cc6c70766a482853d07134698a1a98257a8632cc756d0549a7640c2915d051714f502ff14b WHIRLPOOL bf60ce907b7057ada5d19e3a0cd1f092a7dfc2de774e504762424c325c657a4f144fbe252e7d908f7c6d902d80388517e15134a289f4358e564c8720ea6534d9 +EBUILD libselinux-2.6.ebuild 4424 SHA256 bc60e0b28023cef4071582d410c852eda913e8bda3df42d3d300808b144130cf SHA512 8e40549853e7fe388eb367473789b6daa23b1cf55a508d464030c6f10a7404be15d56973b810f40ac8efa1bce0f7e27269b64a3360db6d0e466fff5d665c8780 WHIRLPOOL f330b7e670d10de160a92b0c6da898075d5ad6ca30438f6baf8cf626d666e3e3ff998b21ed1daefcae7ff5077f2c9a6702ad53eb51fb8c579b3c10f2d88b3d0f +MISC metadata.xml 676 SHA256 288211da34dc4cabaeaa85c52462c3ad2792347abbf88f78eae812a4e3dc8c8c SHA512 7b33e0d113637a129a7894d8720feb9024d67466b86d475fbc3398f514b2ecc28c70dc759952376208d2022a00658eb120fc3561edbb9c7ecdc4404bed5f57a7 WHIRLPOOL bd4938862e3ec119c1da448d5bc8c99a6063704a65c8a906514f5160adf65851af64c6a1c4626e97438e9f4a7288ef002b06a876b9d73e67d70e38ca31cc1319 diff --git a/sys-libs/libselinux/files/libselinux-2.6-0007-build-related-fixes-bug-500674.patch b/sys-libs/libselinux/files/libselinux-2.6-0007-build-related-fixes-bug-500674.patch new file mode 100644 index 0000000..7d78f9f --- /dev/null +++ b/sys-libs/libselinux/files/libselinux-2.6-0007-build-related-fixes-bug-500674.patch @@ -0,0 +1,91 @@ +https://bugs.gentoo.org/500674 + +random fixes: +- make sure PCRE_CFLAGS get used +- use PCRE_LIBS via pkg-config +- move LDFLAGS to before objects, not after +- do not hardcode -L$(LIBDIR) (let the toolchain handle it) +- do not hardcode -I$(INCLUDEDIR) (let the toolchain handle it) + +diff --git a/libselinux/Makefile b/libselinux/Makefile +index baa0db3..4dc5aa0 100644 +--- libselinux/Makefile ++++ libselinux/Makefile +@@ -1,5 +1,6 @@ + SUBDIRS = src include utils man + ++PKG_CONFIG ?= pkg-config + DISABLE_SETRANS ?= n + DISABLE_RPM ?= n + ANDROID_HOST ?= n +@@ -20,10 +21,11 @@ export DISABLE_SETRANS DISABLE_RPM DISABLE_FLAGS ANDROID_HOST + + USE_PCRE2 ?= n + ifeq ($(USE_PCRE2),y) +- PCRE_CFLAGS := -DUSE_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 +- PCRE_LDFLAGS := -lpcre2-8 ++ PCRE_CFLAGS := -DUSE_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 $(shell $(PKG_CONFIG) --cflags libpcre2-8) ++ PCRE_LDFLAGS := $(shell $(PKG_CONFIG) --libs libpcre2-8) + else +- PCRE_LDFLAGS := -lpcre ++ PCRE_CFLAGS := $(shell $(PKG_CONFIG) --cflags libpcre) ++ PCRE_LDFLAGS := $(shell $(PKG_CONFIG) --libs libpcre) + endif + export PCRE_CFLAGS PCRE_LDFLAGS + +diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile +index 13501cd..42cb2f6 100644 +--- libselinux/src/Makefile ++++ libselinux/src/Makefile +@@ -67,7 +67,7 @@ CFLAGS ?= -O -Wall -W -Wundef -Wformat-y2k -Wformat-security -Winit-self -Wmissi + + PCRE_LDFLAGS ?= -lpcre + +-override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE $(DISABLE_FLAGS) $(PCRE_CFLAGS) ++override CFLAGS += -I../include -D_GNU_SOURCE $(DISABLE_FLAGS) $(PCRE_CFLAGS) + + SWIG_CFLAGS += -Wno-error -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-parameter \ + -Wno-shadow -Wno-uninitialized -Wno-missing-prototypes -Wno-missing-declarations +@@ -107,17 +107,17 @@ $(SWIGRUBYLOBJ): $(SWIGRUBYCOUT) + $(CC) $(CFLAGS) $(SWIG_CFLAGS) $(RUBYINC) -fPIC -DSHARED -c -o $@ $< + + $(SWIGSO): $(SWIGLOBJ) +- $(CC) $(CFLAGS) -shared -o $@ $< -L. -lselinux $(LDFLAGS) -L$(LIBDIR) ++ $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $< -L. -lselinux + + $(SWIGRUBYSO): $(SWIGRUBYLOBJ) +- $(CC) $(CFLAGS) -shared -o $@ $^ -L. -lselinux $(LDFLAGS) -L$(LIBDIR) ++ $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -L. -lselinux + + $(LIBA): $(OBJS) + $(AR) rcs $@ $^ + $(RANLIB) $@ + + $(LIBSO): $(LOBJS) +- $(CC) $(CFLAGS) -shared -o $@ $^ $(PCRE_LDFLAGS) -ldl $(LDFLAGS) -L$(LIBDIR) -Wl,-soname,$(LIBSO),-z,defs,-z,relro ++ $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ $(PCRE_LDFLAGS) $(FTS_LDFLAGS) -ldl -Wl,-soname,$(LIBSO),-z,defs,-z,relro + ln -sf $@ $(TARGET) + + $(LIBPC): $(LIBPC).in ../VERSION +@@ -130,7 +130,7 @@ $(AUDIT2WHYLOBJ): audit2why.c + $(CC) $(filter-out -Werror, $(CFLAGS)) $(PYINC) -fPIC -DSHARED -c -o $@ $< + + $(AUDIT2WHYSO): $(AUDIT2WHYLOBJ) +- $(CC) $(CFLAGS) -shared -o $@ $^ -L. $(LDFLAGS) -lselinux $(LIBDIR)/libsepol.a -L$(LIBDIR) ++ $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -L. -lselinux $(LIBDIR)/libsepol.a + + %.o: %.c policy.h + $(CC) $(CFLAGS) $(TLSFLAGS) -c -o $@ $< +diff --git a/libselinux/utils/Makefile b/libselinux/utils/Makefile +index e56a953..6fd205a 100644 +--- libselinux/utils/Makefile ++++ libselinux/utils/Makefile +@@ -25,7 +25,7 @@ CFLAGS ?= -O -Wall -W -Wundef -Wformat-y2k -Wformat-security -Winit-self -Wmissi + -fipa-pure-const -Wno-suggest-attribute=pure -Wno-suggest-attribute=const \ + -Werror -Wno-aggregate-return -Wno-redundant-decls + override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE $(DISABLE_FLAGS) $(PCRE_CFLAGS) +-LDLIBS += -L../src -lselinux -L$(LIBDIR) ++LDLIBS += -L../src -lselinux + PCRE_LDFLAGS ?= -lpcre + + ifeq ($(ANDROID_HOST),y) diff --git a/sys-libs/libselinux/libselinux-2.6.ebuild b/sys-libs/libselinux/libselinux-2.6.ebuild new file mode 100644 index 0000000..c88f863 --- /dev/null +++ b/sys-libs/libselinux/libselinux-2.6.ebuild @@ -0,0 +1,160 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="6" +PYTHON_COMPAT=( python2_7 python3_4 python3_5 ) +USE_RUBY="ruby21 ruby22 ruby23" + +# No, I am not calling ruby-ng +inherit multilib python-r1 toolchain-funcs multilib-minimal + +MY_P="${P//_/-}" +SEPOL_VER="${PV}" +MY_RELEASEDATE="20161014" + +DESCRIPTION="SELinux userland library" +HOMEPAGE="https://github.com/SELinuxProject/selinux/wiki" + +if [[ ${PV} == 9999 ]] ; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/SELinuxProject/selinux.git" + S="${WORKDIR}/${MY_P}/${PN}" +else + SRC_URI="https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/${MY_RELEASEDATE}/${MY_P}.tar.gz" + KEYWORDS="amd64 ~arm ~arm64 ~mips x86" + S="${WORKDIR}/${MY_P}" +fi + +LICENSE="public-domain" +SLOT="0" + +IUSE="pcre2 python ruby static-libs ruby_targets_ruby21 ruby_targets_ruby22 ruby_targets_ruby23" + +RDEPEND=">=sys-libs/libsepol-${SEPOL_VER}:=[${MULTILIB_USEDEP}] + !pcre2? ( >=dev-libs/libpcre-8.33-r1:=[static-libs?,${MULTILIB_USEDEP}] ) + pcre2? ( dev-libs/libpcre2:=[static-libs?,${MULTILIB_USEDEP}] ) + python? ( ${PYTHON_DEPS} ) + ruby? ( + ruby_targets_ruby21? ( dev-lang/ruby:2.1 ) + ruby_targets_ruby22? ( dev-lang/ruby:2.2 ) + ruby_targets_ruby23? ( dev-lang/ruby:2.3 ) + ) + elibc_musl? ( sys-libs/musl-fts )" +DEPEND="${RDEPEND} + virtual/pkgconfig + python? ( >=dev-lang/swig-2.0.9 )" + +src_prepare() { + if [[ ${PV} != 9999 ]] ; then + # If needed for live builds, place them in /etc/portage/patches + eapply "${FILESDIR}/libselinux-2.6-0007-build-related-fixes-bug-500674.patch" + fi + + eapply_user + + multilib_copy_sources +} + +multilib_src_compile() { + tc-export AR CC PKG_CONFIG RANLIB + + emake \ + LIBDIR="\$(PREFIX)/$(get_libdir)" \ + SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \ + LDFLAGS="-fPIC ${LDFLAGS} -pthread" \ + USE_PCRE2="$(usex pcre2 y n)" \ + FTS_LDFLAGS="$(usex elibc_musl '-lfts' '')" \ + all + + if multilib_is_native_abi && use python; then + building() { + python_export PYTHON_INCLUDEDIR PYTHON_LIBPATH + emake \ + PYINC="-I${PYTHON_INCLUDEDIR}" \ + LDFLAGS="-fPIC ${LDFLAGS} -pthread" \ + FTS_LDFLAGS="$(usex elibc_musl '-lfts' '')" \ + LIBDIR="\$(PREFIX)/$(get_libdir)" \ + SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \ + USE_PCRE2="$(usex pcre2 y n)" \ + pywrap + } + python_foreach_impl building + fi + + if multilib_is_native_abi && use ruby; then + building() { + einfo "Calling rubywrap for ${1}" + # Clean up .lo file to force rebuild + rm -f src/selinuxswig_ruby_wrap.lo || die + emake \ + RUBY=${1} \ + LDFLAGS="-fPIC ${LDFLAGS} -pthread" \ + FTS_LDFLAGS="$(usex elibc_musl '-lfts' '')" \ + LIBDIR="\$(PREFIX)/$(get_libdir)" \ + SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \ + USE_PCRE2="$(usex pcre2 y n)" \ + rubywrap + } + for RUBYTARGET in ${USE_RUBY}; do + use ruby_targets_${RUBYTARGET} || continue + + building ${RUBYTARGET} + done + fi +} + +multilib_src_install() { + emake DESTDIR="${D}" \ + LIBDIR="\$(PREFIX)/$(get_libdir)" \ + SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \ + USE_PCRE2="$(usex pcre2 y n)" \ + install + + if multilib_is_native_abi && use python; then + installation() { + emake DESTDIR="${D}" \ + LIBDIR="\$(PREFIX)/$(get_libdir)" \ + USE_PCRE2="$(usex pcre2 y n)" \ + install-pywrap + python_optimize # bug 531638 + } + python_foreach_impl installation + fi + + if multilib_is_native_abi && use ruby; then + installation() { + einfo "Calling install-rubywrap for ${1}" + # Forcing (re)build here as otherwise the resulting SO file is used for all ruby versions + rm src/selinuxswig_ruby_wrap.lo + emake DESTDIR="${D}" \ + LIBDIR="\$(PREFIX)/$(get_libdir)" \ + RUBY=${1} \ + USE_PCRE2="$(usex pcre2 y n)" \ + install-rubywrap + } + for RUBYTARGET in ${USE_RUBY}; do + use ruby_targets_${RUBYTARGET} || continue + + installation ${RUBYTARGET} + done + fi + + use static-libs || rm "${D}"/usr/lib*/*.a || die +} + +pkg_postinst() { + # Fix bug 473502 + for POLTYPE in ${POLICY_TYPES}; + do + mkdir -p /etc/selinux/${POLTYPE}/contexts/files || die + touch /etc/selinux/${POLTYPE}/contexts/files/file_contexts.local || die + # Fix bug 516608 + for EXPRFILE in file_contexts file_contexts.homedirs file_contexts.local ; do + if [[ -f "/etc/selinux/${POLTYPE}/contexts/files/${EXPRFILE}" ]]; then + sefcontext_compile /etc/selinux/${POLTYPE}/contexts/files/${EXPRFILE} \ + || die "Failed to recompile contexts" + fi + done + done +} diff --git a/sys-libs/libselinux/metadata.xml b/sys-libs/libselinux/metadata.xml new file mode 100644 index 0000000..537e0aa --- /dev/null +++ b/sys-libs/libselinux/metadata.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>seli...@gentoo.org</email> + <name>SELinux Team</name> + </maintainer> + <longdescription> + Libselinux provides an API for SELinux applications to get and set + process and file security contexts and to obtain security policy + decisions. Required for any applications that use the SELinux API. + </longdescription> + <use> + <flag name="pcre2">Use <pkg>dev-libs/libpcre2</pkg> for fcontext regexes</flag> + </use> + <upstream> + <remote-id type="github">SELinuxProject/selinux</remote-id> + </upstream> +</pkgmetadata>