build: Remove support for cross-building from Cygwin and SunOS.

These have been broken for a long time. Some Cygwin changes that
are relevant on MinGW are kept here, but users on Windows who
want to build Haiku should probably use WSL at this point.

However, now that we are using relative paths and don't need
to worry about drive path kludges, it's actually possible to
get some host tools built on MinGW. Changes for that coming.
This commit is contained in:
Augustin Cavalier 2018-11-23 15:40:50 -05:00
parent 26b2733af3
commit 37c106060a
6 changed files with 19 additions and 58 deletions

View File

@ -242,23 +242,17 @@ HOST_UNARFLAGS ?= x ;
# check the host platform compatibility # check the host platform compatibility
SetPlatformCompatibilityFlagVariables HOST_PLATFORM : HOST : host SetPlatformCompatibilityFlagVariables HOST_PLATFORM : HOST : host
: linux openbsd freebsd darwin sunos cygwin ; : linux openbsd freebsd darwin ;
HOST_PLATFORM_(host)_COMPATIBLE = 1 ; HOST_PLATFORM_(host)_COMPATIBLE = 1 ;
if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd
|| $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = cygwin || $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = openbsd {
|| $(HOST_PLATFORM) = sunos || $(HOST_PLATFORM) = openbsd {
# don't use lex: otherwise rc will not work correctly # don't use lex: otherwise rc will not work correctly
if $(LEX) = lex { if $(LEX) = lex {
LEX = flex ; LEX = flex ;
} }
} }
if $(HOST_PLATFORM) = cygwin {
HOST_LINKFLAGS += -Xlinker --allow-multiple-definition -Xlinker
--enable-auto-import ;
}
HOST_CPU ?= $(OSPLAT:L) ; HOST_CPU ?= $(OSPLAT:L) ;
# Jam doesn't know x86_64, so override HOST_CPU, if 64 bit. # Jam doesn't know x86_64, so override HOST_CPU, if 64 bit.
@ -304,10 +298,8 @@ HOST_ASFLAGS = ;
HOST_CCFLAGS += -Wno-multichar ; HOST_CCFLAGS += -Wno-multichar ;
HOST_C++FLAGS += -Wno-multichar ; HOST_C++FLAGS += -Wno-multichar ;
if $(HOST_PLATFORM) != cygwin { HOST_PIC_CCFLAGS += -fPIC ;
HOST_PIC_CCFLAGS += -fPIC ; HOST_PIC_C++FLAGS += -fPIC ;
HOST_PIC_C++FLAGS += -fPIC ;
}
if $(HOST_GCC_VERSION[1]) >= 3 { if $(HOST_GCC_VERSION[1]) >= 3 {
HOST_GCC_BASE_FLAGS += -fno-strict-aliasing -fno-delete-null-pointer-checks ; HOST_GCC_BASE_FLAGS += -fno-strict-aliasing -fno-delete-null-pointer-checks ;
@ -433,7 +425,7 @@ if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
} else { } else {
HOST_LINKFLAGS += -lm -ldl ; HOST_LINKFLAGS += -lm -ldl ;
HOST_LIBSTDC++ = stdc++ ; HOST_LIBSTDC++ = stdc++ ;
if $(HOST_PLATFORM) = cygwin { if $(HOST_PLATFORM) = mingw {
HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR
= "export PATH=$PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ; = "export PATH=$PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ;
} else if $(HOST_PLATFORM) = darwin { } else if $(HOST_PLATFORM) = darwin {
@ -444,14 +436,7 @@ if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
= "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ; = "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ;
} }
if $(HOST_PLATFORM) = cygwin { HOST_PTHREAD_LINKFLAGS = -pthread ;
# not needed
HOST_PTHREAD_LINKFLAGS = ;
} else if $(HOST_PLATFORM) = freebsd {
HOST_PTHREAD_LINKFLAGS = -pthread ;
} else {
HOST_PTHREAD_LINKFLAGS = -pthread ;
}
# the C++ support library # the C++ support library
if $(HOST_GCC_VERSION[1]) < 3 { if $(HOST_GCC_VERSION[1]) < 3 {
@ -685,8 +670,6 @@ switch $(HOST_PLATFORM) {
case linux : HOST_DEFINES += HAIKU_HOST_PLATFORM_LINUX ; case linux : HOST_DEFINES += HAIKU_HOST_PLATFORM_LINUX ;
case freebsd : HOST_DEFINES += HAIKU_HOST_PLATFORM_FREEBSD ; case freebsd : HOST_DEFINES += HAIKU_HOST_PLATFORM_FREEBSD ;
case darwin : HOST_DEFINES += HAIKU_HOST_PLATFORM_DARWIN ; case darwin : HOST_DEFINES += HAIKU_HOST_PLATFORM_DARWIN ;
case cygwin : HOST_DEFINES += HAIKU_HOST_PLATFORM_CYGWIN ;
case sunos : HOST_DEFINES += HAIKU_HOST_PLATFORM_SUNOS ;
} }
# define host platform 64 bit macro # define host platform 64 bit macro

View File

@ -621,7 +621,7 @@ rule BuildPlatformObjects
Objects $(sources) ; Objects $(sources) ;
} }
actions CygwinExtensionFix actions Win32ExtensionFix
{ {
if test -f $(1).exe ; then if test -f $(1).exe ; then
rm -f $(1) rm -f $(1)
@ -658,14 +658,14 @@ rule BuildPlatformMain
Main $(target) : $(sources) ; Main $(target) : $(sources) ;
LinkAgainst $(target) : $(libs) ; LinkAgainst $(target) : $(libs) ;
if $(HOST_PLATFORM) = cygwin { if $(HOST_PLATFORM) = mingw {
# Cygwin gcc adds the ".exe" extension. We cannot force # MinGW GCC adds the ".exe" extension. We cannot force
# jam to use SUFEXE as haiku target executables are not # jam to use SUFEXE as haiku target executables are not
# supposed to have this extension, thus finding # supposed to have this extension, thus finding
# dependencies will fail for these. # dependencies will fail for these.
# The hack is to remove the extension after a successful # The hack is to remove the extension after a successful
# build of the Target. # build of the Target.
CygwinExtensionFix $(target) ; Win32ExtensionFix $(target) ;
} }
} }
@ -685,9 +685,9 @@ rule BuildPlatformSharedLibrary
if $(HOST_PLATFORM) = darwin { if $(HOST_PLATFORM) = darwin {
LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ] LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ]
-dynamic -dynamiclib -Xlinker -flat_namespace ; -dynamic -dynamiclib -Xlinker -flat_namespace ;
} else if $(HOST_PLATFORM) = cygwin { # } else if $(HOST_PLATFORM) = cygwin {
LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ] # LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ]
-shared -Xlinker --allow-multiple-definition ; # -shared -Xlinker --allow-multiple-definition ;
} else { } else {
LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ] LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ]
-shared -Xlinker -soname=\"$(target:G=)\" ; -shared -Xlinker -soname=\"$(target:G=)\" ;

