Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/libselinux/
Date: Sun, 31 Oct 2021 02:55:08
Message-Id: 1635648618.df809de8c35dc544230a58b787001531425a26b8.sam@gentoo
1 commit: df809de8c35dc544230a58b787001531425a26b8
2 Author: Jonathan Davies <jpds <AT> protonmail <DOT> com>
3 AuthorDate: Sun Oct 24 11:43:59 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 31 02:50:18 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=df809de8
7
8 sys-libs/libselinux: Version updated to 3.3.
9
10 Signed-off-by: Jonathan Davies <jpds <AT> protonmail.com>
11 Signed-off-by: Sam James <sam <AT> gentoo.org>
12
13 sys-libs/libselinux/Manifest | 1 +
14 sys-libs/libselinux/libselinux-3.3.ebuild | 156 ++++++++++++++++++++++++++++++
15 2 files changed, 157 insertions(+)
16
17 diff --git a/sys-libs/libselinux/Manifest b/sys-libs/libselinux/Manifest
18 index 3ba4acc00b6..18b3e6b273f 100644
19 --- a/sys-libs/libselinux/Manifest
20 +++ b/sys-libs/libselinux/Manifest
21 @@ -1,2 +1,3 @@
22 DIST libselinux-3.1.tar.gz 204703 BLAKE2B 72ff2d99dd6640405e804f58bdfbf05e152615ea92f902b3942602af13dc17080afeabb942ed33ae6b3f528870f4b11584e533848e455a97bf8f7151a8d44646 SHA512 57730cddd2d4751556d9e1f207c0f85119c81848f0620c16239e997150989e3f9a586a8c23861fd51ed89f7e084ad441190a58a288258a49a95f7beef7dbbb13
23 DIST libselinux-3.2.tar.gz 206380 BLAKE2B 544eaaa87b9738c61929abe48713b530a8909eaea017890040f2fe299af86f09b6eb2cf4c9a68e06268ba09923b2b67703ac7a2b973906acb45f698e9ccaeed2 SHA512 18129ac0b9936e1f66021f1b311cf1c1e27a01e50cb70f08a3e1c642c5251e4538aec25a8427778569dfecf5333cf1fb84f1a59afdce8019328d0cff7e5833c5
24 +DIST libselinux-3.3.tar.gz 206826 BLAKE2B e4cd2bf7172db1dd7661dd7981f875eb45f3c123805618edd03d7258f4b1f7afc974020187ec2e9e50dd59b3581ee21a29012eaa90ddfa82e43db4b8e60c51b7 SHA512 9a89c05ea4b17453168a985ece93ba6d6c4127916e657c46d4135eb59a1f6408faa0802cc2e49187defbde5247d659037beee089877affbab3eab6af3433696c
25
26 diff --git a/sys-libs/libselinux/libselinux-3.3.ebuild b/sys-libs/libselinux/libselinux-3.3.ebuild
27 new file mode 100644
28 index 00000000000..8653460938e
29 --- /dev/null
30 +++ b/sys-libs/libselinux/libselinux-3.3.ebuild
31 @@ -0,0 +1,156 @@
32 +# Copyright 1999-2021 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI="7"
36 +PYTHON_COMPAT=( python3_{7..10} )
37 +USE_RUBY="ruby25 ruby26 ruby27"
38 +
39 +# No, I am not calling ruby-ng
40 +inherit python-r1 toolchain-funcs multilib-minimal
41 +
42 +MY_PV="${PV//_/-}"
43 +MY_P="${PN}-${MY_PV}"
44 +
45 +DESCRIPTION="SELinux userland library"
46 +HOMEPAGE="https://github.com/SELinuxProject/selinux/wiki"
47 +
48 +if [[ ${PV} == 9999 ]]; then
49 + inherit git-r3
50 + EGIT_REPO_URI="https://github.com/SELinuxProject/selinux.git"
51 + S="${WORKDIR}/${P}/${PN}"
52 +else
53 + SRC_URI="https://github.com/SELinuxProject/selinux/releases/download/${MY_PV}/${MY_P}.tar.gz"
54 + KEYWORDS="~amd64 ~arm ~arm64 ~mips ~riscv ~x86"
55 + S="${WORKDIR}/${MY_P}"
56 +fi
57 +
58 +LICENSE="public-domain"
59 +SLOT="0"
60 +IUSE="pcre2 python ruby static-libs ruby_targets_ruby25 ruby_targets_ruby26 ruby_targets_ruby27"
61 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
62 +
63 +RDEPEND=">=sys-libs/libsepol-${PV}:=[${MULTILIB_USEDEP}]
64 + !pcre2? ( >=dev-libs/libpcre-8.33-r1:=[static-libs?,${MULTILIB_USEDEP}] )
65 + pcre2? ( dev-libs/libpcre2:=[static-libs?,${MULTILIB_USEDEP}] )
66 + python? ( ${PYTHON_DEPS} )
67 + ruby? (
68 + ruby_targets_ruby25? ( dev-lang/ruby:2.5 )
69 + ruby_targets_ruby26? ( dev-lang/ruby:2.6 )
70 + ruby_targets_ruby27? ( dev-lang/ruby:2.7 )
71 + )
72 + elibc_musl? ( sys-libs/fts-standalone )"
73 +DEPEND="${RDEPEND}"
74 +BDEPEND="virtual/pkgconfig
75 + python? ( >=dev-lang/swig-2.0.9 )
76 + ruby? ( >=dev-lang/swig-2.0.9 )"
77 +
78 +src_prepare() {
79 + eapply_user
80 +
81 + multilib_copy_sources
82 +}
83 +
84 +multilib_src_compile() {
85 + tc-export AR CC PKG_CONFIG RANLIB
86 +
87 + local -x CFLAGS="${CFLAGS} -fno-semantic-interposition"
88 +
89 + emake \
90 + LIBDIR="\$(PREFIX)/$(get_libdir)" \
91 + SHLIBDIR="/$(get_libdir)" \
92 + LDFLAGS="-fPIC ${LDFLAGS} -pthread" \
93 + USE_PCRE2="$(usex pcre2 y n)" \
94 + FTS_LDLIBS="$(usex elibc_musl '-lfts' '')" \
95 + all
96 +
97 + if multilib_is_native_abi && use python; then
98 + building() {
99 + emake \
100 + LDFLAGS="-fPIC ${LDFLAGS} -lpthread" \
101 + LIBDIR="\$(PREFIX)/$(get_libdir)" \
102 + SHLIBDIR="/$(get_libdir)" \
103 + USE_PCRE2="$(usex pcre2 y n)" \
104 + FTS_LDLIBS="$(usex elibc_musl '-lfts' '')" \
105 + pywrap
106 + }
107 + python_foreach_impl building
108 + fi
109 +
110 + if multilib_is_native_abi && use ruby; then
111 + building() {
112 + einfo "Calling rubywrap for ${1}"
113 + # Clean up .lo file to force rebuild
114 + rm -f src/selinuxswig_ruby_wrap.lo || die
115 + emake \
116 + RUBY=${1} \
117 + LDFLAGS="-fPIC ${LDFLAGS} -lpthread" \
118 + LIBDIR="\$(PREFIX)/$(get_libdir)" \
119 + SHLIBDIR="/$(get_libdir)" \
120 + USE_PCRE2="$(usex pcre2 y n)" \
121 + FTS_LDLIBS="$(usex elibc_musl '-lfts' '')" \
122 + rubywrap
123 + }
124 + for RUBYTARGET in ${USE_RUBY}; do
125 + use ruby_targets_${RUBYTARGET} || continue
126 +
127 + building ${RUBYTARGET}
128 + done
129 + fi
130 +}
131 +
132 +multilib_src_install() {
133 + emake DESTDIR="${D}" \
134 + LIBDIR="\$(PREFIX)/$(get_libdir)" \
135 + SHLIBDIR="/$(get_libdir)" \
136 + USE_PCRE2="$(usex pcre2 y n)" \
137 + install
138 +
139 + if multilib_is_native_abi && use python; then
140 + installation() {
141 + emake DESTDIR="${D}" \
142 + LIBDIR="\$(PREFIX)/$(get_libdir)" \
143 + SHLIBDIR="/$(get_libdir)" \
144 + USE_PCRE2="$(usex pcre2 y n)" \
145 + install-pywrap
146 + python_optimize # bug 531638
147 + }
148 + python_foreach_impl installation
149 + fi
150 +
151 + if multilib_is_native_abi && use ruby; then
152 + installation() {
153 + einfo "Calling install-rubywrap for ${1}"
154 + # Forcing (re)build here as otherwise the resulting SO file is used for all ruby versions
155 + rm src/selinuxswig_ruby_wrap.lo
156 + emake DESTDIR="${D}" \
157 + LIBDIR="\$(PREFIX)/$(get_libdir)" \
158 + SHLIBDIR="/$(get_libdir)" \
159 + RUBY=${1} \
160 + USE_PCRE2="$(usex pcre2 y n)" \
161 + install-rubywrap
162 + }
163 + for RUBYTARGET in ${USE_RUBY}; do
164 + use ruby_targets_${RUBYTARGET} || continue
165 +
166 + installation ${RUBYTARGET}
167 + done
168 + fi
169 +
170 + use static-libs || rm "${D}"/usr/lib*/*.a || die
171 +}
172 +
173 +pkg_postinst() {
174 + # Fix bug 473502
175 + for POLTYPE in ${POLICY_TYPES};
176 + do
177 + mkdir -p /etc/selinux/${POLTYPE}/contexts/files || die
178 + touch /etc/selinux/${POLTYPE}/contexts/files/file_contexts.local || die
179 + # Fix bug 516608
180 + for EXPRFILE in file_contexts file_contexts.homedirs file_contexts.local ; do
181 + if [[ -f "/etc/selinux/${POLTYPE}/contexts/files/${EXPRFILE}" ]]; then
182 + sefcontext_compile /etc/selinux/${POLTYPE}/contexts/files/${EXPRFILE} \
183 + || die "Failed to recompile contexts"
184 + fi
185 + done
186 + done
187 +}