Remove net-voip/blink
[portage-overlay.git] / app-emulation / lxc / lxc-1.0.7.ebuild
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="5"
6
7 MY_P="${P/_/-}"
8 PYTHON_COMPAT=( python{3_3,3_4} )
9 DISTUTILS_OPTIONAL=1
10
11 inherit autotools bash-completion-r1 distutils-r1 eutils linux-info versionator flag-o-matic systemd
12
13 DESCRIPTION="LinuX Containers userspace utilities"
14 HOMEPAGE="https://linuxcontainers.org/"
15 SRC_URI="https://github.com/lxc/lxc/archive/${MY_P}.tar.gz"
16
17 KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
18
19 LICENSE="LGPL-3"
20 SLOT="0"
21 IUSE="doc examples lua python seccomp"
22
23 RDEPEND="net-libs/gnutls
24         sys-libs/libcap
25         lua? ( >=dev-lang/lua-5.1:= )
26         python? ( ${PYTHON_DEPS} )
27         seccomp? ( sys-libs/libseccomp )"
28
29 DEPEND="${RDEPEND}
30         doc? ( app-text/docbook-sgml-utils )
31         >=sys-kernel/linux-headers-3.2"
32
33 RDEPEND="${RDEPEND}
34         sys-apps/util-linux
35         app-misc/pax-utils
36         virtual/awk"
37
38 CONFIG_CHECK="~CGROUPS ~CGROUP_DEVICE
39         ~CPUSETS ~CGROUP_CPUACCT
40         ~RESOURCE_COUNTERS
41         ~CGROUP_SCHED
42
43         ~NAMESPACES
44         ~IPC_NS ~USER_NS ~PID_NS
45
46         ~DEVPTS_MULTIPLE_INSTANCES
47         ~CGROUP_FREEZER
48         ~UTS_NS ~NET_NS
49         ~VETH ~MACVLAN
50
51         ~POSIX_MQUEUE
52         ~!NETPRIO_CGROUP
53
54         ~!GRKERNSEC_CHROOT_MOUNT
55         ~!GRKERNSEC_CHROOT_DOUBLE
56         ~!GRKERNSEC_CHROOT_PIVOT
57         ~!GRKERNSEC_CHROOT_CHMOD
58         ~!GRKERNSEC_CHROOT_CAPS
59         ~!GRKERNSEC_PROC
60 "
61
62 ERROR_DEVPTS_MULTIPLE_INSTANCES="CONFIG_DEVPTS_MULTIPLE_INSTANCES:      needed for pts inside container"
63
64 ERROR_CGROUP_FREEZER="CONFIG_CGROUP_FREEZER:    needed to freeze containers"
65
66 ERROR_UTS_NS="CONFIG_UTS_NS:    needed to unshare hostnames and uname info"
67 ERROR_NET_NS="CONFIG_NET_NS:    needed for unshared network"
68
69 ERROR_VETH="CONFIG_VETH:        needed for internal (host-to-container) networking"
70 ERROR_MACVLAN="CONFIG_MACVLAN:  needed for internal (inter-container) networking"
71
72 ERROR_POSIX_MQUEUE="CONFIG_POSIX_MQUEUE:        needed for lxc-execute command"
73
74 ERROR_NETPRIO_CGROUP="CONFIG_NETPRIO_CGROUP:    as of kernel 3.3 and lxc 0.8.0_rc1 this causes LXCs to fail booting."
75
76 ERROR_GRKERNSEC_CHROOT_MOUNT=":CONFIG_GRKERNSEC_CHROOT_MOUNT    some GRSEC features make LXC unusable see postinst notes"
77 ERROR_GRKERNSEC_CHROOT_DOUBLE=":CONFIG_GRKERNSEC_CHROOT_DOUBLE  some GRSEC features make LXC unusable see postinst notes"
78 ERROR_GRKERNSEC_CHROOT_PIVOT=":CONFIG_GRKERNSEC_CHROOT_PIVOT    some GRSEC features make LXC unusable see postinst notes"
79 ERROR_GRKERNSEC_CHROOT_CHMOD=":CONFIG_GRKERNSEC_CHROOT_CHMOD    some GRSEC features make LXC unusable see postinst notes"
80 ERROR_GRKERNSEC_CHROOT_CAPS=":CONFIG_GRKERNSEC_CHROOT_CAPS      some GRSEC features make LXC unusable see postinst notes"
81 ERROR_GRKERNSEC_PROC=":CONFIG_GRKERNSEC_PROC:  this GRSEC feature is incompatible with unprivileged containers"
82
83 DOCS=(AUTHORS CONTRIBUTING MAINTAINERS NEWS README doc/FAQ.txt)
84
85 S="${WORKDIR}/${PN}-${MY_P}"
86
87 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
88
89 src_prepare() {
90         sed -i 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/g' configure.ac || die
91         if [[ -n ${BACKPORTS} ]]; then
92                 epatch "${WORKDIR}"/patches/*
93         fi
94
95         epatch "${FILESDIR}"/${PN}-1.0.6-bash-completion.patch \
96                "${FILESDIR}"/${PN}-1.0.7-kf-gentoo-template.patch
97
98         eautoreconf
99 }
100
101 src_configure() {
102         append-flags -fno-strict-aliasing
103
104         econf \
105                 --localstatedir=/var \
106                 --bindir=/usr/sbin \
107                 --docdir=/usr/share/doc/${PF} \
108                 --with-config-path=/etc/lxc     \
109                 --with-rootfs-path=/usr/lib/lxc/rootfs \
110                 --with-distro=gentoo \
111                 $(use_enable doc) \
112                 --disable-apparmor \
113                 $(use_enable examples) \
114                 $(use_enable lua) \
115                 $(use_enable seccomp) \
116                 --disable-python
117 }
118
119 python_compile() {
120         distutils-r1_python_compile build_ext -I ../ -L ../${PN}
121 }
122
123 src_compile() {
124         default
125
126         if use python; then
127                 pushd "${S}/src/python-${PN}" > /dev/null
128                 distutils-r1_src_compile
129                 popd > /dev/null
130         fi
131 }
132
133 src_install() {
134         default
135
136         mv "${ED}"/usr/share/bash-completion/completions/${PN} "${ED}"/$(get_bashcompdir)/${PN}-start || die
137         bashcomp_alias ${PN}-start \
138                 ${PN}-{attach,cgroup,clone,console,create,destroy,device,execute,freeze,info,monitor,snapshot,start-ephemeral,stop,unfreeze,wait}
139
140         if use python; then
141                 pushd "${S}/src/python-lxc" > /dev/null
142                 # Unset DOCS. This has been handled by the default target
143                 unset DOCS
144                 distutils-r1_src_install
145                 popd > /dev/null
146         fi
147
148         keepdir /etc/lxc /usr/lib/lxc/rootfs /var/log/lxc
149
150         find "${D}" -name '*.la' -delete
151
152         # Gentoo-specific additions!
153         # Use initd.3 per #517144
154         newinitd "${FILESDIR}/${PN}.initd.3" ${PN}
155
156         # lxc-devsetup script
157         exeinto /usr/libexec/${PN}
158         doexe config/init/systemd/${PN}-devsetup
159         # Use that script with the systemd service (Similar to upstream
160         # Makefile.am
161         cp "${FILESDIR}"/${PN}_at.service ${PN}_at.service || die
162         sed -i \
163                 "/Restart=always/a ExecStartPre=/usr/libexec/${PN}/${PN}-devsetup" \
164                 ${PN}_at.service \
165                 || die "Failed to add ${PN}-devsetup to the systemd service file"
166         systemd_newunit ${PN}_at.service "lxc@.service"
167 }
168
169 pkg_postinst() {
170         elog "There is an init script provided with the package now; no documentation"
171         elog "is currently available though, so please check out /etc/init.d/lxc ."
172         elog "You _should_ only need to symlink it to /etc/init.d/lxc.configname"
173         elog "to start the container defined into /etc/lxc/configname.conf ."
174         elog "For further information about LXC development see"
175         elog "http://blog.flameeyes.eu/tag/lxc" # remove once proper doc is available
176         elog ""
177         ewarn "With version 0.7.4, the mountpoint syntax came back to the one used by 0.7.2"
178         ewarn "and previous versions. This means you'll have to use syntax like the following"
179         ewarn ""
180         ewarn "    lxc.rootfs = /container"
181         ewarn "    lxc.mount.entry = /usr/portage /container/usr/portage none bind 0 0"
182         ewarn ""
183         ewarn "To use the Fedora, Debian and (various) Ubuntu auto-configuration scripts, you"
184         ewarn "will need sys-apps/yum or dev-util/debootstrap."
185         ewarn ""
186         ewarn "Some GrSecurity settings in relation to chroot security will cause LXC not to"
187         ewarn "work, while others will actually make it much more secure. Please refer to"
188         ewarn "Diego Elio Pettenò's weblog at http://blog.flameeyes.eu/tag/lxc for further"
189         ewarn "details."
190 }