/[gentoo-x86]/sys-apps/busybox/busybox-1.21.1.ebuild
Gentoo

Contents of /sys-apps/busybox/busybox-1.21.1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Sun Sep 29 00:55:52 2013 UTC (4 years, 3 months ago) by vapier
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +2 -2 lines
Fix static linking against selinux #484560 by thaehaid.

(Portage version: 2.2.0/cvs/Linux x86_64, signed Manifest commit with key FB7C4156)

1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sys-apps/busybox/busybox-1.21.1.ebuild,v 1.1 2013/08/17 17:55:02 vapier Exp $
4
5 # See `man savedconfig.eclass` for info on how to use USE=savedconfig.
6
7 EAPI="4"
8 inherit eutils flag-o-matic savedconfig toolchain-funcs multilib
9
10 DESCRIPTION="Utilities for rescue and embedded systems"
11 HOMEPAGE="http://www.busybox.net/"
12 if [[ ${PV} == "9999" ]] ; then
13 MY_P=${PN}
14 EGIT_REPO_URI="git://busybox.net/busybox.git"
15 inherit git-2
16 else
17 MY_P=${PN}-${PV/_/-}
18 SRC_URI="http://www.busybox.net/downloads/${MY_P}.tar.bz2"
19 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~arm-linux ~x86-linux"
20 fi
21
22 LICENSE="GPL-2"
23 SLOT="0"
24
25 IUSE="ipv6 livecd make-symlinks math mdev -pam selinux sep-usr +static syslog systemd"
26 RESTRICT="test"
27
28 RDEPEND="!static? ( selinux? ( sys-libs/libselinux ) )
29 pam? ( sys-libs/pam )"
30 DEPEND="${RDEPEND}
31 static? ( selinux? ( sys-libs/libselinux[static-libs(+)] ) )
32 >=sys-kernel/linux-headers-2.6.39"
33
34 S=${WORKDIR}/${MY_P}
35
36 busybox_config_option() {
37 local flag=$1 ; shift
38 if [[ ${flag} != [yn] ]] ; then
39 busybox_config_option $(usex ${flag} y n) "$@"
40 return
41 fi
42 while [[ $# -gt 0 ]] ; do
43 if [[ ${flag} == "y" ]] ; then
44 sed -i -e "s:.*\<CONFIG_$1\>.*set:CONFIG_$1=y:g" .config
45 else
46 sed -i -e "s:CONFIG_$1=y:# CONFIG_$1 is not set:g" .config
47 fi
48 einfo $(grep "CONFIG_$1[= ]" .config || echo Could not find CONFIG_$1 ...)
49 shift
50 done
51 }
52
53 busybox_config_enabled() {
54 local val=$(sed -n "/^CONFIG_$1=/s:^[^=]*=::p" .config)
55 case ${val} in
56 "") return 1 ;;
57 y) return 0 ;;
58 *) echo "${val}" | sed -r 's:^"(.*)"$:\1:' ;;
59 esac
60 }
61
62 src_prepare() {
63 unset KBUILD_OUTPUT #88088
64 append-flags -fno-strict-aliasing #310413
65 use ppc64 && append-flags -mminimal-toc #130943
66
67 # patches go here!
68 epatch "${FILESDIR}"/${PN}-1.19.0-bb.patch
69 epatch "${FILESDIR}"/${P}-*.patch
70 cp "${FILESDIR}"/ginit.c init/ || die
71
72 # flag cleanup
73 sed -i -r \
74 -e 's:[[:space:]]?-(Werror|Os|falign-(functions|jumps|loops|labels)=1|fomit-frame-pointer)\>::g' \
75 Makefile.flags || die
76 #sed -i '/bbsh/s:^//::' include/applets.h
77 sed -i '/^#error Aborting compilation./d' applets/applets.c || die
78 use elibc_glibc && sed -i 's:-Wl,--gc-sections::' Makefile
79 sed -i \
80 -e "/^CROSS_COMPILE/s:=.*:= ${CHOST}-:" \
81 -e "/^AR\>/s:=.*:= $(tc-getAR):" \
82 -e "/^CC\>/s:=.*:= $(tc-getCC):" \
83 -e "/^HOSTCC/s:=.*:= $(tc-getBUILD_CC):" \
84 -e "/^PKG_CONFIG\>/s:=.*:= $(tc-getPKG_CONFIG):" \
85 Makefile || die
86 sed -i \
87 -e 's:-static-libgcc::' \
88 Makefile.flags || die
89 }
90
91 src_configure() {
92 # check for a busybox config before making one of our own.
93 # if one exist lets return and use it.
94
95 restore_config .config
96 if [ -f .config ]; then
97 yes "" | emake -j1 oldconfig > /dev/null
98 return 0
99 else
100 ewarn "Could not locate user configfile, so we will save a default one"
101 fi
102
103 # setup the config file
104 emake -j1 allyesconfig > /dev/null
105 # nommu forces a bunch of things off which we want on #387555
106 busybox_config_option n NOMMU
107 sed -i '/^#/d' .config
108 yes "" | emake -j1 oldconfig >/dev/null
109
110 # now turn off stuff we really don't want
111 busybox_config_option n DMALLOC
112 busybox_config_option n FEATURE_SUID_CONFIG
113 busybox_config_option n BUILD_AT_ONCE
114 busybox_config_option n BUILD_LIBBUSYBOX
115 busybox_config_option n FEATURE_CLEAN_UP
116 busybox_config_option n MONOTONIC_SYSCALL
117 busybox_config_option n USE_PORTABLE_CODE
118 busybox_config_option n WERROR
119
120 # If these are not set and we are using a uclibc/busybox setup
121 # all calls to system() will fail.
122 busybox_config_option y ASH
123 busybox_config_option n HUSH
124
125 # disable ipv6 applets
126 if ! use ipv6; then
127 busybox_config_option n FEATURE_IPV6
128 busybox_config_option n TRACEROUTE6
129 busybox_config_option n PING6
130 fi
131
132 if use static && use pam ; then
133 ewarn "You cannot have USE='static pam'. Assuming static is more important."
134 fi
135 busybox_config_option $(usex static n pam) PAM
136 busybox_config_option static STATIC
137 busybox_config_option syslog {K,SYS}LOGD LOGGER
138 busybox_config_option systemd FEATURE_SYSTEMD
139 busybox_config_option math FEATURE_AWK_LIBM
140
141 # all the debug options are compiler related, so punt them
142 busybox_config_option n DEBUG
143 busybox_config_option y NO_DEBUG_LIB
144 busybox_config_option n DMALLOC
145 busybox_config_option n EFENCE
146
147 busybox_config_option selinux SELINUX
148
149 # this opt only controls mounting with <linux-2.6.23
150 busybox_config_option n FEATURE_MOUNT_NFS
151
152 # default a bunch of uncommon options to off
153 local opt
154 for opt in \
155 ADD_SHELL \
156 BEEP BOOTCHARTD \
157 CRONTAB \
158 DC DEVFSD DNSD DPKG{,_DEB} \
159 FAKEIDENTD FBSPLASH FOLD FSCK_MINIX FTP{GET,PUT} \
160 FEATURE_DEVFS \
161 HOSTID HUSH \
162 INETD INOTIFYD IPCALC \
163 LOCALE_SUPPORT LOGNAME LPD \
164 MAKEMIME MKFS_MINIX MSH \
165 OD \
166 RDEV READPROFILE REFORMIME REMOVE_SHELL RFKILL RUN_PARTS RUNSV{,DIR} \
167 SLATTACH SMEMCAP SULOGIN SV{,LOGD} \
168 TASKSET TCPSVD \
169 RPM RPM2CPIO \
170 UDPSVD UUDECODE UUENCODE
171 do
172 busybox_config_option n ${opt}
173 done
174
175 emake -j1 oldconfig > /dev/null
176 }
177
178 src_compile() {
179 unset KBUILD_OUTPUT #88088
180 export SKIP_STRIP=y
181
182 emake V=1 busybox
183 }
184
185 src_install() {
186 unset KBUILD_OUTPUT #88088
187 save_config .config
188
189 into /
190 dodir /bin
191 if use sep-usr ; then
192 # install /ginit to take care of mounting stuff
193 exeinto /
194 newexe busybox_unstripped ginit
195 dosym /ginit /bin/bb
196 dosym bb /bin/busybox
197 else
198 newbin busybox_unstripped busybox
199 dosym busybox /bin/bb
200 fi
201 if use mdev ; then
202 dodir /$(get_libdir)/mdev/
203 use make-symlinks || dosym /bin/bb /sbin/mdev
204 cp "${S}"/examples/mdev_fat.conf "${ED}"/etc/mdev.conf
205
206 exeinto /$(get_libdir)/mdev/
207 doexe "${FILESDIR}"/mdev/*
208
209 newinitd "${FILESDIR}"/mdev.rc.1 mdev
210 fi
211 if use livecd ; then
212 dosym busybox /bin/vi
213 fi
214
215 # add busybox daemon's, bug #444718
216 if busybox_config_enabled FEATURE_NTPD_SERVER; then
217 newconfd "${FILESDIR}/ntpd.confd" "busybox-ntpd"
218 newinitd "${FILESDIR}/ntpd.initd" "busybox-ntpd"
219 fi
220 if busybox_config_enabled SYSLOGD; then
221 newconfd "${FILESDIR}/syslogd.confd" "busybox-syslogd"
222 newinitd "${FILESDIR}/syslogd.initd" "busybox-syslogd"
223 fi
224 if busybox_config_enabled KLOGD; then
225 newconfd "${FILESDIR}/klogd.confd" "busybox-klogd"
226 newinitd "${FILESDIR}/klogd.initd" "busybox-klogd"
227 fi
228 if busybox_config_enabled WATCHDOG; then
229 newconfd "${FILESDIR}/watchdog.confd" "busybox-watchdog"
230 newinitd "${FILESDIR}/watchdog.initd" "busybox-watchdog"
231 fi
232 if busybox_config_enabled UDHCPC; then
233 local path=$(busybox_config_enabled UDHCPC_DEFAULT_SCRIPT)
234 exeinto "${path%/*}"
235 newexe examples/udhcp/simple.script "${path##*/}"
236 fi
237 if busybox_config_enabled UDHCPD; then
238 insinto /etc
239 doins examples/udhcp/udhcpd.conf
240 fi
241
242 # bundle up the symlink files for use later
243 emake DESTDIR="${ED}" install
244 rm _install/bin/busybox
245 # for compatibility, provide /usr/bin/env
246 mkdir -p _install/usr/bin
247 ln -s /bin/env _install/usr/bin/env
248 tar cf busybox-links.tar -C _install . || : #;die
249 insinto /usr/share/${PN}
250 use make-symlinks && doins busybox-links.tar
251
252 dodoc AUTHORS README TODO
253
254 cd docs
255 docinto txt
256 dodoc *.txt
257 docinto pod
258 dodoc *.pod
259 dohtml *.html
260
261 cd ../examples
262 docinto examples
263 dodoc inittab depmod.pl *.conf *.script undeb unrpm
264 }
265
266 pkg_preinst() {
267 if use make-symlinks && [[ ! ${VERY_BRAVE_OR_VERY_DUMB} == "yes" ]] && [[ ${ROOT} == "/" ]] ; then
268 ewarn "setting USE=make-symlinks and emerging to / is very dangerous."
269 ewarn "it WILL overwrite lots of system programs like: ls bash awk grep (bug 60805 for full list)."
270 ewarn "If you are creating a binary only and not merging this is probably ok."
271 ewarn "set env VERY_BRAVE_OR_VERY_DUMB=yes if this is really what you want."
272 die "silly options will destroy your system"
273 fi
274
275 if use make-symlinks ; then
276 mv "${ED}"/usr/share/${PN}/busybox-links.tar "${T}"/ || die
277 fi
278 }
279
280 pkg_postinst() {
281 savedconfig_pkg_postinst
282
283 if use make-symlinks ; then
284 cd "${T}" || die
285 mkdir _install
286 tar xf busybox-links.tar -C _install || die
287 cp -vpPR _install/* "${ROOT}"/ || die "copying links for ${x} failed"
288 fi
289
290 if use sep-usr ; then
291 elog "In order to use the sep-usr support, you have to update your"
292 elog "kernel command line. Add the option:"
293 elog " init=/ginit"
294 elog "To launch a different init than /sbin/init, use:"
295 elog " init=/ginit /sbin/yourinit"
296 elog "To get a rescue shell, you may boot with:"
297 elog " init=/ginit bb"
298 fi
299 }

  ViewVC Help
Powered by ViewVC 1.1.20