diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-10-28 20:45:37 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-10-28 20:45:37 +0200 |
commit | 02788ac7e2a44eee889aa1005e89076f928e964a (patch) | |
tree | 70b0d7bac514d29f8e7cb70d82f921c988f85b88 | |
parent | b27d62af8bd83f482506271510bfa6e873b953ab (diff) | |
download | busybox-w32-02788ac7e2a44eee889aa1005e89076f928e964a.tar.gz busybox-w32-02788ac7e2a44eee889aa1005e89076f928e964a.tar.bz2 busybox-w32-02788ac7e2a44eee889aa1005e89076f928e964a.zip |
scripts: remove bitrotted scripts/individual
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | docs/new-applet-HOWTO.txt | 3 | ||||
-rwxr-xr-x | scripts/individual | 129 | ||||
-rwxr-xr-x | scripts/mkdiff_obj | 23 |
3 files changed, 16 insertions, 139 deletions
diff --git a/docs/new-applet-HOWTO.txt b/docs/new-applet-HOWTO.txt index 8a825b998..bb29999cf 100644 --- a/docs/new-applet-HOWTO.txt +++ b/docs/new-applet-HOWTO.txt | |||
@@ -19,8 +19,7 @@ such as who you stole the code from and so forth. Also include the mini-GPL | |||
19 | boilerplate. Be sure to name the main function <applet>_main instead of main. | 19 | boilerplate. Be sure to name the main function <applet>_main instead of main. |
20 | And be sure to put it in <applet>.c. Usage does not have to be taken care of by | 20 | And be sure to put it in <applet>.c. Usage does not have to be taken care of by |
21 | your applet. | 21 | your applet. |
22 | Make sure to #include "libbb.h" as the first include file in your applet so | 22 | Make sure to #include "libbb.h" as the first include file in your applet. |
23 | the bb_config.h and appropriate platform specific files are included properly. | ||
24 | 23 | ||
25 | For a new applet mu, here is the code that would go in mu.c: | 24 | For a new applet mu, here is the code that would go in mu.c: |
26 | 25 | ||
diff --git a/scripts/individual b/scripts/individual deleted file mode 100755 index e93ca5552..000000000 --- a/scripts/individual +++ /dev/null | |||
@@ -1,129 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Compile individual versions of each busybox applet. | ||
4 | |||
5 | if [ $# -eq 0 ] | ||
6 | then | ||
7 | |||
8 | # Clear out the build directory. (Make clean should do this instead of here.) | ||
9 | |||
10 | rm -rf build | ||
11 | mkdir build | ||
12 | |||
13 | # Make our prerequisites. | ||
14 | |||
15 | make busybox.links include/bb_config.h $(pwd)/{libbb/libbb.a,archival/libunarchive/libunarchive.a,coreutils/libcoreutils/libcoreutils.a,networking/libiproute/libiproute.a} | ||
16 | |||
17 | else | ||
18 | # Could very well be that we want to build an individual applet but have no | ||
19 | # 'build' dir yet.. | ||
20 | |||
21 | test -d ./build || mkdir build | ||
22 | |||
23 | fi | ||
24 | |||
25 | # About 3/5 of the applets build from one .c file (with the same name as the | ||
26 | # corresponding applet), and all it needs to link against. However, to build | ||
27 | # them all we need more than that. | ||
28 | |||
29 | # Figure out which applets need extra libraries added to their command line. | ||
30 | |||
31 | function substithing() | ||
32 | { | ||
33 | if [ "${1/ $3 //}" != "$1" ] | ||
34 | then | ||
35 | echo $2 | ||
36 | fi | ||
37 | } | ||
38 | |||
39 | function extra_libraries() | ||
40 | { | ||
41 | # gzip needs gunzip.c (when gunzip is enabled, anyway). | ||
42 | substithing " gzip " "archival/gunzip.c archival/uncompress.c" "$1" | ||
43 | |||
44 | # init needs init_shared.c | ||
45 | substithing " init " "init/init_shared.c" "$1" | ||
46 | |||
47 | # ifconfig needs interface.c | ||
48 | substithing " ifconfig " "networking/interface.c" "$1" | ||
49 | |||
50 | # Applets that need libunarchive.a | ||
51 | substithing " ar bunzip2 unlzma cpio dpkg gunzip rpm2cpio rpm tar uncompress unzip dpkg_deb gzip " "archival/libunarchive/libunarchive.a" "$1" | ||
52 | |||
53 | # Applets that need libcoreutils.a | ||
54 | substithing " cp mv " "coreutils/libcoreutils/libcoreutils.a" "$1" | ||
55 | |||
56 | # Applets that need libiproute.a | ||
57 | substithing " ip " "networking/libiproute/libiproute.a" "$1" | ||
58 | |||
59 | # What needs -libm? | ||
60 | substithing " awk dc " "-lm" "$1" | ||
61 | |||
62 | # What needs -lcrypt? | ||
63 | substithing " httpd vlock " "-lcrypt" "$1" | ||
64 | } | ||
65 | |||
66 | # Query applets.h to figure out which applets need special treatment | ||
67 | |||
68 | strange_names=`sed -rn -e 's/\#.*//' -e 's/.*APPLET_NOUSAGE\(([^,]*),([^,]*),.*/\1 \2/p' -e 's/.*APPLET_ODDNAME\(([^,]*),([^,]*),.*, *([^)]*).*/\1 \2@\3/p' include/applets.h` | ||
69 | |||
70 | function bonkname() | ||
71 | { | ||
72 | while [ $# -gt 0 ] | ||
73 | do | ||
74 | if [ "$APPLET" == "$1" ] | ||
75 | then | ||
76 | APPFILT="${2/@*/}" | ||
77 | if [ "${APPFILT}" == "$2" ] | ||
78 | then | ||
79 | HELPNAME='"nousage\n"' # These should be _fixed_. | ||
80 | else | ||
81 | HELPNAME="${2/*@/}"_full_usage | ||
82 | fi | ||
83 | break | ||
84 | fi | ||
85 | shift 2 | ||
86 | done | ||
87 | #echo APPLET=${APPLET} APPFILT=${APPFILT} HELPNAME=${HELPNAME} 2=${2} | ||
88 | } | ||
89 | |||
90 | # Iterate through every name in busybox.links | ||
91 | |||
92 | function buildit () | ||
93 | { | ||
94 | export APPLET="$1" | ||
95 | export APPFILT=${APPLET} | ||
96 | export HELPNAME=${APPLET}_full_usage | ||
97 | |||
98 | bonkname $strange_names | ||
99 | |||
100 | j=`find archival console-tools coreutils debianutils editors findutils init loginutils miscutils modutils networking procps shell sysklogd util-linux -name "${APPFILT}.c"` | ||
101 | if [ -z "$j" ] | ||
102 | then | ||
103 | echo no file for $APPLET | ||
104 | else | ||
105 | echo "Building $APPLET" | ||
106 | gcc -Os -o build/$APPLET applets/individual.c $j \ | ||
107 | `extra_libraries $APPFILT` libbb/libbb.a -Iinclude \ | ||
108 | -DBUILD_INDIVIDUAL \ | ||
109 | '-Drun_applet_and_exit(...)' '-Dfind_applet_by_name(...)=0' \ | ||
110 | -DAPPLET_main=${APPFILT}_main -DAPPLET_full_usage=${HELPNAME} | ||
111 | if [ $? -ne 0 ]; | ||
112 | then | ||
113 | echo "Failed $APPLET" | ||
114 | fi | ||
115 | fi | ||
116 | } | ||
117 | |||
118 | if [ $# -eq 0 ] | ||
119 | then | ||
120 | for APPLET in `sed 's .*/ ' busybox.links` | ||
121 | do | ||
122 | buildit "$APPLET" | ||
123 | done | ||
124 | else | ||
125 | buildit "$1" | ||
126 | fi | ||
127 | |||
128 | |||
129 | strip build/* | ||
diff --git a/scripts/mkdiff_obj b/scripts/mkdiff_obj index a6ec5e602..f783491af 100755 --- a/scripts/mkdiff_obj +++ b/scripts/mkdiff_obj | |||
@@ -1,28 +1,35 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | usage() { | ||
4 | echo "Usage: ${0##*/} DIR1 DIR2" | ||
5 | echo | ||
6 | echo "Compares all object files recursivelty found in DIR1 and DIR2." | ||
7 | echo "Prints diff of their disassembly." | ||
8 | echo | ||
9 | exit $1 | ||
10 | } | ||
11 | |||
3 | filter() { | 12 | filter() { |
4 | # sed removes " address: " prefixes which mess up diff | 13 | # sed removes " address: " prefixes which mess up diff |
5 | sed $'s/^\\(\t*\\)[ ]*[0-9a-f][0-9a-f]*:[ \t]*/\\1/' \ | 14 | sed $'s/^\\(\t*\\)[ ]*[0-9a-f][0-9a-f]*:[ \t]*/\\1/' \ |
6 | | sed 's/__GI_//g' | 15 | | sed 's/__GI_//g' |
7 | } | 16 | } |
8 | 17 | ||
9 | test -d "$1" || exit 1 | 18 | test -d "$1" || usage 1 |
10 | test -d "$2" || exit 1 | 19 | test -d "$2" || usage 1 |
11 | 20 | ||
12 | { | 21 | { |
13 | ( | 22 | ( |
14 | cd "$1" || exit 1 | 23 | cd "$1" || exit 1 |
15 | find -name '*.o' -o -name '*.os' # -o -name '*.so' | 24 | find -name '*.o' # -o -name '*.os' # -o -name '*.so' |
16 | ) | 25 | ) |
17 | ( | 26 | ( |
18 | cd "$2" || exit 1 | 27 | cd "$2" || exit 1 |
19 | find -name '*.o' -o -name '*.os' # -o -name '*.so' | 28 | find -name '*.o' # -o -name '*.os' # -o -name '*.so' |
20 | ) | 29 | ) |
21 | } | sed 's:^\./::' | sort | uniq | \ | 30 | } | sed 's:^\./::' | sort | uniq | \ |
22 | tee LST | \ | ||
23 | ( | 31 | ( |
24 | IFS='' | 32 | while IFS='' read -r oname; do |
25 | while read -r oname; do | ||
26 | if ! test -f "$1/$oname"; then | 33 | if ! test -f "$1/$oname"; then |
27 | echo "Only $2/$oname" | 34 | echo "Only $2/$oname" |
28 | continue | 35 | continue |
@@ -34,6 +41,6 @@ while read -r oname; do | |||
34 | diff -q -- "$1/$oname" "$2/$oname" >/dev/null && continue | 41 | diff -q -- "$1/$oname" "$2/$oname" >/dev/null && continue |
35 | (cd "$1"; objdump -dr "$oname" | filter >"$oname.disasm") | 42 | (cd "$1"; objdump -dr "$oname" | filter >"$oname.disasm") |
36 | (cd "$2"; objdump -dr "$oname" | filter >"$oname.disasm") | 43 | (cd "$2"; objdump -dr "$oname" | filter >"$oname.disasm") |
37 | diff -u "$1/$oname.disasm" "$2/$oname.disasm" | 44 | diff -u -- "$1/$oname.disasm" "$2/$oname.disasm" |
38 | done | 45 | done |
39 | ) | 46 | ) |