2
configure vendored
View File

@ -782,8 +782,6 @@ case "${platform}" in
Haiku) HOST_PLATFORM=haiku_host ;; Haiku) HOST_PLATFORM=haiku_host ;;
Linux) HOST_PLATFORM=linux ;; Linux) HOST_PLATFORM=linux ;;
OpenBSD) HOST_PLATFORM=openbsd ;; OpenBSD) HOST_PLATFORM=openbsd ;;
SunOS) HOST_PLATFORM=sunos ;;
CYGWIN_NT-*) HOST_PLATFORM=cygwin ;;
*) echo Unsupported platform: ${platform} *) echo Unsupported platform: ${platform}
exit 1 ;; exit 1 ;;
esac esac

View File

@ -1,20 +1,12 @@
#ifndef BEOS_BUILD_COMPATIBILITY_H #ifndef BEOS_BUILD_COMPATIBILITY_H
#define BEOS_BUILD_COMPATIBILITY_H #define BEOS_BUILD_COMPATIBILITY_H
#if defined(HAIKU_HOST_PLATFORM_CYGWIN) // DEFFILEMODE is not available on MinGW and on platforms with MUSL
# ifndef __addr_t_defined
# define __addr_t_defined
# endif
#endif
// DEFFILEMODE is not available on Cygwin, SunOS and when building with musl c
#if defined(HAIKU_HOST_PLATFORM_CYGWIN) || defined(HAIKU_HOST_PLATFORM_SUNOS) \
|| !defined(DEFFILEMODE)
#ifndef DEFFILEMODE #ifndef DEFFILEMODE
#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
#endif #endif
// There's no ALLPERMS when building with musl c // There's no ALLPERMS on platforms with MUSL
#ifndef ALLPERMS #ifndef ALLPERMS
# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) # define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)
#endif #endif
@ -23,16 +15,6 @@
#define S_IUMSK 07777 #define S_IUMSK 07777
#endif #endif
#include <ctype.h>
#endif
#ifdef HAIKU_HOST_PLATFORM_SUNOS
# include <limits.h>
# ifndef NAME_MAX
# define NAME_MAX MAXNAMELEN
# endif
#endif
typedef unsigned long haiku_build_addr_t; typedef unsigned long haiku_build_addr_t;
#define addr_t haiku_build_addr_t #define addr_t haiku_build_addr_t
@ -62,7 +44,7 @@ extern size_t strlcat(char* dest, const char* source, size_t length);
extern size_t strnlen(const char* string, size_t length); extern size_t strnlen(const char* string, size_t length);
#endif #endif
#if defined(HAIKU_HOST_PLATFORM_CYGWIN) || defined(HAIKU_HOST_PLATFORM_SUNOS) #if defined(HAIKU_HOST_PLATFORM_MINGW)
extern char* stpcpy(char* dest, const char* src); extern char* stpcpy(char* dest, const char* src);
extern char* strcasestr(const char* s, const char* find); extern char* strcasestr(const char* s, const char* find);
#endif #endif

