diff options
author | Rob Landley <rob@landley.net> | 2006-08-06 02:13:36 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-08-06 02:13:36 +0000 |
commit | 236c6755d2532cc20e31f4ff4f19cdaa4bde078c (patch) | |
tree | efd52650829e699be220c3932a7f4360f316482e /scripts | |
parent | affb7a61a6576194b5c87635ad87d3b3b9e6575b (diff) | |
download | busybox-w32-236c6755d2532cc20e31f4ff4f19cdaa4bde078c.tar.gz busybox-w32-236c6755d2532cc20e31f4ff4f19cdaa4bde078c.tar.bz2 busybox-w32-236c6755d2532cc20e31f4ff4f19cdaa4bde078c.zip |
Teach md5sum and sha1sum to work the way other applets do so I don't have to
teach scripts/individual new tricks. And while I'm at it, teach
scripts/individual other new tricks. Now builds 198 applets, some of which
I should teach it to hardlink together because they're really the same app...
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/individual | 67 |
1 files changed, 51 insertions, 16 deletions
diff --git a/scripts/individual b/scripts/individual index 8815e1e14..35c44e87e 100755 --- a/scripts/individual +++ b/scripts/individual | |||
@@ -1,5 +1,10 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | # Clear out the build directory. (Make clean should do this instead of here.) | ||
4 | |||
5 | rm -rf build | ||
6 | mkdir build | ||
7 | |||
3 | # Make our prerequisites. | 8 | # Make our prerequisites. |
4 | 9 | ||
5 | make busybox.links include/bb_config.h | 10 | make busybox.links include/bb_config.h |
@@ -12,15 +17,18 @@ cd libbb | |||
12 | make | 17 | make |
13 | cd .. | 18 | cd .. |
14 | 19 | ||
20 | # Same problem. | ||
21 | |||
15 | cd archival/libunarchive | 22 | cd archival/libunarchive |
16 | make | 23 | make |
17 | cd ../.. | 24 | cd ../.. |
18 | 25 | ||
19 | # 146 applets build without any extra stuff. The applet is one C file with | 26 | # About 3/5 of the applets build from one .c file (with the same name as the |
20 | # the same name as the corresponding applet, and all it needs to link against | 27 | # corresponding applet), and all it needs to link against. However, to build |
21 | # is libbb.a. However, 104 of them need more than that. | 28 | # them all we need more than that. |
29 | |||
30 | # Figure out which applets need extra libraries added to their command line. | ||
22 | 31 | ||
23 | # dpkg_deb gzip | ||
24 | function extra_libraries() | 32 | function extra_libraries() |
25 | { | 33 | { |
26 | archival="ar bunzip2 unlzma cpio dpkg gunzip rpm2cpio rpm tar uncompress unzip dpkg_deb gzip " | 34 | archival="ar bunzip2 unlzma cpio dpkg gunzip rpm2cpio rpm tar uncompress unzip dpkg_deb gzip " |
@@ -28,34 +36,61 @@ function extra_libraries() | |||
28 | then | 36 | then |
29 | echo "archival/libunarchive/libunarchive.a" | 37 | echo "archival/libunarchive/libunarchive.a" |
30 | fi | 38 | fi |
39 | |||
40 | # What needs -libm? | ||
41 | |||
42 | libm="awk dc " | ||
43 | if [ "${libm/$1 //}" != "${libm}" ] | ||
44 | then | ||
45 | echo "-lm" | ||
46 | fi | ||
31 | } | 47 | } |
32 | |||
33 | |||
34 | 48 | ||
35 | # Here are a few that build in a standard way. Others are easy to get to | 49 | # Query applets.h to figure out which need something funky |
36 | # build, for example miscutils/dc needs -lm and most of loginutils/* needs | ||
37 | # -lcrypt... | ||
38 | 50 | ||
39 | rm -rf build | 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` |
40 | mkdir build | 52 | |
53 | function bonkname() | ||
54 | { | ||
55 | while [ $# -gt 0 ] | ||
56 | do | ||
57 | if [ "$APPLET" == "$1" ] | ||
58 | then | ||
59 | APPFILT="${2/@*/}" | ||
60 | if [ "${APPFILT}" == "$2" ] | ||
61 | then | ||
62 | HELPNAME='"nousage\n"' | ||
63 | else | ||
64 | HELPNAME="${2/*@/}"_full_usage | ||
65 | fi | ||
66 | break | ||
67 | fi | ||
68 | shift 2 | ||
69 | done | ||
70 | #echo APPLET=${APPLET} APPFILT=${APPFILT} HELPNAME=${HELPNAME} 2=${2} | ||
71 | } | ||
41 | 72 | ||
42 | for APPLET in `sed 's .*/ ' busybox.links` | 73 | for APPLET in `sed 's .*/ ' busybox.links` |
43 | do | 74 | do |
44 | APPFILT=${APPLET/-/_} | 75 | export APPLET |
45 | j=`find . -name "${APPLET/-/?}.c"` # Because ether-wake.c is broken. | 76 | export APPFILT=${APPLET} |
77 | export HELPNAME=${APPLET}_full_usage | ||
78 | bonkname $strange_names | ||
79 | |||
80 | j=`find . -name "${APPFILT}.c"` | ||
46 | if [ -z "$j" ] | 81 | if [ -z "$j" ] |
47 | then | 82 | then |
48 | echo no file for $APPLET | 83 | echo no file for $APPLET |
49 | else | 84 | else |
50 | echo "Building $APPLET..." | 85 | echo "Building $APPLET" |
51 | gcc -Os -o build/$APPLET applets/individual.c $j \ | 86 | gcc -Os -o build/$APPLET applets/individual.c $j \ |
52 | `extra_libraries $APPFILT` libbb/libbb.a -Iinclude \ | 87 | `extra_libraries $APPFILT` libbb/libbb.a -Iinclude \ |
53 | -DBUILD_INDIVIDUAL \ | 88 | -DBUILD_INDIVIDUAL \ |
54 | "-Drun_applet_by_name(...)" "-Dfind_applet_by_name(...) 0" \ | 89 | "-Drun_applet_by_name(...)" "-Dfind_applet_by_name(...) 0" \ |
55 | -DAPPLET_main=${APPFILT}_main -DAPPLET_full_usage=${APPFILT}_full_usage | 90 | -DAPPLET_main=${APPFILT}_main -DAPPLET_full_usage=${HELPNAME} |
56 | if [ $? -ne 0 ]; | 91 | if [ $? -ne 0 ]; |
57 | then | 92 | then |
58 | echo "Failed." | 93 | echo "Failed $APPLET" |
59 | fi | 94 | fi |
60 | fi | 95 | fi |
61 | done | 96 | done |