aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2015-01-05 21:18:10 +0000
committerRon Yorston <rmy@pobox.com>2015-01-05 21:18:10 +0000
commitf9bba0a50fafc7868630767a55cde9f5a16b8d76 (patch)
tree6749e1f5908daaa726dc195e3a04b7a6ac404690
parent067f2e7eaf36deac1175eaf24eeb118adcd37179 (diff)
downloadbusybox-w32-f9bba0a50fafc7868630767a55cde9f5a16b8d76.tar.gz
busybox-w32-f9bba0a50fafc7868630767a55cde9f5a16b8d76.tar.bz2
busybox-w32-f9bba0a50fafc7868630767a55cde9f5a16b8d76.zip
Changes to allow building with MinGW-w64
-rw-r--r--archival/libarchive/decompress_gunzip.c3
-rw-r--r--archival/unzip.c3
-rw-r--r--include/mingw.h5
-rw-r--r--include/platform.h2
-rw-r--r--libbb/appletlib.c12
-rw-r--r--win32/mingw.c5
6 files changed, 30 insertions, 0 deletions
diff --git a/archival/libarchive/decompress_gunzip.c b/archival/libarchive/decompress_gunzip.c
index 1360abef7..2dcc138f9 100644
--- a/archival/libarchive/decompress_gunzip.c
+++ b/archival/libarchive/decompress_gunzip.c
@@ -36,6 +36,9 @@
36#include <setjmp.h> 36#include <setjmp.h>
37#include "libbb.h" 37#include "libbb.h"
38#include "bb_archive.h" 38#include "bb_archive.h"
39#if ENABLE_PLATFORM_MINGW32
40#pragma pack(2)
41#endif
39 42
40typedef struct huft_t { 43typedef struct huft_t {
41 unsigned char e; /* number of extra bits or operation */ 44 unsigned char e; /* number of extra bits or operation */
diff --git a/archival/unzip.c b/archival/unzip.c
index 38a07e212..9b6ceb25f 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -44,6 +44,9 @@
44 44
45#include "libbb.h" 45#include "libbb.h"
46#include "bb_archive.h" 46#include "bb_archive.h"
47#if ENABLE_PLATFORM_MINGW32
48#pragma pack(2)
49#endif
47 50
48enum { 51enum {
49#if BB_BIG_ENDIAN 52#if BB_BIG_ENDIAN
diff --git a/include/mingw.h b/include/mingw.h
index 5f6016dee..12c5ef71d 100644
--- a/include/mingw.h
+++ b/include/mingw.h
@@ -122,6 +122,7 @@ NOIMPL(FAST_FUNC sigaction_set,int signo UNUSED_PARAM, const struct sigaction *s
122/* 122/*
123 * stdio.h 123 * stdio.h
124 */ 124 */
125#undef fseeko
125#define fseeko(f,o,w) fseek(f,o,w) 126#define fseeko(f,o,w) fseek(f,o,w)
126 127
127int fdprintf(int fd, const char *format, ...); 128int fdprintf(int fd, const char *format, ...);
@@ -252,6 +253,7 @@ int mingw_mkdir(const char *path, int mode);
252#if ENABLE_LFS 253#if ENABLE_LFS
253# define off_t off64_t 254# define off_t off64_t
254#endif 255#endif
256#undef lseek
255#define lseek _lseeki64 257#define lseek _lseeki64
256 258
257typedef int nlink_t; 259typedef int nlink_t;
@@ -277,6 +279,9 @@ struct mingw_stat {
277int mingw_lstat(const char *file_name, struct mingw_stat *buf); 279int mingw_lstat(const char *file_name, struct mingw_stat *buf);
278int mingw_stat(const char *file_name, struct mingw_stat *buf); 280int mingw_stat(const char *file_name, struct mingw_stat *buf);
279int mingw_fstat(int fd, struct mingw_stat *buf); 281int mingw_fstat(int fd, struct mingw_stat *buf);
282#undef lstat
283#undef stat
284#undef fstat
280#define lstat mingw_lstat 285#define lstat mingw_lstat
281#define stat mingw_stat 286#define stat mingw_stat
282#define fstat mingw_fstat 287#define fstat mingw_fstat
diff --git a/include/platform.h b/include/platform.h
index d9b82b2ed..e2b61592e 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -425,7 +425,9 @@ typedef unsigned smalluint;
425# undef HAVE_STRSEP 425# undef HAVE_STRSEP
426# undef HAVE_STRSIGNAL 426# undef HAVE_STRSIGNAL
427# undef HAVE_STRVERSCMP 427# undef HAVE_STRVERSCMP
428#if !defined(__MINGW64_VERSION_MAJOR)
428# undef HAVE_VASPRINTF 429# undef HAVE_VASPRINTF
430#endif
429# undef HAVE_UNLOCKED_STDIO 431# undef HAVE_UNLOCKED_STDIO
430# undef HAVE_UNLOCKED_LINE_OPS 432# undef HAVE_UNLOCKED_LINE_OPS
431#endif 433#endif
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index b74b6e724..dba66cc93 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -828,6 +828,18 @@ int main(int argc UNUSED_PARAM, char **argv)
828 } 828 }
829#endif 829#endif
830 830
831#if defined(__MINGW64_VERSION_MAJOR)
832 if ( stdin ) {
833 _setmode(fileno(stdin), _O_BINARY);
834 }
835 if ( stdout ) {
836 _setmode(fileno(stdout), _O_BINARY);
837 }
838 if ( stderr ) {
839 _setmode(fileno(stderr), _O_BINARY);
840 }
841#endif
842
831#if defined(SINGLE_APPLET_MAIN) 843#if defined(SINGLE_APPLET_MAIN)
832 /* Only one applet is selected in .config */ 844 /* Only one applet is selected in .config */
833 if (argv[1] && strncmp(argv[0], "busybox", 7) == 0) { 845 if (argv[1] && strncmp(argv[0], "busybox", 7) == 0) {
diff --git a/win32/mingw.c b/win32/mingw.c
index 8a124147a..83a7ab3a7 100644
--- a/win32/mingw.c
+++ b/win32/mingw.c
@@ -6,7 +6,12 @@
6int _CRT_glob = 0; 6int _CRT_glob = 0;
7#endif 7#endif
8 8
9#if !defined(__MINGW64_VERSION_MAJOR)
9unsigned int _CRT_fmode = _O_BINARY; 10unsigned int _CRT_fmode = _O_BINARY;
11#else
12#undef _fmode
13int _fmode = _O_BINARY;
14#endif
10 15
11smallint bb_got_signal; 16smallint bb_got_signal;
12 17