svn commit: trunk/busybox: applets scripts

Rob Landley rob at landley.net
Wed Aug 16 17:45:17 UTC 2006


On Tuesday 15 August 2006 10:07 am, Bernhard Fischer wrote:
> On Fri, Aug 04, 2006 at 02:05:33PM -0700, landley at busybox.net wrote:
> >Author: landley
> >Date: 2006-08-04 14:05:33 -0700 (Fri, 04 Aug 2006)
> >New Revision: 15781
> >
> >Log:
> >Digging up my old "make standalone" stuff from a year ago:
> >http://busybox.net/lists/busybox/2005-September/015766.html
> >
> >I renamed it "individual" to not confuse it with the standalone shell.  
(Which
> >it isn't compatible with for obvious reasons.)  Configure busybox (I did
> >make defconfig), then run scripts/individual and it'll build an individual
> >version of each applet in the "build" subdirectory.
> >
> >Currently it builds 146 and fails to build 104 applets out of "make 
defconfig".
> >I haven't taught it about multi-file applets yet (like tar), or the ones 
where
> >two applets get built from the same source (for example, zcat is a trivial
> >variant of gunzip so there is no zcat.c).  But here's a start.
> >
> >
> >Added:
> >   trunk/busybox/applets/individual.c
> >   trunk/busybox/scripts/individual
> >
> >
> >Changeset:
> >Added: trunk/busybox/applets/individual.c
> >===================================================================
> >--- trunk/busybox/applets/individual.c	2006-08-04 20:39:56 UTC (rev 15780)
> >+++ trunk/busybox/applets/individual.c	2006-08-04 21:05:33 UTC (rev 15781)
> >@@ -0,0 +1,26 @@
> >+/* Minimal wrapper to build an individual busybox applet.
> >+ *
> >+ * Copyright 2005 Rob Landley <rob at landley.net
> 
> There is something missing here ----------------^

A year old typo. :)

> Also, according to "new-applet-HOWTO.txt" this is supposed to be of the
> form:
> * Copyright (C) [YEAR] by [YOUR NAME] <YOUR EMAIL>

The (C) has no legally binding force (it's not a complete circle) and we're 
spelling out the word "copyright" so there's no ambiguity here.  The "by" is 
optional.  Also, according to the Berne Convention the entire copyright 
notice is optional, since authors get one automatically, but it's still a 
good idea to put one to A) help identify who you have to go to if you want to 
negotiate additional rights beyond the license (not particularly relevant 
here), B) automatically establish standing to enforce said copyrights in 
court, C) identify who to ask about bug fixes (which is me anyway).

In my case, as maintainer I probably have a compliation copyright over the 
whole work for the releases I put out (as Erik had one for the ones he put 
out).  But still...

> >+ * 
> >+ * Licensed under GPLv2 or later, see file License in this tarball for 
details
> >+ */

That LICENSE should be all caps.

Alas, can't check in a fix while on the bus...

> >+void bb_show_usage(void)
> >+{
> >+	printf(APPLET_full_usage "\n");
> 
> puts?

*shrug*  If it's not statically linked, it makes no difference: one function 
call with one argument.  If it is static and the applet we're calling already 
uses printf (which is called from bb_error_msg_and_die()) but not puts, then 
printf is actually smaller.

But that could be puts(), sure.

> >+
> >+	exit(1);
> >+}
> >
> >Added: trunk/busybox/scripts/individual
> [snip]
> Sounds very brittle to me, but i haven't tried nor read it yet anyway.

Oh it's pretty deeply crappy, but improving.  The first version was indeed 
very brittle, that's why it only built 2/3 of the applets.  I've been 
teaching it about exceptions ever since.

It's not that dependent on our environment, just on the busybox source layout 
(and it needs bash to build, none of our shells support 
${varname/search/replace} yet, but bbsh will eventually).  If we break the 
busybox build so that scripts/individual regresses, I'll notice. :)

The basic design is:
  Make busybox.links (and the various libraries, like libbb.a).

  Iterate through the entries in busybox.links:
    See if this name needs an unusual gcc command line
      Does it use a C file with a different name than the applet?
      Extra stuff: libraries, more C files, etc.

    locate the C file with something like find . -name "thisapplet.c"
      (Filter out false positives from the scripts directory.)
    Call gcc to create this sucker.

It doesn't probe for compiler version or anything like that, and it's not
going to.  I'm pondering adding -funit-at-a-time as a CFLAGS thing up at the
top and just not caring about compilers that can't handle that.  There's no
dependency checking (it builds everything, and you should probably do a "make
clean" before running it although nothing specific breaks yet if you don't).

Todo:
  Get the rest of the applets to build.
    I don't care about e2fscrap or the old shells, and this is an excuse to
    fix up the udhcp directory some more.

  Just started adding dependency checking based on the checking in testing.sh

  Detect applets that should be symlinks to other applets (ala zcat->gunzip)
    This needs dependency checking, above.

  Option to use libbb.so

Oh, and if you feed it an argument, it skips parsing busybox.links and builds 
just that app.  The dependencies are horked here though, and that's pretty 
much for debugging purposes.

Rob
-- 
Never bet against the cheap plastic solution.



More information about the busybox mailing list