build: Use libroot_build on Haiku.

Previously we just used the system libroot, which of course meant
that when libroot's ABI changed, the build broke. Now we use the full
libroot_build that we do on non-Haiku platforms. The logic for "BeOS-compatible
but not Haiku" does not really apply anymore, so it has been gutted where
appropriate (and libhaikucompat has been decoupled from the build.)

The only caveat here is the change to Errors.h -- we really should be using
the system's one where I included the one from the tree, but for whatever
reason, GCC2 refused to handle the #include_next properly.

Fixes the build breakage of Haiku-on-Haiku by my prior commits (sorry).
This commit is contained in:
Augustin Cavalier
2017-12-13 19:47:39 -05:00
parent 3065fd47a0
commit 5e19679ea3
9 changed files with 15 additions and 72 deletions
+4 -9
View File
@@ -417,6 +417,10 @@ HOST_BUILD_COMPATIBILITY_LIB_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) lib ] ;
# also removes the attributes. # also removes the attributes.
HOST_RM_ATTRS_TARGET = ; HOST_RM_ATTRS_TARGET = ;
HOST_LIBROOT = libroot_build_function_remapper.a libroot_build.so ;
HOST_STATIC_LIBROOT = libroot_build_function_remapper.a libroot_build.a ;
HOST_LIBBE = libbe_build.so ;
if $(HOST_PLATFORM_BEOS_COMPATIBLE) { if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
# the C++ standard and support libraries # the C++ standard and support libraries
if $(HOST_GCC_VERSION[1]) < 3 { if $(HOST_GCC_VERSION[1]) < 3 {
@@ -427,9 +431,6 @@ if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
HOST_LIBSUPC++ = supc++ ; HOST_LIBSUPC++ = supc++ ;
} }
HOST_LIBROOT = root ;
HOST_STATIC_LIBROOT = $(HOST_LIBROOT) ;
HOST_LIBBE = libbe_build.so ;
HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR
= "export LIBRARY_PATH=$LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ; = "export LIBRARY_PATH=$LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ;
HOST_PTHREAD_LINKFLAGS = ; HOST_PTHREAD_LINKFLAGS = ;
@@ -440,15 +441,9 @@ if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
HaikuBuildCompatibility.h ] ; HaikuBuildCompatibility.h ] ;
HOST_CCFLAGS += $(compatibilityHeader) ; HOST_CCFLAGS += $(compatibilityHeader) ;
HOST_C++FLAGS += $(compatibilityHeader) ; HOST_C++FLAGS += $(compatibilityHeader) ;
# compatibility library
HOST_HAIKU_COMPATIBILITY_LIBS = libhaikucompat.a ;
} else { } else {
HOST_LINKFLAGS += -lm ; HOST_LINKFLAGS += -lm ;
HOST_LIBSTDC++ = stdc++ ; HOST_LIBSTDC++ = stdc++ ;
HOST_LIBROOT = libroot_build_function_remapper.a libroot_build.so ;
HOST_STATIC_LIBROOT = libroot_build_function_remapper.a libroot_build.a ;
HOST_LIBBE = libbe_build.so ;
if $(HOST_PLATFORM) = cygwin { if $(HOST_PLATFORM) = cygwin {
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)" ;
+3 -5
View File
@@ -650,11 +650,9 @@ rule BuildPlatformMain
USES_BE_API on $(objects) = $(usesBeAPI) ; USES_BE_API on $(objects) = $(usesBeAPI) ;
# add the build libroot # add the build libroot
if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) { local libroot = [ on $(target) return $(HOST_LIBROOT) ] ;
local libroot = [ on $(target) return $(HOST_LIBROOT) ] ; Depends $(target) : $(libroot) ;
Depends $(target) : $(libroot) ; NEEDLIBS on $(target) += $(libroot) ;
NEEDLIBS on $(target) += $(libroot) ;
}
} }
Main $(target) : $(sources) ; Main $(target) : $(sources) ;
+5 -4
View File
@@ -2,8 +2,8 @@
* Copyright 2007-2014 Haiku, Inc. All rights reserved. * Copyright 2007-2014 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _ERRORS_H #ifndef _BUILD_ERRORS_H
#define _ERRORS_H #define _BUILD_ERRORS_H
#include <errno.h> /* build-specific overrides errno */ #include <errno.h> /* build-specific overrides errno */
@@ -493,7 +493,8 @@
#undef errno #undef errno
#define errno (*_haiku_build_errno()) #define errno (*_haiku_build_errno())
#elif defined(HAIKU_HOST_PLATFORM_HAIKU)
# include <../os/support/Errors.h>
#endif // ! BUILDING_HAIKU_ERROR_MAPPER #endif // ! BUILDING_HAIKU_ERROR_MAPPER
#ifdef __cplusplus #ifdef __cplusplus
@@ -508,4 +509,4 @@ extern int _haiku_to_host_error(int error);
#endif #endif
#endif /* _ERRORS_H */ #endif /* _BUILD_ERRORS_H */
-17
View File
@@ -6,27 +6,10 @@ GENERATE_C++ on [ FGristFiles lexer.l parser.y ] = true ;
SubDirC++Flags -Wno-sign-compare -Wno-unused ; SubDirC++Flags -Wno-sign-compare -Wno-unused ;
local r5Compatibility = [ FDirName $(SUBDIR) R5Compatibility.h ] ;
SubDirCcFlags -include $(r5Compatibility) ;
SubDirC++Flags -include $(r5Compatibility) ;
StaticLibrary librdef.a : StaticLibrary librdef.a :
compile.cpp decompile.cpp lexer.l parser.y rdef.cpp ; compile.cpp decompile.cpp lexer.l parser.y rdef.cpp ;
# On BeOS incompatible platforms we implicitly link against libroot_build.so,
# which does already include the strl*() routines.
local strlSources ;
if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
strlSources = strlcpy.c strlcat.c ;
}
BinCommand rc : BinCommand rc :
rc.cpp rc.cpp
# these two are needed for R5 only
$(strlSources)
: librdef.a [ TargetLibstdc++ ] be : librdef.a [ TargetLibstdc++ ] be
; ;
SEARCH on [ FGristFiles $(strlSources) ]
= [ FDirName $(HAIKU_TOP) src system libroot posix string ] ;
-26
View File
@@ -1,26 +0,0 @@
#ifndef RC_R5_COMPATIBILITY_H
#define RC_R5_COMPATIBILITY_H
#ifndef __HAIKU__
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
// Already defined unter Linux.
#if (defined(__BEOS__) || defined(__HAIKU__))
extern size_t strnlen(const char *string, size_t count);
#endif
extern size_t strlcat(char *dest, const char *source, size_t length);
extern size_t strlcpy(char *dest, const char *source, size_t length);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // !__HAIKU__
#endif // RC_R5_COMPATIBILITY_H
-1
View File
@@ -1,7 +1,6 @@
SubDir HAIKU_TOP src build ; SubDir HAIKU_TOP src build ;
SubInclude HAIKU_TOP src build libbe ; SubInclude HAIKU_TOP src build libbe ;
SubInclude HAIKU_TOP src build libhaikucompat ;
SubInclude HAIKU_TOP src build libicon ; SubInclude HAIKU_TOP src build libicon ;
SubInclude HAIKU_TOP src build libpackage ; SubInclude HAIKU_TOP src build libpackage ;
SubInclude HAIKU_TOP src build libroot ; SubInclude HAIKU_TOP src build libroot ;
+1 -1
View File
@@ -36,7 +36,7 @@ MakeLocate libroot_build.so : $(HOST_BUILD_COMPATIBILITY_LIB_DIR) ;
# darwin already has strlcpy and strlcat in libSystem # darwin already has strlcpy and strlcat in libSystem
local strlSources ; local strlSources ;
if $(HOST_PLATFORM) != darwin { if $(HOST_PLATFORM) != darwin && $(HOST_PLATFORM) != haiku_host {
strlSources = strlcpy.c strlcat.c ; strlSources = strlcpy.c strlcat.c ;
} }
+2 -1
View File
@@ -5,6 +5,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <fcntl.h>
#include "remapped_functions.h" #include "remapped_functions.h"
@@ -210,7 +211,7 @@ mknodat(int fd, const char* name, mode_t mode, dev_t dev)
extern "C" int HIDDEN_FUNCTION_ATTRIBUTE extern "C" int HIDDEN_FUNCTION_ATTRIBUTE
creat(const char* path, mode_t mode) creat(const char* path, mode_t mode)
{ {
HIDDEN_FUNCTION(RESOLVE(creat)); HIDDEN_FUNCTION(creat);
return _haiku_build_creat(path, mode); return _haiku_build_creat(path, mode);
} }
-8
View File
@@ -8,18 +8,10 @@ GENERATE_C++ on [ FGristFiles lexer.l parser.y ] = true ;
SubDirC++Flags -Wno-sign-compare -Wno-unused ; SubDirC++Flags -Wno-sign-compare -Wno-unused ;
local r5Compatibility = [ FDirName $(HAIKU_TOP) src bin rc R5Compatibility.h ] ;
SubDirCcFlags -include $(r5Compatibility) ;
SubDirC++Flags -include $(r5Compatibility) ;
BuildPlatformStaticLibrary <build>librdef.a : BuildPlatformStaticLibrary <build>librdef.a :
compile.cpp decompile.cpp lexer.l parser.y rdef.cpp ; compile.cpp decompile.cpp lexer.l parser.y rdef.cpp ;
BuildPlatformMain <build>rc : BuildPlatformMain <build>rc :
rc.cpp rc.cpp
: <build>librdef.a $(HOST_LIBSTDC++) $(HOST_LIBBE) $(HOST_LIBSUPC++) : <build>librdef.a $(HOST_LIBSTDC++) $(HOST_LIBBE) $(HOST_LIBSUPC++)
; ;
SEARCH on [ FGristFiles $(strlSources) ]
= [ FDirName $(HAIKU_TOP) src system libroot posix string ] ;