mirror of
https://review.haiku-os.org/haiku
synced 2024-11-23 07:18:40 +01:00
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:
parent
37c106060a
commit
807304b100
@ -242,7 +242,7 @@ HOST_UNARFLAGS ?= x ;
|
||||
|
||||
# check the host platform compatibility
|
||||
SetPlatformCompatibilityFlagVariables HOST_PLATFORM : HOST : host
|
||||
: linux openbsd freebsd darwin ;
|
||||
: linux openbsd freebsd darwin mingw ;
|
||||
HOST_PLATFORM_(host)_COMPATIBLE = 1 ;
|
||||
|
||||
if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd
|
||||
@ -670,6 +670,7 @@ switch $(HOST_PLATFORM) {
|
||||
case linux : HOST_DEFINES += HAIKU_HOST_PLATFORM_LINUX ;
|
||||
case freebsd : HOST_DEFINES += HAIKU_HOST_PLATFORM_FREEBSD ;
|
||||
case darwin : HOST_DEFINES += HAIKU_HOST_PLATFORM_DARWIN ;
|
||||
case mingw : HOST_DEFINES += HAIKU_HOST_PLATFORM_MINGW ;
|
||||
}
|
||||
|
||||
# define host platform 64 bit macro
|
||||
|
@ -685,9 +685,9 @@ rule BuildPlatformSharedLibrary
|
||||
if $(HOST_PLATFORM) = darwin {
|
||||
LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ]
|
||||
-dynamic -dynamiclib -Xlinker -flat_namespace ;
|
||||
# } else if $(HOST_PLATFORM) = cygwin {
|
||||
# LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ]
|
||||
# -shared -Xlinker --allow-multiple-definition ;
|
||||
} else if $(HOST_PLATFORM) = mingw {
|
||||
LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ]
|
||||
-shared -Xlinker --allow-multiple-definition ;
|
||||
} else {
|
||||
LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ]
|
||||
-shared -Xlinker -soname=\"$(target:G=)\" ;
|
||||
|
@ -322,7 +322,7 @@ rule Cc
|
||||
|
||||
actions Cc
|
||||
{
|
||||
$(CC) $(CCFLAGS) -c "$(2)" $(CCDEFS) $(CCHDRS) -o "$(1)" ;
|
||||
$(CC) $(CCFLAGS) -c "$(2)" $(CCDEFS) $(CCHDRS) -o "$(1)"
|
||||
}
|
||||
|
||||
rule C++
|
||||
@ -399,13 +399,13 @@ rule C++
|
||||
|
||||
actions C++
|
||||
{
|
||||
$(C++) -c "$(2)" $(C++FLAGS) $(CCDEFS) $(CCHDRS) -o "$(1)" ;
|
||||
$(C++) -c "$(2)" $(C++FLAGS) $(CCDEFS) $(CCHDRS) -o "$(1)"
|
||||
}
|
||||
|
||||
# Force recreation of the archive to avoid build errors caused by
|
||||
# stale dependencies after renaming or deleting object files.
|
||||
actions together Archive
|
||||
{
|
||||
# Force recreation of the archive to avoid build errors caused by
|
||||
# stale dependencies after renaming or deleting object files.
|
||||
$(RM) $(<)
|
||||
$(AR) $(<) $(>)
|
||||
}
|
||||
|
1
configure
vendored
Executable file → Normal file
1
configure
vendored
Executable file → Normal file
@ -782,6 +782,7 @@ case "${platform}" in
|
||||
Haiku) HOST_PLATFORM=haiku_host ;;
|
||||
Linux) HOST_PLATFORM=linux ;;
|
||||
OpenBSD) HOST_PLATFORM=openbsd ;;
|
||||
MINGW*) HOST_PLATFORM=mingw ;;
|
||||
*) echo Unsupported platform: ${platform}
|
||||
exit 1 ;;
|
||||
esac
|
||||
|
@ -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
headers/build/host/mingw/endian.h
Normal file
15
headers/build/host/mingw/endian.h
Normal 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
|
@ -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
|
@ -49,7 +49,9 @@ init_error_map()
|
||||
ADD_ERROR(ERANGE);
|
||||
ADD_ERROR(EPROTOTYPE);
|
||||
ADD_ERROR(EPROTONOSUPPORT);
|
||||
ADD_ERROR(EPFNOSUPPORT);
|
||||
#ifdef EPFNOSUPPORT
|
||||
ADD_ERROR(EPFNOSUPPORT);
|
||||
#endif
|
||||
ADD_ERROR(EAFNOSUPPORT);
|
||||
ADD_ERROR(EADDRINUSE);
|
||||
ADD_ERROR(EADDRNOTAVAIL);
|
||||
@ -60,7 +62,9 @@ init_error_map()
|
||||
ADD_ERROR(ECONNRESET);
|
||||
ADD_ERROR(EISCONN);
|
||||
ADD_ERROR(ENOTCONN);
|
||||
ADD_ERROR(ESHUTDOWN);
|
||||
#ifdef ESHUTDOWN
|
||||
ADD_ERROR(ESHUTDOWN);
|
||||
#endif
|
||||
ADD_ERROR(ECONNREFUSED);
|
||||
ADD_ERROR(EHOSTUNREACH);
|
||||
ADD_ERROR(ENOPROTOOPT);
|
||||
@ -68,25 +72,41 @@ init_error_map()
|
||||
ADD_ERROR(EINPROGRESS);
|
||||
ADD_ERROR(EALREADY);
|
||||
ADD_ERROR(EILSEQ);
|
||||
ADD_ERROR(ENOMSG);
|
||||
ADD_ERROR(ESTALE);
|
||||
#ifdef ENOMSG
|
||||
ADD_ERROR(ENOMSG);
|
||||
#endif
|
||||
#ifdef ESTALE
|
||||
ADD_ERROR(ESTALE);
|
||||
#endif
|
||||
ADD_ERROR(EOVERFLOW);
|
||||
ADD_ERROR(EMSGSIZE);
|
||||
ADD_ERROR(EOPNOTSUPP);
|
||||
ADD_ERROR(ENOTSOCK);
|
||||
ADD_ERROR(EHOSTDOWN);
|
||||
ADD_ERROR(EBADMSG);
|
||||
#ifdef EHOSTDOWN
|
||||
ADD_ERROR(EHOSTDOWN);
|
||||
#endif
|
||||
#ifdef EBADMSG
|
||||
ADD_ERROR(EBADMSG);
|
||||
#endif
|
||||
#ifdef ECANCELED
|
||||
ADD_ERROR(ECANCELED);
|
||||
#endif
|
||||
ADD_ERROR(EDESTADDRREQ);
|
||||
ADD_ERROR(EDQUOT);
|
||||
ADD_ERROR(EIDRM);
|
||||
ADD_ERROR(EMULTIHOP);
|
||||
#ifdef EDQUOT
|
||||
ADD_ERROR(EDQUOT);
|
||||
#endif
|
||||
#ifdef EIDRM
|
||||
ADD_ERROR(EIDRM);
|
||||
#endif
|
||||
#ifdef EMULTIHOP
|
||||
ADD_ERROR(EMULTIHOP);
|
||||
#endif
|
||||
#ifdef ENODATA
|
||||
ADD_ERROR(ENODATA);
|
||||
#endif
|
||||
ADD_ERROR(ENOLINK);
|
||||
#ifdef ENOLINK
|
||||
ADD_ERROR(ENOLINK);
|
||||
#endif
|
||||
#ifdef ENOSR
|
||||
ADD_ERROR(ENOSR);
|
||||
#endif
|
||||
@ -98,7 +118,9 @@ init_error_map()
|
||||
#ifdef ETIME
|
||||
ADD_ERROR(ETIME);
|
||||
#endif
|
||||
ADD_ERROR(ETXTBSY);
|
||||
#ifdef ETXTBSY
|
||||
ADD_ERROR(ETXTBSY);
|
||||
#endif
|
||||
ADD_ERROR(ENOMEM);
|
||||
ADD_ERROR(EACCES);
|
||||
ADD_ERROR(EINTR);
|
||||
|
@ -33,6 +33,8 @@ switch $(HOST_PLATFORM) {
|
||||
DEFINES += HAVE_STRCHRNUL HAVE_FUNOPEN ;
|
||||
case darwin :
|
||||
DEFINES += HAVE_FUNOPEN HAVE_QSORT_R ;
|
||||
case mingw :
|
||||
DEFINES += ;
|
||||
case * :
|
||||
Exit $(SUBDIR)/Jamfile: "Please add a case for your platform"
|
||||
"($(HOST_PLATFORM))!" ;
|
||||
|
Loading…
Reference in New Issue
Block a user