*/*: Discontinue Gentoo SuperH port
[gentoo.git] / sys-apps / sandbox / sandbox-2.14.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="6"
5
6 inherit eutils flag-o-matic multilib-minimal multiprocessing pax-utils
7
8 DESCRIPTION="sandbox'd LD_PRELOAD hack"
9 HOMEPAGE="https://www.gentoo.org/proj/en/portage/sandbox/"
10 SRC_URI="https://dev.gentoo.org/~mgorny/dist/${P}.tar.xz"
11
12 LICENSE="GPL-2"
13 SLOT="0"
14 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
15 IUSE=""
16
17 DEPEND="app-arch/xz-utils
18         >=app-misc/pax-utils-0.1.19" #265376
19 RDEPEND=""
20
21 has sandbox_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS="${EBUILD_DEATH_HOOKS} sandbox_death_notice"
22
23 sandbox_death_notice() {
24         ewarn "If configure failed with a 'cannot run C compiled programs' error, try this:"
25         ewarn "FEATURES='-sandbox -usersandbox' emerge sandbox"
26 }
27
28 multilib_src_configure() {
29         filter-lfs-flags #90228
30
31         local myconf=()
32         host-is-pax && myconf+=( --disable-pch ) #301299 #425524 #572092
33
34         ECONF_SOURCE="${S}" \
35         econf "${myconf[@]}"
36 }
37
38 multilib_src_test() {
39         # Default sandbox build will run with --jobs set to # cpus.
40         emake check TESTSUITEFLAGS="--jobs=$(makeopts_jobs)"
41 }
42
43 multilib_src_install_all() {
44         doenvd "${FILESDIR}"/09sandbox
45
46         keepdir /var/log/sandbox
47         fowners root:portage /var/log/sandbox
48         fperms 0770 /var/log/sandbox
49
50         dodoc AUTHORS ChangeLog* NEWS README
51 }
52
53 pkg_preinst() {
54         chown root:portage "${ED}"/var/log/sandbox
55         chmod 0770 "${ED}"/var/log/sandbox
56
57         local v
58         for v in ${REPLACING_VERSIONS}; do
59                 if [[ ${v} == 1.* ]] ; then
60                         local old=$(find "${EROOT}"/lib* -maxdepth 1 -name 'libsandbox*')
61                         if [[ -n ${old} ]] ; then
62                                 elog "Removing old sandbox libraries for you:"
63                                 find "${EROOT}"/lib* -maxdepth 1 -name 'libsandbox*' -print -delete
64                         fi
65                 fi
66         done
67 }
68
69 pkg_postinst() {
70         local v
71         for v in ${REPLACING_VERSIONS}; do
72                 if [[ ${v} == 1.* ]] ; then
73                         chmod 0755 "${EROOT}"/etc/sandbox.d #265376
74                 fi
75         done
76 }