From 25a26142c09343d39a4ec5a0673390950f63a505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Wed, 3 Jul 2013 12:56:21 +0000 Subject: main/busybox: crosscompile and musl support --- main/busybox/APKBUILD | 13 ++++++- main/busybox/busybox-musl-fixes.patch | 64 +++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 main/busybox/busybox-musl-fixes.patch (limited to 'main/busybox') diff --git a/main/busybox/APKBUILD b/main/busybox/APKBUILD index 743a5632f..c4727c0a9 100644 --- a/main/busybox/APKBUILD +++ b/main/busybox/APKBUILD @@ -18,6 +18,7 @@ source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2 busybox-uname-is-not-gnu.patch bb-app-location.patch loginutils-sha512.patch + busybox-musl-fixes.patch 0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch 0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch @@ -45,13 +46,17 @@ prepare() { build() { # build bbsuid msg "Building bbsuid" - ${CC:-gcc} $CFLAGS "$srcdir"/bbsuid.c $LDFLAGS -o "$_dyndir"/bbsuid || return 1 + ${CC:-${CROSS_COMPILE}-gcc} ${CFLAGS} ${LDFLAGS} "$srcdir"/bbsuid.c -o "$_dyndir"/bbsuid || return 1 cd "$_staticdir" msg "Building static busybox" sed -e "s/.*CONFIG_PIE.*/\# CONFIG_PIE is not set/" \ -e "s/.*CONFIG_STATIC.*/CONFIG_STATIC=y/" \ "$_config" > .config + # musl does not support GNU regex + [ "${CTARGET#*musl}" != "$CTARGET" ] && sed -i \ + -e "s/CONFIG_EXTRA_COMPAT=y/CONFIG_EXTRA_COMPAT=n/" \ + .config make -C "$_sdir" O="$PWD" silentoldconfig || return 1 make || return 1 mv busybox busybox.static @@ -60,6 +65,9 @@ build() { cd "$_dyndir" msg "Building dynamic busybox" cp "$_config" .config + [ "${CTARGET#*musl}" != "$CTARGET" ] && sed -i \ + -e "s/CONFIG_EXTRA_COMPAT=y/CONFIG_EXTRA_COMPAT=n/" \ + .config make -C "$_sdir" O="$PWD" silentoldconfig || return 1 make || return 1 } @@ -99,6 +107,7 @@ d64b58a30892c558bdbab7f0d0997577 nologin.c b5375210f13fd6e1ca61a565e8fabd35 busybox-uname-is-not-gnu.patch c5a8dbc8696db6da9c4624b0e11d8fba bb-app-location.patch 8c42c9ef0f0419c314c86bcaf7796106 loginutils-sha512.patch +f718d6d53b6cd1e012edcee32686a846 busybox-musl-fixes.patch 04eeda8c49d4688e6dec02451f8b6aae 0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch e1c183cbe1ca18a0fa0d9597314076c9 0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch b4e7c47c05c1fdaee0a418731e1d1135 busyboxconfig @@ -110,6 +119,7 @@ sha256sums="cd5be0912ec856110ae12c76c3ec9cd5cba1df45b5a9da2b095b8284d1481303 bu a31ce8bcb8b81b20e80ffa407600a530d085806c6471f4e4249fcb3a491b79ef busybox-uname-is-not-gnu.patch 576366b4d50f1078da6c0364ef70415de92d97c93c64f4d790b11d7a34cdccd2 bb-app-location.patch 57674b20158c0b266ed028b0c65299f9cbcad7d33d19c9fcc403d3967daba493 loginutils-sha512.patch +06e0804532b1253019061078c3cd0a46cba74cb8a32a2d3f80cec23e04fa0386 busybox-musl-fixes.patch 2e9d56335ca39e944b9abd9ecc91d0e47a3fe3434f8b7ec3f526bc8fa0895ada 0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch 53563c6dc4db13004d0b37f7bf1748e861b5a5c4244c1d34f102c23b689420c5 0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch 7774d71ddab017c4e436bc575637bd54e3936a7e82574756afced8e1e0077c57 busyboxconfig @@ -121,6 +131,7 @@ eb7cce973bfd53ce3350713437b9e2751becfb8dfb10b14f27c4f812297c403b90f80dc2906179d4 225c0608972f7daaca672eafdf647eea392e076537287370ca7791931de4803645d4d159385dc2909314028dccba3c64d0c89fa4e1184f856959b17c58459ed1 busybox-uname-is-not-gnu.patch 5c42b05be69c834c9fd5372c6b0d55a6399c74146a94ea09eae7285dd4fa75d1bde38bf7ab73e98638f65eb72db02115453cbdfe85a0085d742940366f617c7d bb-app-location.patch 69af4800fcf765b4ae029daced7ff171b6b04d810c94a987c7ba848e275a27b77b18b38df1b85f4a12c4a47ed42f62e0768260eb1198e2aff1c3cea898b85c61 loginutils-sha512.patch +eed527c8cab79347ed786929c36da76028bf9592a4f047706c3ce14bc96787fc7e685441eca14006eab88b0b8d5ed939116daea95110fa0f87f8b94b1f5e9673 busybox-musl-fixes.patch f2ed7bf994766a20ceecb28bea8c66307b6b66cdd7099408b1f29a529786ce07e55824b21256321708663e00d6fe9428480b0d3e121b67d6ebd8a8a87b1486d1 0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch b1a1cc2ada657a3d3364c8c96853575d73784e769cd8768c170c27a3e59abd2beace75dff6d5047c4391725e961d93149f9c3f45ed75fb1c582bf18b818282c9 0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch 373b23c3a0db5353dc19bc1f758ec1ebaec82a05f99ac1ab839b95c94e6214f1c252b6b39fcd56cd5f0e0b3bd6c32bd9dde72a4afa5be49c49b6bc9190a8776f busyboxconfig diff --git a/main/busybox/busybox-musl-fixes.patch b/main/busybox/busybox-musl-fixes.patch new file mode 100644 index 000000000..36410ff32 --- /dev/null +++ b/main/busybox/busybox-musl-fixes.patch @@ -0,0 +1,64 @@ +diff -Naur busybox-1.19.3-old/include/platform.h busybox-1.19.3/include/platform.h +--- busybox-1.19.3-old/include/platform.h 2011-10-29 05:43:01.000000000 -0600 ++++ busybox-1.19.3/include/platform.h 2011-12-18 15:53:49.817278374 -0700 +@@ -443,6 +443,13 @@ + # undef HAVE_NET_ETHERNET_H + #endif + ++#if defined(__musl__) ++# undef HAVE_SETBIT ++# include ++# include ++# include ++#endif ++ + /* + * Now, define prototypes for all the functions defined in platform.c + * These must come after all the HAVE_* macros are defined (or not) +diff -Naur busybox-1.19.3-old/miscutils/man.c busybox-1.19.3/miscutils/man.c +--- busybox-1.19.3-old/miscutils/man.c 2011-09-05 20:35:17.000000000 -0600 ++++ busybox-1.19.3/miscutils/man.c 2011-12-18 15:53:49.817278374 -0700 +@@ -116,7 +116,7 @@ + /* "2>&1" is added so that nroff errors are shown in pager too. + * Otherwise it may show just empty screen */ + cmd = xasprintf( +- man ? "gtbl | nroff -Tlatin1 -mandoc 2>&1 | %s" ++ man ? "nroff -Tutf -man 2>&1 | %s" + : "%s", + pager); + system(cmd); +diff -Naur busybox-1.19.3-old/networking/ifconfig.c busybox-1.19.3/networking/ifconfig.c +--- busybox-1.19.3-old/networking/ifconfig.c 2011-09-05 20:35:17.000000000 -0600 ++++ busybox-1.19.3/networking/ifconfig.c 2011-12-18 15:53:49.817278374 -0700 +@@ -56,7 +56,7 @@ + #endif + + #if ENABLE_FEATURE_IFCONFIG_SLIP +-# include ++# include + #endif + + /* I don't know if this is needed for busybox or not. Anyone? */ +diff -Naur busybox-1.19.3-old/networking/libiproute/iplink.c busybox-1.19.3/networking/libiproute/iplink.c +--- busybox-1.19.3-old/networking/libiproute/iplink.c 2011-09-05 20:35:17.000000000 -0600 ++++ busybox-1.19.3/networking/libiproute/iplink.c 2011-12-18 15:53:49.821278291 -0700 +@@ -5,7 +5,6 @@ + * Licensed under GPLv2 or later, see file LICENSE in this source tree. + */ + #include +-#include + #include + #include + +diff -Naur busybox-1.19.3-old/util-linux/fdisk.c busybox-1.19.3/util-linux/fdisk.c +--- busybox-1.19.3-old/util-linux/fdisk.c 2011-09-05 20:35:17.000000000 -0600 ++++ busybox-1.19.3/util-linux/fdisk.c 2011-12-18 15:53:49.821278291 -0700 +@@ -550,7 +550,7 @@ + { + #if ENABLE_FDISK_SUPPORT_LARGE_DISKS + off64_t off = (off64_t)secno * sector_size; +- if (lseek64(dev_fd, off, SEEK_SET) == (off64_t) -1) ++ if (lseek(dev_fd, off, SEEK_SET) == (off64_t) -1) + fdisk_fatal(unable_to_seek); + #else + uint64_t off = (uint64_t)secno * sector_size; -- cgit v1.2.3