aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-08-09 20:56:23 +0000
committerRob Landley <rob@landley.net>2006-08-09 20:56:23 +0000
commit519d7df930d2ac14b7a833c0255a4a5abd5a329b (patch)
treead8d4242826335c7e418648d60d82a55095f11e1
parente55a73c7a89d9437bda82d317ee980989a5949db (diff)
downloadbusybox-w32-519d7df930d2ac14b7a833c0255a4a5abd5a329b.tar.gz
busybox-w32-519d7df930d2ac14b7a833c0255a4a5abd5a329b.tar.bz2
busybox-w32-519d7df930d2ac14b7a833c0255a4a5abd5a329b.zip
Another whack at scripts/individual. Now builds 212 applets.
-rw-r--r--applets/Makefile.in2
-rw-r--r--applets/version.c17
-rw-r--r--coreutils/install.c10
-rw-r--r--include/libbb.h2
-rw-r--r--include/platform.h1
-rw-r--r--libbb/messages.c8
-rw-r--r--libbb/xfuncs.c2
-rw-r--r--modutils/insmod.c1
-rwxr-xr-xscripts/individual85
9 files changed, 81 insertions, 47 deletions
diff --git a/applets/Makefile.in b/applets/Makefile.in
index 02bcda93b..a4890c2fb 100644
--- a/applets/Makefile.in
+++ b/applets/Makefile.in
@@ -10,7 +10,7 @@ APPLETS_DIR:=$(top_builddir)/applets/
10endif 10endif
11srcdir=$(top_srcdir)/applets 11srcdir=$(top_srcdir)/applets
12 12
13APPLET_SRC:= $(patsubst %,$(srcdir)/%,applets.c busybox.c version.c) 13APPLET_SRC:= $(patsubst %,$(srcdir)/%,applets.c busybox.c)
14APPLET_OBJ:= $(patsubst $(srcdir)/%.c,$(APPLETS_DIR)%.o, $(APPLET_SRC)) 14APPLET_OBJ:= $(patsubst $(srcdir)/%.c,$(APPLETS_DIR)%.o, $(APPLET_SRC))
15 15
16APPLET_SRC-y+=$(APPLET_SRC) 16APPLET_SRC-y+=$(APPLET_SRC)
diff --git a/applets/version.c b/applets/version.c
deleted file mode 100644
index ce75f1ff9..000000000
--- a/applets/version.c
+++ /dev/null
@@ -1,17 +0,0 @@
1/* vi: set sw=4 ts=4: */
2/*
3 * Version stuff.
4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
6 */
7
8#include "busybox.h"
9
10#ifndef BB_EXTRA_VERSION
11#define BANNER "BusyBox v" BB_VER " (" BB_BT ")"
12#else
13#define BANNER "BusyBox v" BB_VER " (" BB_EXTRA_VERSION ")"
14#endif
15
16const char BB_BANNER[]=BANNER;
17const char * const bb_msg_full_version = BANNER " multi-call binary";
diff --git a/coreutils/install.c b/coreutils/install.c
index f6d84c15f..d3d6a58a1 100644
--- a/coreutils/install.c
+++ b/coreutils/install.c
@@ -8,16 +8,10 @@
8 * owner/group, will probably modify bb_make_directory(...) 8 * owner/group, will probably modify bb_make_directory(...)
9 */ 9 */
10 10
11#include <sys/stat.h>
12#include <sys/types.h>
13#include <errno.h>
14#include <stdlib.h>
15#include <string.h>
16#include <unistd.h>
17#include <getopt.h> /* struct option */
18
19#include "busybox.h" 11#include "busybox.h"
20#include "libcoreutils/coreutils.h" 12#include "libcoreutils/coreutils.h"
13#include <libgen.h>
14#include <getopt.h> /* struct option */
21 15
22#define INSTALL_OPT_CMD 1 16#define INSTALL_OPT_CMD 1
23#define INSTALL_OPT_DIRECTORY 2 17#define INSTALL_OPT_DIRECTORY 2
diff --git a/include/libbb.h b/include/libbb.h
index 963a0290c..67d4eb170 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -222,8 +222,10 @@ extern void chomp(char *s);
222extern void trim(char *s); 222extern void trim(char *s);
223extern char *skip_whitespace(const char *); 223extern char *skip_whitespace(const char *);
224 224
225#ifndef BUILD_INDIVIDUAL
225extern struct BB_applet *find_applet_by_name(const char *name); 226extern struct BB_applet *find_applet_by_name(const char *name);
226void run_applet_by_name(const char *name, int argc, char **argv); 227void run_applet_by_name(const char *name, int argc, char **argv);
228#endif
227 229
228/* dmalloc will redefine these to it's own implementation. It is safe 230/* dmalloc will redefine these to it's own implementation. It is safe
229 * to have the prototypes here unconditionally. */ 231 * to have the prototypes here unconditionally. */
diff --git a/include/platform.h b/include/platform.h
index ca6f3634f..a4ff9b8d7 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -154,6 +154,7 @@ __extension__ typedef unsigned long long __u64;
154 154
155#if defined __GLIBC__ || defined __UCLIBC__ \ 155#if defined __GLIBC__ || defined __UCLIBC__ \
156 || defined __dietlibc__ || defined _NEWLIB_VERSION 156 || defined __dietlibc__ || defined _NEWLIB_VERSION
157#define _XOPEN_SOURCE
157#include <features.h> 158#include <features.h>
158#define HAVE_FEATURES_H 159#define HAVE_FEATURES_H
159#include <stdint.h> 160#include <stdint.h>
diff --git a/libbb/messages.c b/libbb/messages.c
index 2feb6a970..b6755058e 100644
--- a/libbb/messages.c
+++ b/libbb/messages.c
@@ -9,12 +9,14 @@
9 9
10#ifdef L_full_version 10#ifdef L_full_version
11#ifndef BB_EXTRA_VERSION 11#ifndef BB_EXTRA_VERSION
12#define LIBBB_BANNER "BusyBox's library v" BB_VER " (" BB_BT ")" 12#define BANNER "BusyBox v" BB_VER " (" BB_BT ")"
13#else 13#else
14#define LIBBB_BANNER "BusyBox's library v" BB_VER " (" BB_EXTRA_VERSION ")" 14#define BANNER "BusyBox v" BB_VER " (" BB_EXTRA_VERSION ")"
15#endif 15#endif
16 const char * const libbb_msg_full_version = LIBBB_BANNER; 16const char BB_BANNER[]=BANNER;
17const char * const bb_msg_full_version = BANNER " multi-call binary";
17#endif 18#endif
19
18#ifdef L_memory_exhausted 20#ifdef L_memory_exhausted
19 const char * const bb_msg_memory_exhausted = "memory exhausted"; 21 const char * const bb_msg_memory_exhausted = "memory exhausted";
20#endif 22#endif
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index cfb1c29ac..4d81fdc28 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -208,7 +208,7 @@ pid_t spawn(char **argv)
208{ 208{
209 static int failed; 209 static int failed;
210 pid_t pid; 210 pid_t pid;
211 void *app = find_applet_by_name(argv[0]); 211 void *app = ENABLE_FEATURE_SH_STANDALONE_SHELL ? find_applet_by_name(argv[0]) : 0;
212 212
213 // Be nice to nommu machines. 213 // Be nice to nommu machines.
214 failed = 0; 214 failed = 0;
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 614eb2f6b..e09275e11 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -59,6 +59,7 @@
59 */ 59 */
60 60
61#include "busybox.h" 61#include "busybox.h"
62#include <libgen.h>
62#include <sys/utsname.h> 63#include <sys/utsname.h>
63 64
64#if !defined(CONFIG_FEATURE_2_4_MODULES) && \ 65#if !defined(CONFIG_FEATURE_2_4_MODULES) && \
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
5if [ $# -eq 0 ]
6then
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
5rm -rf build 10rm -rf build
@@ -23,30 +28,62 @@ cd archival/libunarchive
23make 28make
24cd ../.. 29cd ../..
25 30
31# And again
32
33cd coreutils/libcoreutils
34make
35cd ../..
36
37# Sensing a pattern here?
38
39#cd networking/libiproute
40#make
41#cd ../..
42
43fi
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
32function extra_libraries() 51function 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
59function 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
51strange_names=`sed -rn -e 's/\#.*//' -e 's/.*APPLET_NOUSAGE\(([^,]*),([^,]*),.*/\1 \2/p' -e 's/.*APPLET_ODDNAME\(([^,]*),([^,]*),.*, *([^)]*).*/\1 \2@\3/p' include/applets.h` 88strange_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
73for APPLET in `sed 's .*/ ' busybox.links` 110# Iterate through every name in busybox.links
74do 111
75 export APPLET 112function 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
96done 136}
137
138if [ $# -eq 0 ]
139then
140 for APPLET in `sed 's .*/ ' busybox.links`
141 do
142 buildit "$APPLET"
143 done
144else
145 buildit "$1"
146fi
147
97 148
98strip build/* 149strip build/*