123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- #!/bin/sh
- if [ $# -eq 0 ]
- then
- rm -rf build
- mkdir build
- make busybox.links include/bb_config.h $(pwd)/{libbb/libbb.a,archival/libunarchive/libunarchive.a,coreutils/libcoreutils/libcoreutils.a,networking/libiproute/libiproute.a}
- else
- test -d ./build || mkdir build
- fi
- function substithing()
- {
- if [ "${1/ $3 //}" != "$1" ]
- then
- echo $2
- fi
- }
- function extra_libraries()
- {
-
- substithing " gzip " "archival/gunzip.c archival/uncompress.c" "$1"
-
- substithing " init " "init/init_shared.c" "$1"
-
- substithing " ifconfig " "networking/interface.c" "$1"
-
- substithing " ar bunzip2 unlzma cpio dpkg gunzip rpm2cpio rpm tar uncompress unzip dpkg_deb gzip " "archival/libunarchive/libunarchive.a" "$1"
-
- substithing " cp mv " "coreutils/libcoreutils/libcoreutils.a" "$1"
-
- substithing " ip " "networking/libiproute/libiproute.a" "$1"
-
- substithing " awk dc " "-lm" "$1"
-
- substithing " httpd vlock " "-lcrypt" "$1"
- }
- strange_names=`sed -rn -e 's/\#.*//' -e 's/.*APPLET_NOUSAGE\(([^,]*),([^,]*),.*/\1 \2/p' -e 's/.*APPLET_ODDNAME\(([^,]*),([^,]*),.*, *([^)]*).*/\1 \2@\3/p' include/applets.h`
- function bonkname()
- {
- while [ $# -gt 0 ]
- do
- if [ "$APPLET" == "$1" ]
- then
- APPFILT="${2/@*/}"
- if [ "${APPFILT}" == "$2" ]
- then
- HELPNAME='"nousage\n"'
- else
- HELPNAME="${2/*@/}"_full_usage
- fi
- break
- fi
- shift 2
- done
- }
- function buildit ()
- {
- export APPLET="$1"
- export APPFILT=${APPLET}
- export HELPNAME=${APPLET}_full_usage
- bonkname $strange_names
- j=`find archival console-tools coreutils debianutils editors findutils init loginutils miscutils modutils networking procps shell sysklogd util-linux -name "${APPFILT}.c"`
- if [ -z "$j" ]
- then
- echo no file for $APPLET
- else
- echo "Building $APPLET"
- gcc -Os -o build/$APPLET applets/individual.c $j \
- `extra_libraries $APPFILT` libbb/libbb.a -Iinclude \
- -DBUILD_INDIVIDUAL \
- '-Drun_applet_by_name(...)' '-Dfind_applet_by_name(...)=0' \
- -DAPPLET_main=${APPFILT}_main -DAPPLET_full_usage=${HELPNAME}
- if [ $? -ne 0 ];
- then
- echo "Failed $APPLET"
- fi
- fi
- }
- if [ $# -eq 0 ]
- then
- for APPLET in `sed 's .*/ ' busybox.links`
- do
- buildit "$APPLET"
- done
- else
- buildit "$1"
- fi
- strip build/*
|