Am 07.01.2014 14:09, schrieb Denys Vlasenko:
> On Tue, Jan 7, 2014 at 1:43 AM, Matthias Andree <[email protected]> wrote:
>> FreeBSD/HEAD fails to build busybox 1.22.0, because busybox's
>> strchrnul() declaration is in conflict with FreeBSD's; sources at
>> <http://svnweb.freebsd.org/base/head/include/string.h?annotate=246803#l75>.
>>
>> There is, unfortunately, no exact version tag that you can test against,
>> but on FreeBSD, you might use:
>>
>> // sys/param.h is system-specific
>> #include <sys/param.h>
>> #if __FreeBSD_version < 1000029
>> // declare strchrnul
>> #endif
>>
>> Please fix busybox to not declare strchrnul if the system provides it.
> 
> Does attached patch work for you?
> 

It's not complete.  I am attaching my complete series of patches from
the FreeBSD port.  Please consider them for inclusion.

EXCEPT the patch for include_libbb.h - I think that would require #ifdef
__FreeBSD__ or similar.

I also run these in-place-editing sed commands routinely before the
build to replace obsolescent headers by modern equivalents:

/usr/bin/sed -i.bak -e 's/<malloc.h>/<stdlib.h>/'  \
        busybox-1.22.0/libbb/appletlib.c  busybox-1.22.0/shell/hush.c

/usr/bin/sed -i.bak -e 's/<alloca.h>/<stdlib.h>/'  \
        busybox-1.22.0/scripts/basic/*.c

Please consider modifying the sources accordingly.


The platform patch splits FreeBSD out from the other BSDs because it has
quite a few features that were listed as missing, and recent versions
are reasonably POSIX2008 compliant, too. strchrnul is the only #if
__FreeBSD_version we need to check currently.

The other patches fix missing prototype issues, usually a missing
#include <libgen.h>, or widening types sufficiently for the baudrate
tables - FreeBSD defines all baudrate constants to the actual baudrate,
so they do not fit into a short, starting with 38400 and stepping upwards.

HTH
Matthias
--- ./archival/unzip.c.orig	2014-01-01 00:45:23.000000000 +0100
+++ ./archival/unzip.c	2014-01-08 00:00:07.000000000 +0100
@@ -45,6 +45,8 @@
 #include "libbb.h"
 #include "bb_archive.h"
 
+#include <libgen.h>
+
 enum {
 #if BB_BIG_ENDIAN
 	ZIP_FILEHEADER_MAGIC = 0x504b0304,
--- ./coreutils/cp.c.orig	2012-06-26 13:35:45.000000000 +0000
+++ ./coreutils/cp.c	2012-07-17 02:08:37.000000000 +0000
@@ -35,6 +35,8 @@
 #include "libbb.h"
 #include "libcoreutils/coreutils.h"
 
+#include <libgen.h>
+
 /* This is a NOEXEC applet. Be very careful! */
 
 int cp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
--- ./coreutils/dirname.c.orig	2012-06-26 13:35:45.000000000 +0000
+++ ./coreutils/dirname.c	2012-07-17 02:08:37.000000000 +0000
@@ -23,6 +23,8 @@
 
 #include "libbb.h"
 
+#include <libgen.h>
+
 /* This is a NOFORK applet. Be very careful! */
 
 int dirname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
--- ./coreutils/install.c.orig	2012-06-26 13:35:45.000000000 +0000
+++ ./coreutils/install.c	2012-07-17 02:08:37.000000000 +0000
@@ -26,6 +26,8 @@
 #include "libbb.h"
 #include "libcoreutils/coreutils.h"
 
+#include <libgen.h>
+
 #if ENABLE_FEATURE_INSTALL_LONG_OPTIONS
 static const char install_longopts[] ALIGN1 =
 	"directory\0"           No_argument       "d"
--- ./coreutils/rmdir.c.orig	2012-07-02 14:08:25.000000000 +0000
+++ ./coreutils/rmdir.c	2012-07-17 02:08:37.000000000 +0000
@@ -27,6 +27,8 @@
 
 #include "libbb.h"
 
+#include <libgen.h>
+
 /* This is a NOFORK applet. Be very careful! */
 
 
--- ./include/libbb.h.orig	2012-07-02 14:08:25.000000000 +0000
+++ ./include/libbb.h	2012-07-17 02:08:37.000000000 +0000
@@ -51,6 +51,9 @@
 #include <termios.h>
 #include <time.h>
 #include <sys/param.h>
+#ifndef HAVE_XTABS
+# define XTABS OXTABS
+#endif
 #include <pwd.h>
 #include <grp.h>
 #if ENABLE_FEATURE_SHADOWPASSWDS
@@ -129,9 +132,6 @@
 #ifndef HAVE_FDATASYNC
 # define fdatasync fsync
 #endif
-#ifndef HAVE_XTABS
-# define XTABS TAB3
-#endif
 
 
 /* Some libc's forget to declare these, do it ourself */
--- ./include/platform.h.orig	2014-01-01 00:45:23.000000000 +0100
+++ ./include/platform.h	2014-01-08 00:06:24.000000000 +0100
@@ -385,10 +385,6 @@
 # undef HAVE_STRVERSCMP
 #endif
 
-#if defined(__dietlibc__)
-# undef HAVE_STRCHRNUL
-#endif
-
 #if defined(__WATCOMC__)
 # undef HAVE_DPRINTF
 # undef HAVE_GETLINE
@@ -419,7 +415,7 @@
 /* These BSD-derived OSes share many similarities */
 #if (defined __digital__ && defined __unix__) \
  || defined __APPLE__ \
- || defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__
+ || defined __OpenBSD__ || defined __NetBSD__
 # undef HAVE_CLEARENV
 # undef HAVE_FDATASYNC
 # undef HAVE_GETLINE
@@ -434,10 +430,26 @@
 # undef HAVE_UNLOCKED_LINE_OPS
 #endif
 
-#if defined(__FreeBSD__) || defined(__APPLE__)
+#if defined(__dietlibc__)
 # undef HAVE_STRCHRNUL
 #endif
 
+#if defined __FreeBSD__
+# undef HAVE_CLEARENV
+# undef HAVE_FDATASYNC
+# undef HAVE_MNTENT_H
+# undef HAVE_PTSNAME_R
+# undef HAVE_SYS_STATFS_H
+# undef HAVE_SIGHANDLER_T
+# undef HAVE_STRVERSCMP
+# undef HAVE_XTABS
+# undef HAVE_UNLOCKED_LINE_OPS
+# include <osreldate.h>
+# if __FreeBSD_version < 1000029
+#  undef HAVE_STRCHRNUL /* FreeBSD added strchrnul() between 1000028 and 1000029 */
+# endif
+#endif
+
 #if defined(__NetBSD__)
 # define HAVE_GETLINE 1  /* Recent NetBSD versions have getline() */
 #endif
--- ./libbb/speed_table.c.orig	2012-06-26 13:35:45.000000000 +0000
+++ ./libbb/speed_table.c	2012-07-17 02:08:37.000000000 +0000
@@ -10,7 +10,7 @@
 #include "libbb.h"
 
 struct speed_map {
-	unsigned short speed;
+	unsigned int speed;
 	unsigned short value;
 };
 
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to