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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (show annotations) (download)
Fri Nov 2 18:59:14 2012 UTC (6 months, 2 weeks ago) by vapier
Branch: MAIN
CVS Tags: HEAD
Changes since 1.11: +8 -29 lines
Make USE=static the default to reflect what we have always been doing (building /bin/bb statically), and depend on libselinux[static-libs] as need be #436752 by Alphat-PC.

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

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

  ViewVC Help
Powered by ViewVC 1.1.13