scripts: remove bitrotted scripts/individual

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2010-10-28 20:45:37 +02:00
parent b27d62af8b
commit 02788ac7e2
3 changed files with 16 additions and 139 deletions

View File

@ -19,8 +19,7 @@ such as who you stole the code from and so forth. Also include the mini-GPL
boilerplate. Be sure to name the main function <applet>_main instead of main. boilerplate. Be sure to name the main function <applet>_main instead of main.
And be sure to put it in <applet>.c. Usage does not have to be taken care of by And be sure to put it in <applet>.c. Usage does not have to be taken care of by
your applet. your applet.
Make sure to #include "libbb.h" as the first include file in your applet so Make sure to #include "libbb.h" as the first include file in your applet.
the bb_config.h and appropriate platform specific files are included properly.
For a new applet mu, here is the code that would go in mu.c: For a new applet mu, here is the code that would go in mu.c:

View File

@ -1,129 +0,0 @@
#!/bin/sh
# Compile individual versions of each busybox applet.
if [ $# -eq 0 ]
then
# Clear out the build directory. (Make clean should do this instead of here.)
rm -rf build
mkdir build
# Make our prerequisites.
make busybox.links include/bb_config.h $(pwd)/{libbb/libbb.a,archival/libunarchive/libunarchive.a,coreutils/libcoreutils/libcoreutils.a,networking/libiproute/libiproute.a}
else
# Could very well be that we want to build an individual applet but have no
# 'build' dir yet..
test -d ./build || mkdir build
fi
# About 3/5 of the applets build from one .c file (with the same name as the
# corresponding applet), and all it needs to link against. However, to build
# them all we need more than that.
# Figure out which applets need extra libraries added to their command line.
function substithing()
{
if [ "${1/ $3 //}" != "$1" ]
then
echo $2
fi
}
function extra_libraries()
{
# gzip needs gunzip.c (when gunzip is enabled, anyway).
substithing " gzip " "archival/gunzip.c archival/uncompress.c" "$1"
# init needs init_shared.c
substithing " init " "init/init_shared.c" "$1"
# ifconfig needs interface.c
substithing " ifconfig " "networking/interface.c" "$1"
# Applets that need libunarchive.a
substithing " ar bunzip2 unlzma cpio dpkg gunzip rpm2cpio rpm tar uncompress unzip dpkg_deb gzip " "archival/libunarchive/libunarchive.a" "$1"
# Applets that need libcoreutils.a
substithing " cp mv " "coreutils/libcoreutils/libcoreutils.a" "$1"
# Applets that need libiproute.a
substithing " ip " "networking/libiproute/libiproute.a" "$1"
# What needs -libm?
substithing " awk dc " "-lm" "$1"
# What needs -lcrypt?
substithing " httpd vlock " "-lcrypt" "$1"
}
# Query applets.h to figure out which applets need special treatment
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"' # These should be _fixed_.
else
HELPNAME="${2/*@/}"_full_usage
fi
break
fi
shift 2
done
#echo APPLET=${APPLET} APPFILT=${APPFILT} HELPNAME=${HELPNAME} 2=${2}
}
# Iterate through every name in busybox.links
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_and_exit(...)' '-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/*

View File

@ -1,28 +1,35 @@
#!/bin/sh #!/bin/sh
usage() {
echo "Usage: ${0##*/} DIR1 DIR2"
echo
echo "Compares all object files recursivelty found in DIR1 and DIR2."
echo "Prints diff of their disassembly."
echo
exit $1
}
filter() { filter() {
# sed removes " address: " prefixes which mess up diff # sed removes " address: " prefixes which mess up diff
sed $'s/^\\(\t*\\)[ ]*[0-9a-f][0-9a-f]*:[ \t]*/\\1/' \ sed $'s/^\\(\t*\\)[ ]*[0-9a-f][0-9a-f]*:[ \t]*/\\1/' \
| sed 's/__GI_//g' | sed 's/__GI_//g'
} }
test -d "$1" || exit 1 test -d "$1" || usage 1
test -d "$2" || exit 1 test -d "$2" || usage 1
{ {
( (
cd "$1" || exit 1 cd "$1" || exit 1
find -name '*.o' -o -name '*.os' # -o -name '*.so' find -name '*.o' # -o -name '*.os' # -o -name '*.so'
) )
( (
cd "$2" || exit 1 cd "$2" || exit 1
find -name '*.o' -o -name '*.os' # -o -name '*.so' find -name '*.o' # -o -name '*.os' # -o -name '*.so'
) )
} | sed 's:^\./::' | sort | uniq | \ } | sed 's:^\./::' | sort | uniq | \
tee LST | \
( (
IFS='' while IFS='' read -r oname; do
while read -r oname; do
if ! test -f "$1/$oname"; then if ! test -f "$1/$oname"; then
echo "Only $2/$oname" echo "Only $2/$oname"
continue continue
@ -34,6 +41,6 @@ while read -r oname; do
diff -q -- "$1/$oname" "$2/$oname" >/dev/null && continue diff -q -- "$1/$oname" "$2/$oname" >/dev/null && continue
(cd "$1"; objdump -dr "$oname" | filter >"$oname.disasm") (cd "$1"; objdump -dr "$oname" | filter >"$oname.disasm")
(cd "$2"; objdump -dr "$oname" | filter >"$oname.disasm") (cd "$2"; objdump -dr "$oname" | filter >"$oname.disasm")
diff -u "$1/$oname.disasm" "$2/$oname.disasm" diff -u -- "$1/$oname.disasm" "$2/$oname.disasm"
done done
) )