wok-6.x rev 14748

busybox: add musl & dietlibc patchs
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Jun 16 15:26:17 2013 +0200 (2013-06-16)
parents 92f66e45cea7
children ff4ffc2d8c7a
files busybox/receipt busybox/stuff/busybox-1.21-diet.u busybox/stuff/busybox-1.21-musl.u
line diff
     1.1 --- a/busybox/receipt	Sat Jun 15 15:28:50 2013 +0200
     1.2 +++ b/busybox/receipt	Sun Jun 16 15:26:17 2013 +0200
     1.3 @@ -12,7 +12,8 @@
     1.4  HOST_ARCH="i486 arm"
     1.5  
     1.6  DEPENDS="slitaz-base-files glibc-base ncurses-common"
     1.7 -BUILD_DEPENDS="bzip2 pam pam-dev uclibc-cross-compiler-i486"
     1.8 +BUILD_DEPENDS="bzip2 pam pam-dev uclibc-cross-compiler-i486 \
     1.9 +musl-libc-dev dietlibc"
    1.10  
    1.11  CONFIG_FILES="/etc/dnsd.conf /etc/inetd.conf /etc/udhcpd.conf \
    1.12  /etc/resolv.conf /etc/httpd.conf"
    1.13 @@ -42,6 +43,8 @@
    1.14  diff.u
    1.15  nfs-segfault.u
    1.16  xz.u
    1.17 +musl.u
    1.18 +diet.u
    1.19  EOT
    1.20      cp $stuff/$PACKAGE-${VERSION%.*}.config .config
    1.21  }
    1.22 @@ -72,9 +75,28 @@
    1.23  		    mv busybox busybox-pam
    1.24  
    1.25  		    # prepare busybox-static package
    1.26 -		    cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
    1.27 -		    make oldconfig && make || return 1
    1.28 -		    mv busybox busybox-static
    1.29 +		    if [ -x /usr/bin/uclibc-i486-gcc ]; then
    1.30 +			cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
    1.31 +			make oldconfig && make || return 1
    1.32 +			cp busybox busybox-static
    1.33 +			mv busybox busybox-uclibc
    1.34 +		    fi
    1.35 +
    1.36 +		    if [ -x /usr/bin/musl-gcc ]; then
    1.37 +			# prepare busybox-musl package
    1.38 +			cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
    1.39 +			sed -i 's|uclibc-i486-||;s|CFLAGS="|&-D__musl__ |' .config
    1.40 +			make oldconfig && make CC=musl-gcc || return 1
    1.41 +			mv busybox busybox-musl
    1.42 +		    fi
    1.43 +
    1.44 +		    if [ -x /usr/lib/diet/bin/diet ]; then
    1.45 +			# prepare busybox-diet package
    1.46 +			cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
    1.47 +			sed -i 's|uclibc-i486-||;s|CFLAGS="|&-D_BSD_SOURCE |;s|LDFLAGS="|&-Wl,--allow-multiple-definition |;s|LDLIBS="|&compat rpc |' .config
    1.48 +			make oldconfig && make CC="/usr/lib/diet/bin/diet -Os gcc" || return 1
    1.49 +			mv busybox busybox-diet
    1.50 +		    fi
    1.51  
    1.52  		    # prepare ssfs-busybox package
    1.53  		    rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/busybox/stuff/busybox-1.21-diet.u	Sun Jun 16 15:26:17 2013 +0200
     2.3 @@ -0,0 +1,110 @@
     2.4 +--- busybox-1.21.0/include/platform.h
     2.5 ++++ busybox-1.21.0/include/platform.h
     2.6 +@@ -460,6 +460,20 @@
     2.7 + # include <sys/ioctl.h>
     2.8 + #endif
     2.9 + 
    2.10 ++#if defined(__dietlibc__)
    2.11 ++# define __aligned_u64 __u64 __attribute__((aligned(8)))
    2.12 ++# define LOOP_SET_STATUS64	0x4C04
    2.13 ++# define LOOP_GET_STATUS64	0x4C05
    2.14 ++# define MAXSYMLINKS	20
    2.15 ++# define S_TYPEISMQ(x)	0
    2.16 ++# define S_TYPEISSEM(x)	0
    2.17 ++# define S_TYPEISSHM(x)	0
    2.18 ++# undef HAVE_STRVERSCMP
    2.19 ++# undef HAVE_DPRINTF
    2.20 ++# undef HAVE_STRCASESTR
    2.21 ++# define ttyname_r(a,b,c)	(strlcpy(b, ttyname(a), c) == 0)
    2.22 ++#endif
    2.23 ++ 
    2.24 + /*
    2.25 +  * Now, define prototypes for all the functions defined in platform.c
    2.26 +  * These must come after all the HAVE_* macros are defined (or not)
    2.27 +--- busybox-1.21.0/networking/ping.c
    2.28 ++++ busybox-1.21.0/networking/ping.c
    2.29 +@@ -29,6 +29,84 @@
    2.30 + #include <netinet/ip_icmp.h>
    2.31 + #include "libbb.h"
    2.32 + 
    2.33 ++#ifdef __dietlibc__
    2.34 ++/* Dietlibc is missing the BSD definition 'struct icmp' */
    2.35 ++/*
    2.36 ++ * Internal of an ICMP Router Advertisement
    2.37 ++ */
    2.38 ++struct icmp_ra_addr
    2.39 ++{
    2.40 ++    uint32_t ira_addr;
    2.41 ++    uint32_t ira_preference;
    2.42 ++};
    2.43 ++
    2.44 ++struct icmp
    2.45 ++{
    2.46 ++    uint8_t  icmp_type;  /* type of message, see below */
    2.47 ++    uint8_t  icmp_code;  /* type sub code */
    2.48 ++    uint16_t icmp_cksum; /* ones complement checksum of struct */
    2.49 ++    union
    2.50 ++    {
    2.51 ++	uint8_t ih_pptr;             /* ICMP_PARAMPROB */
    2.52 ++	struct in_addr ih_gwaddr;   /* gateway address */
    2.53 ++	struct ih_idseq             /* echo datagram */
    2.54 ++	{
    2.55 ++	    uint16_t icd_id;
    2.56 ++	    uint16_t icd_seq;
    2.57 ++	} ih_idseq;
    2.58 ++	uint32_t ih_void;
    2.59 ++
    2.60 ++	/* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
    2.61 ++	struct ih_pmtu
    2.62 ++	{
    2.63 ++	    uint16_t ipm_void;
    2.64 ++	    uint16_t ipm_nextmtu;
    2.65 ++	} ih_pmtu;
    2.66 ++
    2.67 ++	struct ih_rtradv
    2.68 ++	{
    2.69 ++	    uint8_t irt_num_addrs;
    2.70 ++	    uint8_t irt_wpa;
    2.71 ++	    uint16_t irt_lifetime;
    2.72 ++	} ih_rtradv;
    2.73 ++    } icmp_hun;
    2.74 ++#define icmp_pptr       icmp_hun.ih_pptr
    2.75 ++#define icmp_gwaddr     icmp_hun.ih_gwaddr
    2.76 ++#define icmp_id         icmp_hun.ih_idseq.icd_id
    2.77 ++#define icmp_seq        icmp_hun.ih_idseq.icd_seq
    2.78 ++#define icmp_void       icmp_hun.ih_void
    2.79 ++#define icmp_pmvoid     icmp_hun.ih_pmtu.ipm_void
    2.80 ++#define icmp_nextmtu    icmp_hun.ih_pmtu.ipm_nextmtu
    2.81 ++#define icmp_num_addrs  icmp_hun.ih_rtradv.irt_num_addrs
    2.82 ++#define icmp_wpa        icmp_hun.ih_rtradv.irt_wpa
    2.83 ++#define icmp_lifetime   icmp_hun.ih_rtradv.irt_lifetime
    2.84 ++    union
    2.85 ++    {
    2.86 ++	struct
    2.87 ++	{
    2.88 ++	    uint32_t its_otime;
    2.89 ++	    uint32_t its_rtime;
    2.90 ++	    uint32_t its_ttime;
    2.91 ++	} id_ts;
    2.92 ++	struct
    2.93 ++	{
    2.94 ++	    struct ip idi_ip;
    2.95 ++	    /* options and then 64 bits of data */
    2.96 ++	} id_ip;
    2.97 ++	struct icmp_ra_addr id_radv;
    2.98 ++	uint32_t   id_mask;
    2.99 ++	uint8_t    id_data[1];
   2.100 ++    } icmp_dun;
   2.101 ++#define icmp_otime      icmp_dun.id_ts.its_otime
   2.102 ++#define icmp_rtime      icmp_dun.id_ts.its_rtime
   2.103 ++#define icmp_ttime      icmp_dun.id_ts.its_ttime
   2.104 ++#define icmp_ip         icmp_dun.id_ip.idi_ip
   2.105 ++#define icmp_radv       icmp_dun.id_radv
   2.106 ++#define icmp_mask       icmp_dun.id_mask
   2.107 ++#define icmp_data       icmp_dun.id_data
   2.108 ++};
   2.109 ++#endif /* __dietlibc__ */
   2.110 ++ 
   2.111 + #ifdef __BIONIC__
   2.112 + /* should be in netinet/ip_icmp.h */
   2.113 + # define ICMP_DEST_UNREACH    3  /* Destination Unreachable  */
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/busybox/stuff/busybox-1.21-musl.u	Sun Jun 16 15:26:17 2013 +0200
     3.3 @@ -0,0 +1,40 @@
     3.4 +--- busybox-1.21.0/include/platform.h
     3.5 ++++ busybox-1.21.0/include/platform.h
     3.6 +@@ -453,6 +453,13 @@
     3.7 + # undef HAVE_NET_ETHERNET_H
     3.8 + #endif
     3.9 + 
    3.10 ++#if defined(__musl__)
    3.11 ++# undef HAVE_SETBIT
    3.12 ++# include <stddef.h>
    3.13 ++# include <termios.h>
    3.14 ++# include <sys/ioctl.h>
    3.15 ++#endif
    3.16 ++
    3.17 + /*
    3.18 +  * Now, define prototypes for all the functions defined in platform.c
    3.19 +  * These must come after all the HAVE_* macros are defined (or not)
    3.20 +--- busybox-1.21.0/include/libbb.h
    3.21 ++++ busybox-1.21.0/include/libbb.h
    3.22 +@@ -210,6 +210,13 @@
    3.23 +  * (in today's world - signed 64bit). For full support of large files,
    3.24 +  * we need a few helper #defines (below) and careful use of off_t
    3.25 +  * instead of int/ssize_t. No lseek64(), O_LARGEFILE etc necessary */
    3.26 ++#if defined(__musl__)
    3.27 ++typedef unsigned long long uoff_t;
    3.28 ++#  define XATOOFF(a) xatoull_range((a), 0, LLONG_MAX)
    3.29 ++#  define BB_STRTOOFF bb_strtoull
    3.30 ++#  define STRTOOFF strtoull
    3.31 ++#  define OFF_FMT "ll"
    3.32 ++#else
    3.33 + #if ENABLE_LFS
    3.34 + /* CONFIG_LFS is on */
    3.35 + # if ULONG_MAX > 0xffffffff
    3.36 +@@ -246,6 +253,7 @@
    3.37 + #  define STRTOOFF strtol
    3.38 + #  define OFF_FMT "l"
    3.39 + # endif
    3.40 ++#endif
    3.41 + #endif
    3.42 + /* scary. better ideas? (but do *test* them first!) */
    3.43 + #define OFF_T_MAX  ((off_t)~((off_t)1 << (sizeof(off_t)*8-1)))