diff options
author | Rob Landley <rob@landley.net> | 2006-08-09 20:56:23 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-08-09 20:56:23 +0000 |
commit | 519d7df930d2ac14b7a833c0255a4a5abd5a329b (patch) | |
tree | ad8d4242826335c7e418648d60d82a55095f11e1 /scripts | |
parent | e55a73c7a89d9437bda82d317ee980989a5949db (diff) | |
download | busybox-w32-519d7df930d2ac14b7a833c0255a4a5abd5a329b.tar.gz busybox-w32-519d7df930d2ac14b7a833c0255a4a5abd5a329b.tar.bz2 busybox-w32-519d7df930d2ac14b7a833c0255a4a5abd5a329b.zip |
Another whack at scripts/individual. Now builds 212 applets.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/individual | 85 |
1 files changed, 68 insertions, 17 deletions
diff --git a/scripts/individual b/scripts/individual index 35c44e87e..1463e0fc4 100755 --- a/scripts/individual +++ b/scripts/individual | |||
@@ -1,5 +1,10 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | # Compile individual versions of each busybox applet. | ||
4 | |||
5 | if [ $# -eq 0 ] | ||
6 | then | ||
7 | |||
3 | # Clear out the build directory. (Make clean should do this instead of here.) | 8 | # Clear out the build directory. (Make clean should do this instead of here.) |
4 | 9 | ||
5 | rm -rf build | 10 | rm -rf build |
@@ -23,30 +28,62 @@ cd archival/libunarchive | |||
23 | make | 28 | make |
24 | cd ../.. | 29 | cd ../.. |
25 | 30 | ||
31 | # And again | ||
32 | |||
33 | cd coreutils/libcoreutils | ||
34 | make | ||
35 | cd ../.. | ||
36 | |||
37 | # Sensing a pattern here? | ||
38 | |||
39 | #cd networking/libiproute | ||
40 | #make | ||
41 | #cd ../.. | ||
42 | |||
43 | fi | ||
44 | |||
26 | # About 3/5 of the applets build from one .c file (with the same name as the | 45 | # About 3/5 of the applets build from one .c file (with the same name as the |
27 | # corresponding applet), and all it needs to link against. However, to build | 46 | # corresponding applet), and all it needs to link against. However, to build |
28 | # them all we need more than that. | 47 | # them all we need more than that. |
29 | 48 | ||
30 | # Figure out which applets need extra libraries added to their command line. | 49 | # Figure out which applets need extra libraries added to their command line. |
31 | 50 | ||
32 | function extra_libraries() | 51 | function substithing() |
33 | { | 52 | { |
34 | archival="ar bunzip2 unlzma cpio dpkg gunzip rpm2cpio rpm tar uncompress unzip dpkg_deb gzip " | 53 | if [ "${1/ $3 //}" != "$1" ] |
35 | if [ "${archival/$1 //}" != "${archival}" ] | ||
36 | then | 54 | then |
37 | echo "archival/libunarchive/libunarchive.a" | 55 | echo $2 |
38 | fi | 56 | fi |
57 | } | ||
58 | |||
59 | function extra_libraries() | ||
60 | { | ||
61 | # gzip needs gunzip.c (when gunzip is enabled, anyway). | ||
62 | substithing " gzip " "archival/gunzip.c archival/uncompress.c" "$1" | ||
63 | |||
64 | # init needs init_shared.c | ||
65 | substithing " init " "init/init_shared.c" "$1" | ||
66 | |||
67 | # ifconfig needs interface.c | ||
68 | substithing " ifconfig " "networking/interface.c" "$1" | ||
69 | |||
70 | # Applets that need libunarchive.a | ||
71 | substithing " ar bunzip2 unlzma cpio dpkg gunzip rpm2cpio rpm tar uncompress unzip dpkg_deb gzip " "archival/libunarchive/libunarchive.a" "$1" | ||
72 | |||
73 | # Applets that need libcoreutils.a | ||
74 | substithing " cp mv " "coreutils/libcoreutils/libcoreutils.a" "$1" | ||
75 | |||
76 | # Applets that need libiproute.a | ||
77 | substithing " ip " "networking/libiproute/libiproute.a" "$1" | ||
39 | 78 | ||
40 | # What needs -libm? | 79 | # What needs -libm? |
80 | substithing " awk dc " "-lm" "$1" | ||
41 | 81 | ||
42 | libm="awk dc " | 82 | # What needs -lcrypt? |
43 | if [ "${libm/$1 //}" != "${libm}" ] | 83 | substithing " httpd vlock " "-lcrypt" "$1" |
44 | then | ||
45 | echo "-lm" | ||
46 | fi | ||
47 | } | 84 | } |
48 | 85 | ||
49 | # Query applets.h to figure out which need something funky | 86 | # Query applets.h to figure out which applets need special treatment |
50 | 87 | ||
51 | strange_names=`sed -rn -e 's/\#.*//' -e 's/.*APPLET_NOUSAGE\(([^,]*),([^,]*),.*/\1 \2/p' -e 's/.*APPLET_ODDNAME\(([^,]*),([^,]*),.*, *([^)]*).*/\1 \2@\3/p' include/applets.h` | 88 | strange_names=`sed -rn -e 's/\#.*//' -e 's/.*APPLET_NOUSAGE\(([^,]*),([^,]*),.*/\1 \2/p' -e 's/.*APPLET_ODDNAME\(([^,]*),([^,]*),.*, *([^)]*).*/\1 \2@\3/p' include/applets.h` |
52 | 89 | ||
@@ -59,7 +96,7 @@ function bonkname() | |||
59 | APPFILT="${2/@*/}" | 96 | APPFILT="${2/@*/}" |
60 | if [ "${APPFILT}" == "$2" ] | 97 | if [ "${APPFILT}" == "$2" ] |
61 | then | 98 | then |
62 | HELPNAME='"nousage\n"' | 99 | HELPNAME='"nousage\n"' # These should be _fixed_. |
63 | else | 100 | else |
64 | HELPNAME="${2/*@/}"_full_usage | 101 | HELPNAME="${2/*@/}"_full_usage |
65 | fi | 102 | fi |
@@ -70,14 +107,17 @@ function bonkname() | |||
70 | #echo APPLET=${APPLET} APPFILT=${APPFILT} HELPNAME=${HELPNAME} 2=${2} | 107 | #echo APPLET=${APPLET} APPFILT=${APPFILT} HELPNAME=${HELPNAME} 2=${2} |
71 | } | 108 | } |
72 | 109 | ||
73 | for APPLET in `sed 's .*/ ' busybox.links` | 110 | # Iterate through every name in busybox.links |
74 | do | 111 | |
75 | export APPLET | 112 | function buildit () |
113 | { | ||
114 | export APPLET="$1" | ||
76 | export APPFILT=${APPLET} | 115 | export APPFILT=${APPLET} |
77 | export HELPNAME=${APPLET}_full_usage | 116 | export HELPNAME=${APPLET}_full_usage |
117 | |||
78 | bonkname $strange_names | 118 | bonkname $strange_names |
79 | 119 | ||
80 | j=`find . -name "${APPFILT}.c"` | 120 | j=`find archival console-tools coreutils debianutils editors findutils init loginutils miscutils modutils networking procps shell sysklogd util-linux -name "${APPFILT}.c"` |
81 | if [ -z "$j" ] | 121 | if [ -z "$j" ] |
82 | then | 122 | then |
83 | echo no file for $APPLET | 123 | echo no file for $APPLET |
@@ -86,13 +126,24 @@ do | |||
86 | gcc -Os -o build/$APPLET applets/individual.c $j \ | 126 | gcc -Os -o build/$APPLET applets/individual.c $j \ |
87 | `extra_libraries $APPFILT` libbb/libbb.a -Iinclude \ | 127 | `extra_libraries $APPFILT` libbb/libbb.a -Iinclude \ |
88 | -DBUILD_INDIVIDUAL \ | 128 | -DBUILD_INDIVIDUAL \ |
89 | "-Drun_applet_by_name(...)" "-Dfind_applet_by_name(...) 0" \ | 129 | '-Drun_applet_by_name(...)' '-Dfind_applet_by_name(...)=0' \ |
90 | -DAPPLET_main=${APPFILT}_main -DAPPLET_full_usage=${HELPNAME} | 130 | -DAPPLET_main=${APPFILT}_main -DAPPLET_full_usage=${HELPNAME} |
91 | if [ $? -ne 0 ]; | 131 | if [ $? -ne 0 ]; |
92 | then | 132 | then |
93 | echo "Failed $APPLET" | 133 | echo "Failed $APPLET" |
94 | fi | 134 | fi |
95 | fi | 135 | fi |
96 | done | 136 | } |
137 | |||
138 | if [ $# -eq 0 ] | ||
139 | then | ||
140 | for APPLET in `sed 's .*/ ' busybox.links` | ||
141 | do | ||
142 | buildit "$APPLET" | ||
143 | done | ||
144 | else | ||
145 | buildit "$1" | ||
146 | fi | ||
147 | |||
97 | 148 | ||
98 | strip build/* | 149 | strip build/* |