View File

@ -40,7 +40,7 @@ if $(HOST_PLATFORM) != darwin && $(HOST_PLATFORM) != haiku_host {
strlSources = strlcpy.c strlcat.c ; strlSources = strlcpy.c strlcat.c ;
} }
if $(HOST_PLATFORM) = cygwin || $(HOST_PLATFORM) = sunos { if $(HOST_PLATFORM) = mingw {
strlSources += stpcpy.c strcasestr.c ; strlSources += stpcpy.c strcasestr.c ;
} }

View File

@ -27,8 +27,7 @@ if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd || $(HOST_PLATFORM) =
# Write the stage 1 boot loader into the makebootable resources. On Darwin # Write the stage 1 boot loader into the makebootable resources. On Darwin
# resources don't seem to work; there we use an attribute instead. # resources don't seem to work; there we use an attribute instead.
if $(HOST_PLATFORM) != darwin && $(HOST_PLATFORM) != cygwin if $(HOST_PLATFORM) != darwin && $(HOST_PLATFORM) != mingw {
&& $(HOST_PLATFORM) != sunos {
AddFileDataResource <build>makebootable : RAWT:666:BootCode : stage1.bin ; AddFileDataResource <build>makebootable : RAWT:666:BootCode : stage1.bin ;
} }
@ -39,7 +38,6 @@ BuildPlatformMain <build>makebootable :
; ;
# on Darwin write the boot loader code into an attribute # on Darwin write the boot loader code into an attribute
if $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = cygwin if $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = mingw {
|| $(HOST_PLATFORM) = sunos {
AddFileDataAttribute <build>makebootable : BootCode : raw : stage1.bin ; AddFileDataAttribute <build>makebootable : BootCode : raw : stage1.bin ;
} }