[BusyBox] more patches

Larry Doolittle ldoolitt at recycle.lbl.gov
Sat Apr 17 23:38:37 UTC 2004


Here is the patch set that has resulted from my recent hacking
on busybox-1.00-pre10.  Please study, test, and consider including
them in -pre11.
    - Larry

Makefile, scripts/config/Makefile: change TOPDIR assignment from = to :=,
  to match all the other Makefiles.
Makefile: add VPATH=$(TOPDIR)
Makefile: use $(TOPDIR) when figuring what Makefile.in files to include
miscutils/adjtimex.c: add some const qualifiers, now passes -Wwrite-strings
miscutils/strings.c: get rid of useless pointer dereference in
  third part of for(;;)
Rules.mak: get rid of obsolete and unused BB_SRC_DIR
pristine-setup: new file that might eventually work

diff -urN foo/Makefile busybox-1.00-pre10-hacked/Makefile
--- foo/Makefile	2004-04-06 08:26:25.000000000 -0700
+++ busybox-1.00-pre10-hacked/Makefile	2004-04-16 16:14:46.000000000 -0700
@@ -23,8 +23,9 @@
 noconfig_targets := menuconfig config oldconfig randconfig \
 	defconfig allyesconfig allnoconfig clean distclean \
 	release tags
-TOPDIR=./
-include Rules.mak
+TOPDIR:=./
+VPATH=$(TOPDIR)
+include $(TOPDIR)Rules.mak
 
 DIRS:=applets archival archival/libunarchive coreutils console-tools \
 	debianutils editors findutils init miscutils modutils networking \
@@ -45,7 +46,7 @@
 
 # In this section, we need .config
 -include .config.cmd
-include $(patsubst %,%/Makefile.in, $(DIRS))
+include $(patsubst %,$(TOPDIR)%/Makefile.in, $(DIRS))
 -include $(TOPDIR).depend
 
 busybox: .depend include/config.h $(libraries-y)
diff -urN foo/miscutils/adjtimex.c busybox-1.00-pre10-hacked/miscutils/adjtimex.c
--- foo/miscutils/adjtimex.c	2004-03-15 00:28:46.000000000 -0800
+++ busybox-1.00-pre10-hacked/miscutils/adjtimex.c	2004-04-14 20:50:27.000000000 -0700
@@ -47,7 +47,7 @@
 #include <sys/timex.h>
 #include "busybox.h"
 
-static struct {int bit; char *name;} statlist[] = {
+static struct {int bit; const char *name;} statlist[] = {
 	{ STA_PLL,       "PLL"       },
 	{ STA_PPSFREQ,   "PPSFREQ"   },
 	{ STA_PPSTIME,   "PPSTIME"   },
@@ -63,7 +63,7 @@
 	{ STA_CLOCKERR,  "CLOCKERR"  },
 	{ 0, NULL } };
 
-static char *ret_code_descript[] = {
+static const char *ret_code_descript[] = {
 	"clock synchronized",
 	"insert leap second",
 	"delete leap second",
@@ -88,7 +88,7 @@
 	struct timex txc;
 	int quiet=0;
 	int c, i, ret, sep;
-	char *descript;
+	const char *descript;
 	txc.modes=0;
 	for (;;) {
 		c = getopt( argc, argv, "qo:f:p:t:");
diff -urN foo/miscutils/strings.c busybox-1.00-pre10-hacked/miscutils/strings.c
--- foo/miscutils/strings.c	2004-03-15 00:28:46.000000000 -0800
+++ busybox-1.00-pre10-hacked/miscutils/strings.c	2004-04-14 20:50:27.000000000 -0700
@@ -77,7 +77,7 @@
 		goto pipe;
 	}
 
-	for(  ;*argv!=NULL;*argv++)
+	for(  ;*argv!=NULL;argv++)
 	{
 		if((file=bb_wfopen(*argv,"r")))
 		{
diff -urN foo/pristine-setup busybox-1.00-pre10-hacked/pristine-setup
--- foo/pristine-setup	1969-12-31 16:00:00.000000000 -0800
+++ busybox-1.00-pre10-hacked/pristine-setup	2004-04-16 07:50:22.000000000 -0700
@@ -0,0 +1,17 @@
+#!/bin/sh
+if [ -e pristine-setup ]; then
+    echo "Don't use pristine-setup from the Busybox source directory."
+    echo "cd to your working directory and run it from there."
+    exit 1
+fi
+srcdir=${0%/pristine-setup}
+case $srcdir in
+    /*) ;;
+    *) srcdir=$PWD/$srcdir ;;
+esac
+echo "Busybox pristine source directory is $srcdir"
+for f in `cd $srcdir; find . -name Makefile`; do
+    # echo $f
+    mkdir -p ${f%Makefile}
+    sed -e 's,^TOPDIR:=.*,TOPDIR:='$srcdir'/,' <$srcdir/$f >$f
+done
diff -urN foo/Rules.mak busybox-1.00-pre10-hacked/Rules.mak
--- foo/Rules.mak	2004-04-13 12:38:17.000000000 -0700
+++ busybox-1.00-pre10-hacked/Rules.mak	2004-04-15 17:00:39.000000000 -0700
@@ -27,7 +27,7 @@
 # With a modern GNU make(1) (highly recommended, that's what all the
 # developers use), all of the following configuration values can be
 # overridden at the command line.  For example:
-#   make CROSS=powerpc-linux- BB_SRC_DIR=$HOME/busybox PREFIX=/mnt/app
+#   make CROSS=powerpc-linux- PREFIX=/mnt/app
 #--------------------------------------------------------
 
 # If you are running a cross compiler, you will want to set 'CROSS'
@@ -60,11 +60,6 @@
 # For optimization overrides, it's better still to set OPTIMIZATION.
 CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS)))
 
-# If you have a "pristine" source directory, point BB_SRC_DIR to it.
-# Experimental and incomplete; tell the mailing list
-# <busybox at busybox.net> if you do or don't like it so far.
-BB_SRC_DIR=
-
 # To compile vs some other alternative libc, you may need to use/adjust
 # the following lines to meet your needs...
 #
diff -urN foo/scripts/config/Makefile busybox-1.00-pre10-hacked/scripts/config/Makefile
--- foo/scripts/config/Makefile	2004-03-15 00:29:08.000000000 -0800
+++ busybox-1.00-pre10-hacked/scripts/config/Makefile	2004-04-16 07:47:12.000000000 -0700
@@ -2,7 +2,7 @@
 #
 # Copyright (C) 2002 Erik Andersen <andersen at codepoet.org>
 
-TOPDIR=../../
+TOPDIR:=../../
 include $(TOPDIR)Rules.mak
 
 all: ncurses conf mconf



More information about the busybox mailing list