busybox: new package ;)

This commit is contained in:
martell
2014-10-19 15:03:20 +01:00
parent d2c504703d
commit d9dd575190
4 changed files with 1193 additions and 0 deletions

44
busybox/PKGBUILD Normal file
View File

@@ -0,0 +1,44 @@
# Maintainer: Martell Malone <alexpux@gmail.com>
pkgname=busybox
pkgver=1.22.1
pkgrel=1
pkgdesc="BusyBox: The Swiss Army Knife of Embedded Linux"
arch=('i686' 'x86_64')
url="http://gondor.apana.org.au/~herbert/dash/"
license=('GPL2')
depends=('msys2-base' 'msys2-runtime')
groups=('base')
source=("http://busybox.net/downloads/${pkgname}-${pkgver}.tar.bz2"
"busybox-cygwin.patch"
"fixsyscalls.patch"
"msys2.config")
sha1sums=('SKIP'
'SKIP'
'SKIP'
'SKIP')
prepare() {
cd "${srcdir}/${pkgname}-${pkgver}"
patch -p1 -i ${srcdir}/busybox-cygwin.patch
patch -p1 -i ${srcdir}/fixsyscalls.patch
cp ${srcdir}/msys2.config ${srcdir}/${pkgname}-${pkgver}/.config
}
build() {
cd "${srcdir}/${pkgname}-${pkgver}"
#make oldconfig
CFLAGS='-O2 -static-libgcc' make
}
package() {
cd "${srcdir}/${pkgname}-${pkgver}"
#install busybox
mkdir -p ${pkgdir}/usr/bin
cp ${srcdir}/${pkgname}-${pkgver}/busybox.exe ${pkgdir}/usr/bin
# license
install -m644 -D LICENSE ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
}

View File

