[PATCH] BSD portability patch
Denys Vlasenko
vda.linux at googlemail.com
Mon Aug 2 00:51:00 UTC 2010
On Friday 30 July 2010 18:08, Waldemar Brodkorb wrote:
> Hi,
>
> When cross-compiling busybox from BSD, there are some
> minor glitches, which can be resolved by this patch.
> Verfied to work on NetBSD, FreeBSD, OpenBSD and MacOS X.
>
> Thanks in advance for comments or inclusion.
>
> best regards
> Waldemar
>
> Signed-off-by: Waldemar Brodkorb <wbx at openadk.org>
> ---
> include/libbb.h | 2 ++
> include/platform.h | 20 +++++++++++++++++---
> scripts/gen_build_files.sh | 2 +-
> 3 files changed, 20 insertions(+), 4 deletions(-)
>
> diff --git a/include/libbb.h b/include/libbb.h
> index c043506..e30cb19 100644
> --- a/include/libbb.h
> +++ b/include/libbb.h
> @@ -40,6 +40,7 @@
> /* Try to pull in PATH_MAX */
> #include <limits.h>
> #include <sys/param.h>
> +#if !(defined __APPLE__ || defined BSD )
> #ifdef HAVE_MNTENT_H
> #include <mntent.h>
> #endif
You need to undefine HAVE_MNTENT_H etc in platform.h instead....
... hmm... it is already done there:
#if (defined __digital__ && defined __unix__) \
|| defined __APPLE__ || defined __FreeBSD__
# undef HAVE_MNTENT_H
# undef HAVE_SYS_STATFS_H
#else
# define HAVE_MNTENT_H 1
# define HAVE_SYS_STATFS_H 1
#endif
So, what exactly does not work for you?
> diff --git a/include/platform.h b/include/platform.h
> index 0dadf42..4496e8b 100644
> --- a/include/platform.h
> +++ b/include/platform.h
> @@ -150,18 +150,19 @@
>
> /* ---- Endian Detection ------------------------------------ */
>
> +# include <sys/param.h>
Why do you need it? And why here and not in libbb.h?
> #if defined(__digital__) && defined(__unix__)
> # include <sex.h>
> # define __BIG_ENDIAN__ (BYTE_ORDER == BIG_ENDIAN)
> # define __BYTE_ORDER BYTE_ORDER
> -#elif defined __FreeBSD__
> +#elif defined __FreeBSD__ || defined __APPLE__
> # include <sys/resource.h> /* rlimit */
> # include <machine/endian.h>
> # define bswap_64 __bswap64
> # define bswap_32 __bswap32
> # define bswap_16 __bswap16
> # define __BIG_ENDIAN__ (_BYTE_ORDER == _BIG_ENDIAN)
> -#elif !defined __APPLE__
> +#elif !defined BSD
> # include <byteswap.h>
> # include <endian.h>
> #endif
It does not look like a simple addition, you seem to affect
many platforms at once. IOW: you might be breaking more things
that you fix.
Can you add blocks _only_ for that one platform define
you are fixing instead of messing everything up?
--
vda
More information about the busybox
mailing list