summaryrefslogtreecommitdiffstats
path: root/core/modules/busybox/module.build
blob: 608f9ecb0347c97e3096098d321f9623244c899e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash

fetch_source() {
	autoclone
	cde src/busybox
	# Needed for newer glibc
	if ! grep -q 'OPT_SET.*clock_settime.*CLOCK_REALTIME' "coreutils/date.c"; then
		git apply "${MODULE_DIR}/1_31_1-stime.patch" || perror "Could not apply stime patch for 1.31.1"
	fi
	# Hack for backwards compat to old busybox which required -t (timeout -t [SECS] [PROG...])
	if ! grep -q 'getopt32.*"t"' "coreutils/timeout.c"; then
		git apply "${MODULE_DIR}/timeout-compat.patch" || perror "Could not apply timeout backwards compat patch"
	fi
	# Patch background filling if not patched yet
	if ! grep -q "bfill_background" "miscutils/fbsplash.c"; then
		git apply "${MODULE_DIR}/fbsplash-fillbg.patch" || perror "Could not apply busybox patch for fbsplash background filling"
	fi
	# Add support for just manipulating alarm, without any standby/hibernation
	if ! grep -q 'suspend.*"no"' "util-linux/rtcwake.c"; then
		git apply "${MODULE_DIR}/rtcwake-compat.patch" || perror "Could not apply busybox patch for rtcwake compat with util-linux"
	fi
	# make sure Makefile allows a preset CC
	if [ -n "$CC" ]; then
		sed -i -r 's/^CC\s*=\s*(\S)/CC ?= \1/' Makefile || perror "Could not patch Makefile"
	fi
}

build() {
	cp "${MODULE_DIR}/openslx-busybox-config" "src/busybox/.config" || perror "Cannot cp .config"
	cde src/busybox
	yes '' | make oldconfig
	pinfo "Running make (if this hangs, check for unset options, ie. when you increased the REQUIRED_BRANCH)"
	make || perror "failed."
	pinfo "Running make install"
	local INSTALL_PREFIX="${MODULE_BUILD_DIR}"
	make CONFIG_PREFIX="${INSTALL_PREFIX}" install || perror "failed"
	rm -f "${INSTALL_PREFIX}/bin/mount" "${INSTALL_PREFIX}/bin/umount" "${INSTALL_PREFIX}/bin/bash"
}

post_copy() {
	:
}