@@ -0,0 +1,106 @@
diff --git a/Makefile b/Makefile
index c58097d..3093291 100644
--- a/Makefile
+++ b/Makefile
@@ -720,7 +720,7 @@ ifeq ($(SKIP_STRIP),y)
$(Q)cp $< $@
else
$(Q)$(STRIP) -s --remove-section=.note --remove-section=.comment \
- busybox_unstripped -o $@
+ busybox_unstripped -o $@.exe
# strip is confused by PIE executable and does not set exec bits
$(Q)chmod a+x $@
endif
diff --git a/coreutils/du.c b/coreutils/du.c
index b8bbe3d..eea084c 100644
--- a/coreutils/du.c
+++ b/coreutils/du.c
@@ -94,6 +94,7 @@ static void print(unsigned long size, const char *filename)
{
/* TODO - May not want to defer error checking here. */
#if ENABLE_FEATURE_HUMAN_READABLE
+ IF_NOT_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(size *= 2;)
printf("%s\t%s\n",
/* size x 512 / G.disp_hr, show one fractional,
* use suffixes if G.disp_hr == 0 */
@@ -194,8 +195,7 @@ int du_main(int argc UNUSED_PARAM, char **argv)
unsigned opt;
#if ENABLE_FEATURE_HUMAN_READABLE
- IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_hr = 1024;)
- IF_NOT_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_hr = 512;)
+ G.disp_hr = 1024;
if (getenv("POSIXLY_CORRECT")) /* TODO - a new libbb function? */
G.disp_hr = 512;
#else
diff --git a/include/platform.h b/include/platform.h
index 60864c9..4162373 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -414,6 +414,16 @@
# undef HAVE_PTSNAME_R
# undef HAVE_STRVERSCMP
# undef HAVE_UNLOCKED_LINE_OPS
+# define MAXSYMLINKS SYMLOOP_MAX
+# define __socklen_t_defined 1
+# define sigisemptyset(x) ((x) == (sigset_t)0)
+# define stime(x) (errno=ENOSYS,-1)
+# define sethostname(x,y) (errno=ENOSYS,-1)
+# define GIO_SCRNMAP 0x4B40 /* get screen mapping from kernel */
+# define PIO_SCRNMAP 0x4B41 /* put screen mapping table in kernel */
+# define GIO_UNISCRNMAP 0x4B69 /* get full Unicode screen mapping */
+# define PIO_UNISCRNMAP 0x4B6A /* set full Unicode screen mapping */
+# define GIO_UNIMAP 0x4B66 /* get unicode-to-font mapping from kernel */
#endif
/* These BSD-derived OSes share many similarities */
diff --git a/libbb/udp_io.c b/libbb/udp_io.c
index b8fb675..a577434 100644
--- a/libbb/udp_io.c
+++ b/libbb/udp_io.c
@@ -83,7 +83,7 @@ send_to_from(int fd, void *buf, size_t len, int flags,
* and CMSG_DATA returns &u + size_t + int + int.
* Thus direct assignment is ok:
*/
- pktptr->ipi_spec_dst = ((struct sockaddr_in*)from)->sin_addr;
+// pktptr->ipi_spec_dst = ((struct sockaddr_in*)from)->sin_addr;
}
# if ENABLE_FEATURE_IPV6 && defined(IPV6_PKTINFO)
else if (to->sa_family == AF_INET6 && from->sa_family == AF_INET6) {
diff --git a/shell/cttyhack.c b/shell/cttyhack.c
index d1ac2cd..0cd0ecb 100644
--- a/shell/cttyhack.c
+++ b/shell/cttyhack.c
@@ -182,7 +182,7 @@
/* Some other session may have it as ctty,
* try to steal it from them:
*/
- ioctl(0, TIOCSCTTY, 1);
+ //ioctl(0, TIOCSCTTY, 1);
ret:
BB_EXECVP_or_die(argv);
}
diff --git a/util-linux/script.c b/util-linux/script.c
index 8fb991d..71aa527 100644
--- a/util-linux/script.c
+++ b/util-linux/script.c
@@ -195,7 +195,7 @@ int script_main(int argc UNUSED_PARAM, char **argv)
ioctl(0, TIOCSWINSZ, (char *)&win);
/* set pty as a controlling tty */
setsid();
- ioctl(0, TIOCSCTTY, 0 /* 0: don't forcibly steal */);
+// ioctl(0, TIOCSCTTY, 0 /* 0: don't forcibly steal */);
/* Non-ignored signals revert to SIG_DFL on exec anyway */
/*signal(SIGCHLD, SIG_DFL);*/
--- a/coreutils/who.c 2014-01-09 18:15:44.000000000 +0000
+++ b/coreutils/who.c 2014-10-19 13:26:21.626010400 +0100
@@ -105,7 +105,7 @@
idle_string(str6, st.st_atime);
/* manpages say ut_tv.tv_sec *is* time_t,
* but some systems have it wrong */
- seconds = ut->ut_tv.tv_sec;
+ //seconds = ut->ut_tv.tv_sec;
/* How wide time field can be?
* "Nov 10 19:33:20": 15 chars
* "2010-11-10 19:33": 16 chars

20
busybox/fixsyscalls.patch Normal file
View File

@@ -0,0 +1,20 @@
Random Notes by Martell
Not sure if I should #ifndef CYGWIN around the header,
or just move the android define up like currently
--- a/libbb/missing_syscalls.c.orig.c 2014-10-19 14:29:02.519274100 +0100
+++ a/libbb/missing_syscalls.c 2014-10-19 14:27:07.275058700 +0100
@@ -7,10 +7,11 @@
//kbuild:lib-y += missing_syscalls.o
/*#include <linux/timex.h> - for struct timex, but may collide with <time.h> */
+#if defined(ANDROID) || defined(__ANDROID__)
+
#include <sys/syscall.h>
#include "libbb.h"
-#if defined(ANDROID) || defined(__ANDROID__)
pid_t getsid(pid_t pid)
{
return syscall(__NR_getsid, pid);

1023
busybox/msys2.config Normal file

File diff suppressed because it is too large Load Diff