1 |
commit: 94d39f17df96ae1796d782bda741e28c77cb9027 |
2 |
Author: Viorel Munteanu <ceamac.paragon <AT> gmail <DOT> com> |
3 |
AuthorDate: Sun Apr 17 06:46:52 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jun 30 21:40:14 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=94d39f17 |
7 |
|
8 |
sys-apps/busybox: Fix mdev configuration on amd64 |
9 |
|
10 |
Closes: https://bugs.gentoo.org/831251 |
11 |
Signed-off-by: Viorel Munteanu <ceamac.paragon <AT> gmail.com> |
12 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
13 |
|
14 |
sys-apps/busybox/busybox-1.34.1-r1.ebuild | 348 ++++++++++++++++++++++++++++++ |
15 |
1 file changed, 348 insertions(+) |
16 |
|
17 |
diff --git a/sys-apps/busybox/busybox-1.34.1-r1.ebuild b/sys-apps/busybox/busybox-1.34.1-r1.ebuild |
18 |
new file mode 100644 |
19 |
index 000000000000..05305df1dbc6 |
20 |
--- /dev/null |
21 |
+++ b/sys-apps/busybox/busybox-1.34.1-r1.ebuild |
22 |
@@ -0,0 +1,348 @@ |
23 |
+# Copyright 1999-2022 Gentoo Authors |
24 |
+# Distributed under the terms of the GNU General Public License v2 |
25 |
+ |
26 |
+# See `man savedconfig.eclass` for info on how to use USE=savedconfig. |
27 |
+ |
28 |
+EAPI=7 |
29 |
+ |
30 |
+inherit flag-o-matic savedconfig toolchain-funcs |
31 |
+ |
32 |
+DESCRIPTION="Utilities for rescue and embedded systems" |
33 |
+HOMEPAGE="https://www.busybox.net/" |
34 |
+if [[ ${PV} == "9999" ]] ; then |
35 |
+ MY_P="${P}" |
36 |
+ EGIT_REPO_URI="https://git.busybox.net/busybox" |
37 |
+ inherit git-r3 |
38 |
+else |
39 |
+ MY_P="${PN}-${PV/_/-}" |
40 |
+ SRC_URI="https://www.busybox.net/downloads/${MY_P}.tar.bz2" |
41 |
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux" |
42 |
+fi |
43 |
+ |
44 |
+LICENSE="GPL-2" # GPL-2 only |
45 |
+SLOT="0" |
46 |
+IUSE="debug ipv6 livecd make-symlinks math mdev pam selinux sep-usr static syslog systemd" |
47 |
+REQUIRED_USE="pam? ( !static )" |
48 |
+RESTRICT="test" |
49 |
+ |
50 |
+# TODO: Could make pkgconfig conditional on selinux? bug #782829 |
51 |
+RDEPEND=" |
52 |
+ virtual/libcrypt:= |
53 |
+ !static? ( selinux? ( sys-libs/libselinux ) ) |
54 |
+ pam? ( sys-libs/pam ) |
55 |
+" |
56 |
+DEPEND="${RDEPEND} |
57 |
+ static? ( |
58 |
+ virtual/libcrypt[static-libs] |
59 |
+ selinux? ( sys-libs/libselinux[static-libs(+)] ) |
60 |
+ ) |
61 |
+ sys-kernel/linux-headers" |
62 |
+BDEPEND="virtual/pkgconfig" |
63 |
+ |
64 |
+S="${WORKDIR}/${MY_P}" |
65 |
+ |
66 |
+busybox_config_option() { |
67 |
+ local flag=$1 ; shift |
68 |
+ if [[ ${flag} != [yn] && ${flag} != \"* ]] ; then |
69 |
+ busybox_config_option $(usex ${flag} y n) "$@" |
70 |
+ return |
71 |
+ fi |
72 |
+ local expr |
73 |
+ while [[ $# -gt 0 ]] ; do |
74 |
+ case ${flag} in |
75 |
+ y) expr="s:.*\<CONFIG_$1\>.*set:CONFIG_$1=y:g" ;; |
76 |
+ n) expr="s:CONFIG_$1=y:# CONFIG_$1 is not set:g" ;; |
77 |
+ *) expr="s:.*\<CONFIG_$1\>.*:CONFIG_$1=${flag}:g" ;; |
78 |
+ esac |
79 |
+ sed -i -e "${expr}" .config || die |
80 |
+ einfo "$(grep "CONFIG_$1[= ]" .config || echo "Could not find CONFIG_$1 ...")" |
81 |
+ shift |
82 |
+ done |
83 |
+} |
84 |
+ |
85 |
+busybox_config_enabled() { |
86 |
+ local val=$(sed -n "/^CONFIG_$1=/s:^[^=]*=::p" .config) |
87 |
+ case ${val} in |
88 |
+ "") return 1 ;; |
89 |
+ y) return 0 ;; |
90 |
+ *) echo "${val}" | sed -r 's:^"(.*)"$:\1:' ;; |
91 |
+ esac |
92 |
+} |
93 |
+ |
94 |
+# patches go here! |
95 |
+PATCHES=( |
96 |
+ "${FILESDIR}"/${PN}-1.26.2-bb.patch |
97 |
+ # "${FILESDIR}"/${P}-*.patch |
98 |
+) |
99 |
+ |
100 |
+src_prepare() { |
101 |
+ default |
102 |
+ unset KBUILD_OUTPUT #88088 |
103 |
+ append-flags -fno-strict-aliasing #310413 |
104 |
+ use ppc64 && append-flags -mminimal-toc #130943 |
105 |
+ |
106 |
+ cp "${FILESDIR}"/ginit.c init/ || die |
107 |
+ |
108 |
+ # flag cleanup |
109 |
+ sed -i -r \ |
110 |
+ -e 's:[[:space:]]?-(Werror|Os|falign-(functions|jumps|loops|labels)=1|fomit-frame-pointer)\>::g' \ |
111 |
+ Makefile.flags || die |
112 |
+ #sed -i '/bbsh/s:^//::' include/applets.h |
113 |
+ sed -i '/^#error Aborting compilation./d' applets/applets.c || die |
114 |
+ use elibc_glibc && sed -i 's:-Wl,--gc-sections::' Makefile |
115 |
+ sed -i \ |
116 |
+ -e "/^CROSS_COMPILE/s:=.*:= ${CHOST}-:" \ |
117 |
+ -e "/^AR\>/s:=.*:= $(tc-getAR):" \ |
118 |
+ -e "/^CC\>/s:=.*:= $(tc-getCC):" \ |
119 |
+ -e "/^HOSTCC/s:=.*:= $(tc-getBUILD_CC):" \ |
120 |
+ -e "/^PKG_CONFIG\>/s:=.*:= $(tc-getPKG_CONFIG):" \ |
121 |
+ Makefile || die |
122 |
+ sed -i \ |
123 |
+ -e 's:-static-libgcc::' \ |
124 |
+ Makefile.flags || die |
125 |
+} |
126 |
+ |
127 |
+src_configure() { |
128 |
+ # check for a busybox config before making one of our own. |
129 |
+ # if one exist lets return and use it. |
130 |
+ |
131 |
+ restore_config .config |
132 |
+ if [ -f .config ]; then |
133 |
+ yes "" | emake -j1 -s oldconfig >/dev/null |
134 |
+ return 0 |
135 |
+ else |
136 |
+ ewarn "Could not locate user configfile, so we will save a default one" |
137 |
+ fi |
138 |
+ |
139 |
+ # setup the config file |
140 |
+ emake -j1 -s allyesconfig >/dev/null |
141 |
+ # nommu forces a bunch of things off which we want on #387555 |
142 |
+ busybox_config_option n NOMMU |
143 |
+ sed -i '/^#/d' .config |
144 |
+ yes "" | emake -j1 -s oldconfig >/dev/null |
145 |
+ |
146 |
+ # now turn off stuff we really don't want |
147 |
+ busybox_config_option n DMALLOC |
148 |
+ busybox_config_option n FEATURE_2_4_MODULES #607548 |
149 |
+ busybox_config_option n FEATURE_SUID_CONFIG |
150 |
+ busybox_config_option n BUILD_AT_ONCE |
151 |
+ busybox_config_option n BUILD_LIBBUSYBOX |
152 |
+ busybox_config_option n FEATURE_CLEAN_UP |
153 |
+ busybox_config_option n MONOTONIC_SYSCALL |
154 |
+ busybox_config_option n USE_PORTABLE_CODE |
155 |
+ busybox_config_option n WERROR |
156 |
+ # triming the BSS size may be dangerous |
157 |
+ busybox_config_option n FEATURE_USE_BSS_TAIL |
158 |
+ |
159 |
+ # These cause trouble with musl. |
160 |
+ if use elibc_musl; then |
161 |
+ busybox_config_option n FEATURE_UTMP |
162 |
+ busybox_config_option n EXTRA_COMPAT |
163 |
+ busybox_config_option n FEATURE_VI_REGEX_SEARCH |
164 |
+ fi |
165 |
+ |
166 |
+ # Disable standalone shell mode when using make-symlinks, else Busybox calls its |
167 |
+ # applets by default without looking up in PATH. |
168 |
+ # This also enables users to disable a builtin by deleting the corresponding symlink. |
169 |
+ if use make-symlinks; then |
170 |
+ busybox_config_option n FEATURE_PREFER_APPLETS |
171 |
+ busybox_config_option n FEATURE_SH_STANDALONE |
172 |
+ fi |
173 |
+ |
174 |
+ # If these are not set and we are using a busybox setup |
175 |
+ # all calls to system() will fail. |
176 |
+ busybox_config_option y ASH |
177 |
+ busybox_config_option y SH_IS_ASH |
178 |
+ busybox_config_option n HUSH |
179 |
+ busybox_config_option n SH_IS_HUSH |
180 |
+ |
181 |
+ busybox_config_option '"/run"' PID_FILE_PATH |
182 |
+ busybox_config_option '"/run/ifstate"' IFUPDOWN_IFSTATE_PATH |
183 |
+ |
184 |
+ # disable ipv6 applets |
185 |
+ if ! use ipv6; then |
186 |
+ busybox_config_option n FEATURE_IPV6 |
187 |
+ busybox_config_option n TRACEROUTE6 |
188 |
+ busybox_config_option n PING6 |
189 |
+ busybox_config_option n UDHCPC6 |
190 |
+ fi |
191 |
+ |
192 |
+ busybox_config_option pam PAM |
193 |
+ busybox_config_option static STATIC |
194 |
+ busybox_config_option syslog {K,SYS}LOGD LOGGER |
195 |
+ busybox_config_option systemd FEATURE_SYSTEMD |
196 |
+ busybox_config_option math FEATURE_AWK_LIBM |
197 |
+ |
198 |
+ # all the debug options are compiler related, so punt them |
199 |
+ busybox_config_option n DEBUG_SANITIZE |
200 |
+ busybox_config_option n DEBUG |
201 |
+ busybox_config_option y NO_DEBUG_LIB |
202 |
+ busybox_config_option n DMALLOC |
203 |
+ busybox_config_option n EFENCE |
204 |
+ busybox_config_option $(usex debug y n) TFTP_DEBUG |
205 |
+ |
206 |
+ busybox_config_option selinux SELINUX |
207 |
+ |
208 |
+ # this opt only controls mounting with <linux-2.6.23 |
209 |
+ busybox_config_option n FEATURE_MOUNT_NFS |
210 |
+ |
211 |
+ # glibc-2.26 and later does not ship RPC implientation |
212 |
+ busybox_config_option n FEATURE_HAVE_RPC |
213 |
+ busybox_config_option n FEATURE_INETD_RPC |
214 |
+ |
215 |
+ # default a bunch of uncommon options to off |
216 |
+ local opt |
217 |
+ for opt in \ |
218 |
+ ADD_SHELL \ |
219 |
+ BEEP BOOTCHARTD \ |
220 |
+ CRONTAB \ |
221 |
+ DC DEVFSD DNSD DPKG{,_DEB} \ |
222 |
+ FAKEIDENTD FBSPLASH FOLD FSCK_MINIX FTP{GET,PUT} \ |
223 |
+ FEATURE_DEVFS \ |
224 |
+ HOSTID HUSH \ |
225 |
+ INETD INOTIFYD IPCALC \ |
226 |
+ LOCALE_SUPPORT LOGNAME LPD \ |
227 |
+ MAKEMIME MKFS_MINIX MSH \ |
228 |
+ OD \ |
229 |
+ RDEV READPROFILE REFORMIME REMOVE_SHELL RFKILL RUN_PARTS RUNSV{,DIR} \ |
230 |
+ SLATTACH SMEMCAP SULOGIN SV{,LOGD} \ |
231 |
+ TASKSET TCPSVD \ |
232 |
+ RPM RPM2CPIO \ |
233 |
+ UDPSVD UUDECODE UUENCODE |
234 |
+ do |
235 |
+ busybox_config_option n ${opt} |
236 |
+ done |
237 |
+ |
238 |
+ emake -j1 oldconfig > /dev/null |
239 |
+} |
240 |
+ |
241 |
+src_compile() { |
242 |
+ unset KBUILD_OUTPUT #88088 |
243 |
+ export SKIP_STRIP=y |
244 |
+ |
245 |
+ emake V=1 busybox |
246 |
+ |
247 |
+ # bug #701512 |
248 |
+ emake V=1 doc |
249 |
+} |
250 |
+ |
251 |
+src_install() { |
252 |
+ unset KBUILD_OUTPUT #88088 |
253 |
+ save_config .config |
254 |
+ |
255 |
+ into / |
256 |
+ dodir /bin |
257 |
+ if use sep-usr ; then |
258 |
+ # install /ginit to take care of mounting stuff |
259 |
+ exeinto / |
260 |
+ newexe busybox_unstripped ginit |
261 |
+ dosym /ginit /bin/bb |
262 |
+ dosym bb /bin/busybox |
263 |
+ else |
264 |
+ newbin busybox_unstripped busybox |
265 |
+ dosym busybox /bin/bb |
266 |
+ fi |
267 |
+ if use mdev ; then |
268 |
+ dodir /$(get_libdir)/mdev/ |
269 |
+ use make-symlinks || dosym /bin/bb /sbin/mdev |
270 |
+ cp "${S}"/examples/mdev_fat.conf "${ED}"/etc/mdev.conf || die |
271 |
+ if [[ ! "$(get_libdir)" == "lib" ]]; then |
272 |
+ sed -i -e "s:/lib/:/$(get_libdir)/:g" "${ED}"/etc/mdev.conf || die #831251 - replace lib with lib64 where appropriate |
273 |
+ fi |
274 |
+ |
275 |
+ exeinto /$(get_libdir)/mdev/ |
276 |
+ doexe "${FILESDIR}"/mdev/* |
277 |
+ |
278 |
+ newinitd "${FILESDIR}"/mdev.initd mdev |
279 |
+ fi |
280 |
+ if use livecd ; then |
281 |
+ dosym busybox /bin/vi |
282 |
+ fi |
283 |
+ |
284 |
+ # add busybox daemon's, bug #444718 |
285 |
+ if busybox_config_enabled FEATURE_NTPD_SERVER; then |
286 |
+ newconfd "${FILESDIR}"/ntpd.confd busybox-ntpd |
287 |
+ newinitd "${FILESDIR}"/ntpd.initd busybox-ntpd |
288 |
+ fi |
289 |
+ if busybox_config_enabled SYSLOGD; then |
290 |
+ newconfd "${FILESDIR}"/syslogd.confd busybox-syslogd |
291 |
+ newinitd "${FILESDIR}"/syslogd.initd busybox-syslogd |
292 |
+ fi |
293 |
+ if busybox_config_enabled KLOGD; then |
294 |
+ newconfd "${FILESDIR}"/klogd.confd busybox-klogd |
295 |
+ newinitd "${FILESDIR}"/klogd.initd busybox-klogd |
296 |
+ fi |
297 |
+ if busybox_config_enabled WATCHDOG; then |
298 |
+ newconfd "${FILESDIR}"/watchdog.confd busybox-watchdog |
299 |
+ newinitd "${FILESDIR}"/watchdog.initd busybox-watchdog |
300 |
+ fi |
301 |
+ if busybox_config_enabled UDHCPC; then |
302 |
+ local path=$(busybox_config_enabled UDHCPC_DEFAULT_SCRIPT) |
303 |
+ exeinto "${path%/*}" |
304 |
+ newexe examples/udhcp/simple.script "${path##*/}" |
305 |
+ fi |
306 |
+ if busybox_config_enabled UDHCPD; then |
307 |
+ insinto /etc |
308 |
+ doins examples/udhcp/udhcpd.conf |
309 |
+ fi |
310 |
+ |
311 |
+ # bundle up the symlink files for use later |
312 |
+ emake DESTDIR="${ED}" install |
313 |
+ rm _install/bin/busybox || die |
314 |
+ # for compatibility, provide /usr/bin/env |
315 |
+ mkdir -p _install/usr/bin || die |
316 |
+ ln -s /bin/env _install/usr/bin/env || die |
317 |
+ tar cf busybox-links.tar -C _install . || : #;die |
318 |
+ insinto /usr/share/${PN} |
319 |
+ use make-symlinks && doins busybox-links.tar |
320 |
+ |
321 |
+ dodoc AUTHORS README TODO |
322 |
+ |
323 |
+ cd docs || die |
324 |
+ doman busybox.1 |
325 |
+ docinto txt |
326 |
+ dodoc *.txt |
327 |
+ docinto pod |
328 |
+ dodoc *.pod |
329 |
+ docinto html |
330 |
+ dodoc *.html |
331 |
+ |
332 |
+ cd ../examples || die |
333 |
+ docinto examples |
334 |
+ dodoc inittab depmod.pl *.conf *.script undeb unrpm |
335 |
+} |
336 |
+ |
337 |
+pkg_preinst() { |
338 |
+ if use make-symlinks && [[ ! ${VERY_BRAVE_OR_VERY_DUMB} == "yes" ]] && [[ -z "${ROOT}" ]] ; then |
339 |
+ ewarn "setting USE=make-symlinks and emerging to / is very dangerous." |
340 |
+ ewarn "it WILL overwrite lots of system programs like: ls bash awk grep (bug 60805 for full list)." |
341 |
+ ewarn "If you are creating a binary only and not merging this is probably ok." |
342 |
+ ewarn "set env VERY_BRAVE_OR_VERY_DUMB=yes if this is really what you want." |
343 |
+ die "silly options will destroy your system" |
344 |
+ fi |
345 |
+ |
346 |
+ if use make-symlinks ; then |
347 |
+ mv "${ED}"/usr/share/${PN}/busybox-links.tar "${T}"/ || die |
348 |
+ fi |
349 |
+} |
350 |
+ |
351 |
+pkg_postinst() { |
352 |
+ savedconfig_pkg_postinst |
353 |
+ |
354 |
+ if use make-symlinks ; then |
355 |
+ cd "${T}" || die |
356 |
+ mkdir _install |
357 |
+ tar xf busybox-links.tar -C _install || die |
358 |
+ echo n | cp -ivpPR _install/* "${ROOT}"/ || die "copying links for ${x} failed" |
359 |
+ fi |
360 |
+ |
361 |
+ if use sep-usr ; then |
362 |
+ elog "In order to use the sep-usr support, you have to update your" |
363 |
+ elog "kernel command line. Add the option:" |
364 |
+ elog " init=/ginit" |
365 |
+ elog "To launch a different init than /sbin/init, use:" |
366 |
+ elog " init=/ginit /sbin/yourinit" |
367 |
+ elog "To get a rescue shell, you may boot with:" |
368 |
+ elog " init=/ginit bb" |
369 |
+ fi |
370 |
+} |