diff options
author | 2018-04-27 18:38:04 +0000 | |
---|---|---|
committer | 2018-04-27 16:02:30 -0400 | |
commit | 2485547768696f2341cb011a596001deec0be271 (patch) | |
tree | 1b0f3a8dd0d872590128ffc73c74b937be86cd4f /sys-libs | |
parent | Apparmor without libintl fix (diff) | |
download | musl-2485547768696f2341cb011a596001deec0be271.tar.gz musl-2485547768696f2341cb011a596001deec0be271.tar.bz2 musl-2485547768696f2341cb011a596001deec0be271.zip |
libapparmor
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'sys-libs')
-rw-r--r-- | sys-libs/libapparmor/Manifest | 4 | ||||
-rw-r--r-- | sys-libs/libapparmor/files/libapparmor-2.12-musl.patch | 163 | ||||
-rw-r--r-- | sys-libs/libapparmor/libapparmor-2.12.0.ebuild | 95 | ||||
-rw-r--r-- | sys-libs/libapparmor/metadata.xml | 14 |
4 files changed, 276 insertions, 0 deletions
diff --git a/sys-libs/libapparmor/Manifest b/sys-libs/libapparmor/Manifest new file mode 100644 index 00000000..f81d0a13 --- /dev/null +++ b/sys-libs/libapparmor/Manifest @@ -0,0 +1,4 @@ +AUX libapparmor-2.12-musl.patch 3985 BLAKE2B 011f4fa5ef60156510918624bba6b88c5b4335b02cb078f5b8c79071c97bd5c2f1cd2091580d8770133ca22217e4c26cd9f96b9bc8a01b8f719a2e6ff85efabb SHA512 2498ac90882c36d63a54017486e0a750bcc5feff87bd265f6098366cd633315fce884c208fd9f431a9aca9c1c9b60f941b28c16aff0a82543d99605e8d7582a5 +DIST apparmor-2.12.tar.gz 7258450 BLAKE2B c1d4e01d836c5f567ddb7c5ecf36dde6efccf1e59ae219824129fd5c92162a3fed7ebdc492f181ae132b07db068660078a9631543d40fd20ab0b44cd4c646d4c SHA512 d85fd47c66333fe5658ee5e977b32142697f6e36c575550712ee2ace2ad0fbf2aa59c8fd3b82ad8821c0190adf8cc150cf623ea09a84d5b32bde050a03dd6e9a +EBUILD libapparmor-2.12.0.ebuild 2117 BLAKE2B 89c78a072c2c03b9d1542ddf36e1ba9990ab53e6fcef9f54554e28fa2d7ded4bedf2c154767b529938bd326552d839a5f2e655c6d463e2691c291fc30b2553bc SHA512 45e04eafa5c3eb66d056779aa9d3a6f95d4abbe8fe1ced37bb0ac4c7219accad80a9af3811a31705ab1e9ff399f19fb038711297ba9f1a75bb06a7ca861cdc95 +MISC metadata.xml 409 BLAKE2B 63cb1726a015cf118e8ffcc8cf9d49795a75d367e36b0332fbf23faad8b3eed41e2ae090cc92757e12248d831e0ea1782b6f275ef02b7d2d2022bf2b79f69042 SHA512 a66647c5e40f2593017942c12786dc30995e7980fdb58c1de0b9ae34069434cb5a4c70b2bd268a239df82edfcc1e7288e8033bf57609f757a321639afd5e78b8 diff --git a/sys-libs/libapparmor/files/libapparmor-2.12-musl.patch b/sys-libs/libapparmor/files/libapparmor-2.12-musl.patch new file mode 100644 index 00000000..d2bc5946 --- /dev/null +++ b/sys-libs/libapparmor/files/libapparmor-2.12-musl.patch @@ -0,0 +1,163 @@ +--- a/configure.ac 2018-04-15 04:23:39.953481823 +0000 ++++ b/configure.ac 2018-04-15 04:33:34.474448938 +0000 +@@ -81,7 +81,7 @@ + AC_HEADER_STDC + AC_CHECK_HEADERS(unistd.h stdint.h syslog.h) + +-AC_CHECK_FUNCS([asprintf __secure_getenv secure_getenv]) ++AC_CHECK_FUNCS([asprintf __secure_getenv secure_getenv scandirat]) + + AM_PROG_CC_C_O + AC_C_CONST +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -46,9 +46,9 @@ + LC_ALL=C sed -n -e "/IPPROTO_MAX/d" -e "s/^\#define[ \\t]\\+IPPROTO_\\([A-Z0-9_]\\+\\)\\(.*\\)$$/AA_GEN_PROTO_ENT(\\UIPPROTO_\\1, \"\\L\\1\")/p" $< > $@ + + lib_LTLIBRARIES = libapparmor.la +-noinst_HEADERS = grammar.h parser.h scanner.h af_protos.h private.h ++noinst_HEADERS = grammar.h parser.h scanner.h af_protos.h secure_getenv.h scandirat.h private.h + +-libapparmor_la_SOURCES = grammar.y libaalogparse.c kernel.c scanner.c private.c features.c kernel_interface.c policy_cache.c ++libapparmor_la_SOURCES = grammar.y libaalogparse.c kernel.c scanner.c secure_getenv.c scandirat.c private.c features.c kernel_interface.c policy_cache.c + libapparmor_la_LDFLAGS = -version-info $(AA_LIB_CURRENT):$(AA_LIB_REVISION):$(AA_LIB_AGE) -XCClinker -dynamic -pthread \ + -Wl,--version-script=$(top_srcdir)/src/libapparmor.map + +--- a/src/private.c ++++ b/src/private.c +@@ -39,10 +39,14 @@ + #ifdef HAVE___SECURE_GETENV + #define secure_getenv __secure_getenv + #else +- #error neither secure_getenv nor __secure_getenv is available ++ #include "secure_getenv.h" + #endif + #endif + ++#ifndef HAVE_SCANDIRAT ++#include "scandirat.h" ++#endif ++ + struct ignored_suffix_t { + const char * text; + int len; +--- /dev/null ++++ b/src/scandirat.c +@@ -0,0 +1,62 @@ ++#include <dirent.h> ++#include <string.h> ++#include <stdlib.h> ++#include <unistd.h> ++#include <fcntl.h> ++#include <inttypes.h> ++#include <errno.h> ++ ++#include "scandirat.h" ++ ++#ifndef HAVE_SCANDIRAT ++ ++int scandirat(int dir_fd, const char *dirp, struct dirent ***namelist, ++ int (*filter)(const struct dirent *), ++ int (*compar)(const struct dirent **, const struct dirent **)) ++{ ++ int fd; ++ DIR *d; ++ struct dirent *de, **names=0, **tmp; ++ size_t cnt=0, len=0; ++ int old_errno = errno; ++ ++ ++ fd = openat(dir_fd, dirp, O_RDONLY|O_CLOEXEC); ++ if (fd == -1) return -1; ++ ++ d = fdopendir(fd); ++ ++ if (!d) { ++ close(fd); ++ return -1; ++ } ++ ++ while ((errno=0), (de = readdir(d))) { ++ if (filter && !filter(de)) continue; ++ if (cnt >= len) { ++ len = 2*len+1; ++ if (len > SIZE_MAX/sizeof *names) break; ++ tmp = realloc(names, len * sizeof *names); ++ if (!tmp) break; ++ names = tmp; ++ } ++ names[cnt] = malloc(de->d_reclen); ++ if (!names[cnt]) break; ++ memcpy(names[cnt++], de, de->d_reclen); ++ } ++ ++ closedir(d); ++ ++ if (errno) { ++ if (names) while (cnt-->0) free(names[cnt]); ++ free(names); ++ return -1; ++ } ++ errno = old_errno; ++ ++ if (compar) qsort(names, cnt, sizeof *names, (int (*)(const void *, const void *))compar); ++ *namelist = names; ++ return cnt; ++} ++ ++#endif +--- /dev/null ++++ b/src/scandirat.h +@@ -0,0 +1,13 @@ ++#ifndef LIBAPPARMOR_SCANDIRAT_H ++#define LIBAPPARMOR_SCANDIRAT_H ++ ++#include <dirent.h> ++ ++#ifndef HAVE_SCANDIRAT ++int scandirat(int dir_fd, const char *dirp, struct dirent ***namelist, ++ int (*filter)(const struct dirent *), ++ int (*compar)(const struct dirent **, const struct dirent **)); ++#endif ++ ++#endif ++ +--- /dev/null ++++ b/src/secure_getenv.c +@@ -0,0 +1,15 @@ ++#include <stdlib.h> ++#include <sys/auxv.h> ++ ++#include "secure_getenv.h" ++ ++#ifndef HAVE_SECURE_GETENV ++char *secure_getenv(const char *name) ++{ ++ if (!getauxval(AT_SECURE)) { ++ return getenv(name); ++ } ++ return NULL; ++} ++#endif ++ +--- /dev/null ++++ b/src/secure_getenv.h +@@ -0,0 +1,8 @@ ++#ifndef LIBAPPARMOR_SECURE_GETENV_H ++#define LIBAPPARMOR_SECURE_GETENV_H ++ ++#ifndef HAVE_SECURE_GETENV ++char *secure_getenv(const char *name); ++#endif ++ ++#endif +--- a/src/libapparmor.map ++++ b/src/libapparmor.map +@@ -94,6 +94,7 @@ + _aa_autoclose; + _aa_autofclose; + _aa_dirat_for_each; ++ _aa_asprintf; + local: + *; + }; diff --git a/sys-libs/libapparmor/libapparmor-2.12.0.ebuild b/sys-libs/libapparmor/libapparmor-2.12.0.ebuild new file mode 100644 index 00000000..0c1038d4 --- /dev/null +++ b/sys-libs/libapparmor/libapparmor-2.12.0.ebuild @@ -0,0 +1,95 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +AUTOTOOLS_AUTORECONF=1 +DISTUTILS_OPTIONAL=1 +PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} ) +GENTOO_DEPEND_ON_PERL="no" + +inherit autotools-utils distutils-r1 perl-functions versionator + +MY_PV="$(get_version_component_range 1-2)" + +DESCRIPTION="Library to support AppArmor userspace utilities" +HOMEPAGE="http://apparmor.net/" +SRC_URI="https://launchpad.net/apparmor/${MY_PV}/${PV}/+download/apparmor-${MY_PV}.tar.gz" + +LICENSE="LGPL-2.1" +SLOT="0" +KEYWORDS="amd64 ~x86" +IUSE="doc +perl +python static-libs" + +REQUIRED_USE="${PYTHON_REQUIRED_USE}" + +RDEPEND="perl? ( dev-lang/perl:= ) + python? ( ${PYTHON_DEPS} )" + +DEPEND="${RDEPEND} + sys-devel/autoconf-archive + sys-devel/bison + sys-devel/flex + doc? ( dev-lang/perl ) + perl? ( dev-lang/swig ) + python? ( dev-lang/swig )" + +S=${WORKDIR}/apparmor-${MY_PV}/libraries/${PN} + +PATCHES=( "${FILESDIR}/libapparmor-${MY_PV}-musl.patch" ) + +RESTRICT="test" + +src_prepare() { + autotools-utils_src_prepare + use python && distutils-r1_src_prepare +} + +src_configure() { + local myeconfargs=( + $(use_with perl) \ + $(use_with python) + ) + + autotools-utils_src_configure +} + +src_compile() { + autotools-utils_src_compile -C src + autotools-utils_src_compile -C include + use doc && autotools-utils_src_compile -C doc + use perl && autotools-utils_src_compile -C swig/perl + + if use python ; then + pushd "${BUILD_DIR}"/swig/python > /dev/null + emake libapparmor_wrap.c + distutils-r1_src_compile + popd > /dev/null + fi +} + +src_install() { + autotools-utils_src_install -C src + autotools-utils_src_install -C include + use doc && autotools-utils_src_install -C doc + + if use perl ; then + autotools-utils_src_install -C swig/perl + perl_set_version + insinto "${VENDOR_ARCH}" + doins "${BUILD_DIR}"/swig/perl/LibAppArmor.pm + + # bug 620886 + perl_delete_localpod + perl_fix_packlist + fi + + if use python ; then + pushd "${BUILD_DIR}"/swig/python > /dev/null + distutils-r1_src_install + + python_moduleinto LibAppArmor + python_foreach_impl python_domodule LibAppArmor.py + popd > /dev/null + fi +} diff --git a/sys-libs/libapparmor/metadata.xml b/sys-libs/libapparmor/metadata.xml new file mode 100644 index 00000000..42d1e8f6 --- /dev/null +++ b/sys-libs/libapparmor/metadata.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>kensington@gentoo.org</email> + </maintainer> + <maintainer type="project"> + <email>hardened@gentoo.org</email> + <name>Gentoo Hardened</name> + </maintainer> + <upstream> + <remote-id type="launchpad">apparmor</remote-id> + </upstream> +</pkgmetadata> |