build: Add basic support for MinGW hosts.

This doesn't fully work yet (the FS code in libroot_build
needs to be adapted, as some of the symlink-related calls
are not available on MinGW), but it gets much further than
the "Cygwin" target did.
This commit is contained in:
Augustin Cavalier
2018-11-23 16:24:25 -05:00
parent 37c106060a
commit 807304b100
9 changed files with 79 additions and 42 deletions
+19 -1
View File
@@ -1,6 +1,21 @@
#ifndef BEOS_BUILD_COMPATIBILITY_H
#define BEOS_BUILD_COMPATIBILITY_H
// These things have to be done before anything is included
#if defined(HAIKU_HOST_PLATFORM_MINGW)
#define _MODE_T_
#define _POSIX_
typedef int mode_t;
#include <stdint.h>
#include <limits.h>
typedef uint32_t uid_t;
typedef uint32_t gid_t;
#include <io.h>
#define mkdir(path, mode) mkdir(path)
#endif
// DEFFILEMODE is not available on MinGW and on platforms with MUSL
#ifndef DEFFILEMODE
#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
@@ -25,9 +40,12 @@ typedef unsigned long haiku_build_addr_t;
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#if !defined(HAIKU_HOST_PLATFORM_MINGW)
#include <sys/uio.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
+15
View File
@@ -0,0 +1,15 @@
#ifndef _HAIKU_BUILD_COMPATIBILITY_MINGW_ENDIAN
#define _HAIKU_BUILD_COMPATIBILITY_MINGW_ENDIAN
// There's no <endian.h> in MinGW.
#include <sys/param.h>
#define __LITTLE_ENDIAN LITTLE_ENDIAN
#define __BIG_ENDIAN BIG_ENDIAN
#define __BYTE_ORDER BYTE_ORDER
#endif // _HAIKU_BUILD_COMPATIBILITY_MINGW_ENDIAN
-22
View File
@@ -1,22 +0,0 @@
#ifndef _HAIKU_BUILD_COMPATIBILITY_SUNOS_ENDIAN
#define _HAIKU_BUILD_COMPATIBILITY_SUNOS_ENDIAN
// There's no <endian.h> in Solaris.
#include <sys/byteorder.h>
#define __LITTLE_ENDIAN 1234
#define __BIG_ENDIAN 4321
#define __PDP_ENDIAN 3412
#if defined(_LITTLE_ENDIAN)
#define BYTE_ORDER __LITTLE_ENDIAN
#elif defined(_BIG_ENDIAN)
#define BYTE_ORDER __BIG_ENDIAN
#else
#error Unable to determine byte order!
#endif
#define __BYTE_ORDER BYTE_ORDER
#endif // _HAIKU_BUILD_COMPATIBILITY_SUNOS_ENDIAN