unos-repository

APK repository for unos
git clone git://git.finwo.net/misc/unos-repository
Log | Files | Refs | README

template (3282B)


      1 # Template file for 'busybox'
      2 pkgname=busybox
      3 version=1.36.1
      4 revision=9
      5 short_desc="Swiss Army knife of embedded Linux utilities"
      6 maintainer="finwo <finwo@pm.me>"
      7 license="GPL-2.0-only"
      8 homepage="https://busybox.net"
      9 distfiles="https://busybox.net/downloads/busybox-1.36.1.tar.bz2"
     10 checksum=b8cc24c9574d809e7279c3be349795c5d5ceb6fdf19ca709f80cde50e47de314
     11 depends=
     12 
     13 # Applet policy, asserted in do_build. No checked-in .config: defconfig +
     14 # CFG_* is the source of truth, and this kconfig has no savedefconfig.
     15 #
     16 # OFF, by owner of the path:
     17 #   IP/TC          iproute2. busybox tc needs kernel-removed CBQ UAPI.
     18 #   LDCONFIG       glibc. Its cache must never feed glibc's loader.
     19 #   xz family      xz owns usr/bin/{xz,xzcat,unxz,lzma,unlzma,lzcat}; apk
     20 #                  refuses the overwrite. Kernel initramfs xz is CONFIG_RD_XZ.
     21 #   IFUP/IFDOWN    linkd. Its parser rejects cumulus `iface <name>`.
     22 #   MKFS_VFAT      dosfstools, which also brings the fsck.fat busybox lacks.
     23 #                  busybox's warns about iconv data our C.UTF-8 glibc lacks.
     24 #   UDHCPD         dnsmasq.
     25 #   HTTPD/INETD    tcpsvd.
     26 # SYSLOGD/KLOGD left at defconfig until their design lands.
     27 CFG_ON="INIT HALT POWEROFF REBOOT GETTY LOGIN MOUNT UMOUNT SWITCH_ROOT ASH ASH_JOB_CONTROL RUNSV RUNSVDIR SV SVLOGD CHPST SETUIDGID TCPSVD UDHCPC"
     28 CFG_OFF="IP FEATURE_IP_ADDRESS FEATURE_IP_LINK FEATURE_IP_ROUTE FEATURE_IP_RULE FEATURE_IP_TUNNEL TC LDCONFIG UNLZMA LZCAT LZMA UNXZ XZCAT XZ UDHCPD HTTPD INETD IFUP IFDOWN MKFS_VFAT MKDOSFS"
     29 
     30 # applet names as `busybox --list` prints them
     31 REQUIRE="init halt poweroff reboot getty login mount umount switch_root ash runsv runsvdir sv svlogd chpst setuidgid tcpsvd udhcpc"
     32 FORBID="ip tc ldconfig unlzma lzcat lzma unxz xzcat xz udhcpd httpd inetd ifup ifdown mkfs.vfat mkdosfs"
     33 
     34 set_config() {
     35   # $1 = symbol, $2 = y|n
     36   if grep -q "^CONFIG_$1=" .config 2>/dev/null || grep -q "^# CONFIG_$1 is not set$" .config 2>/dev/null; then
     37     sed -i -e "s/^# CONFIG_$1 is not set\$/CONFIG_$1=$2/" -e "s/^CONFIG_$1=.*\$/CONFIG_$1=$2/" .config
     38   else
     39     [ "$2" = y ] && echo "CONFIG_$1=y" >> .config || echo "# CONFIG_$1 is not set" >> .config
     40   fi
     41 }
     42 
     43 do_configure() {
     44   cd "${WRKSRC}"
     45   make defconfig >/dev/null
     46   for c in ${CFG_ON}; do set_config "${c}" y; done
     47   for c in ${CFG_OFF}; do set_config "${c}" n; done
     48   # No olddefconfig in this kconfig.
     49   yes "" | make oldconfig >/dev/null
     50   for c in ${CFG_ON}; do
     51     grep -q "^CONFIG_${c}=y$" .config || die "busybox: CONFIG_${c} did not stick"
     52   done
     53 }
     54 
     55 do_build() {
     56   cd "${WRKSRC}"
     57   make -j"$(nproc)"
     58   have=$(./busybox --list)
     59   for a in ${REQUIRE}; do
     60     printf '%s\n' "${have}" | grep -qx "${a}" || die "busybox: required applet missing: ${a}"
     61   done
     62   for a in ${FORBID}; do
     63     printf '%s\n' "${have}" | grep -qx "${a}" && die "busybox: forbidden applet present: ${a}" || true
     64   done
     65 }
     66 
     67 do_install() {
     68   cd "${WRKSRC}"
     69   make CONFIG_PREFIX="${DESTDIR}" install
     70   # Dead symlink here: /linuxrc runs only on classic initrd, we boot /init.
     71   rm -f "${DESTDIR}/linuxrc"
     72 
     73   # udhcpc's compiled-in default path. Absent, a lease is obtained and nothing
     74   # is configured.
     75   vinstall examples/udhcp/simple.script 755 usr/share/udhcpc default.script
     76   vinstall "${FILESDIR}/linkd-udhcpc.cnf" 644 etc/linkd udhcpc.cnf
     77 }