diff mbox series

[OpenWrt-Devel,PATCHv2] busybox: fix build with musl 1.2.0

Message ID 20200325053745.5452-1-rosenp@gmail.com
State New
Headers show
Series [OpenWrt-Devel,PATCHv2] busybox: fix build with musl 1.2.0 | expand

Commit Message

Rosen Penev March 25, 2020, 5:37 a.m. UTC
SYS_settimeofday is no longer present. That is, it's replaced with the
time32 variant. There is no time64 variant.

Note that 5a7c064bdbb71bfbcded073c7c0a8723be306009 switched the patch to
use the syscall instead of the function as musl's settimeofday does not
use the tz argument for anything.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 v2: Switched to a define for uc/glibc compatibility.
     Reworded commit message slightly.
 package/utils/busybox/Makefile                 |  2 +-
 .../busybox/patches/250-date-k-flag.patch      | 18 ++++++++++--------
 2 files changed, 11 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
index 01441d1e87..baf375eb13 100644
--- a/package/utils/busybox/Makefile
+++ b/package/utils/busybox/Makefile
@@ -9,7 +9,7 @@  include $(TOPDIR)/rules.mk
 
 PKG_NAME:=busybox
 PKG_VERSION:=1.31.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_FLAGS:=essential
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
diff --git a/package/utils/busybox/patches/250-date-k-flag.patch b/package/utils/busybox/patches/250-date-k-flag.patch
index 5aadbb233c..05be9fab8b 100644
--- a/package/utils/busybox/patches/250-date-k-flag.patch
+++ b/package/utils/busybox/patches/250-date-k-flag.patch
@@ -8,19 +8,21 @@ 
  //usage:     "\n"
  //usage:     "\nRecognized TIME formats:"
  //usage:     "\n	hh:mm[:ss]"
-@@ -139,9 +140,8 @@
+@@ -139,8 +140,11 @@
  
  #include "libbb.h"
  #include "common_bufsiz.h"
 -#if ENABLE_FEATURE_DATE_NANO
 -# include <sys/syscall.h>
--#endif
 +#include <sys/time.h>
 +#include <sys/syscall.h>
++
++#ifndef SYS_settimeofday
++#define SYS_settimeofday SYS_settimeofday_time32
+ #endif
  
  enum {
- 	OPT_RFC2822   = (1 << 0), /* R */
-@@ -149,8 +149,9 @@ enum {
+@@ -149,8 +153,9 @@ enum {
  	OPT_UTC       = (1 << 2), /* u */
  	OPT_DATE      = (1 << 3), /* d */
  	OPT_REFERENCE = (1 << 4), /* r */
@@ -32,7 +34,7 @@ 
  };
  
  #if ENABLE_LONG_OPTS
-@@ -162,6 +163,7 @@ static const char date_longopts[] ALIGN1
+@@ -162,6 +167,7 @@ static const char date_longopts[] ALIGN1 =
  	/*	"universal\0" No_argument       "u" */
  		"date\0"      Required_argument "d"
  		"reference\0" Required_argument "r"
@@ -40,7 +42,7 @@ 
  		;
  #endif
  
-@@ -181,6 +183,8 @@ static void maybe_set_utc(int opt)
+@@ -181,6 +187,8 @@ static void maybe_set_utc(int opt)
  int date_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  int date_main(int argc UNUSED_PARAM, char **argv)
  {
@@ -49,7 +51,7 @@ 
  	struct timespec ts;
  	struct tm tm_time;
  	char buf_fmt_dt2str[64];
-@@ -193,7 +197,7 @@ int date_main(int argc UNUSED_PARAM, cha
+@@ -193,7 +201,7 @@ int date_main(int argc UNUSED_PARAM, char **argv)
  	char *isofmt_arg = NULL;
  
  	opt = getopt32long(argv, "^"
@@ -58,7 +60,7 @@ 
  			IF_FEATURE_DATE_ISOFMT("I::D:")
  			"\0"
  			"d--s:s--d"
-@@ -256,6 +260,31 @@ int date_main(int argc UNUSED_PARAM, cha
+@@ -256,6 +264,31 @@ int date_main(int argc UNUSED_PARAM, char **argv)
  	if (*argv)
  		bb_show_usage();