From 5e19679ea35a79a26477c6215c7abba9bb7c4d00 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Wed, 13 Dec 2017 19:47:39 -0500 Subject: [PATCH] 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). --- build/jam/BuildSetup | 13 ++++--------- build/jam/MainBuildRules | 8 +++----- headers/build/os/support/Errors.h | 9 +++++---- src/bin/rc/Jamfile | 17 ---------------- src/bin/rc/R5Compatibility.h | 26 ------------------------- src/build/Jamfile | 1 - src/build/libroot/Jamfile | 2 +- src/build/libroot/function_remapper.cpp | 3 ++- src/tools/rc/Jamfile | 8 -------- 9 files changed, 15 insertions(+), 72 deletions(-) delete mode 100644 src/bin/rc/R5Compatibility.h diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup index 3685bd1b97..60bda52153 100644 --- a/build/jam/BuildSetup +++ b/build/jam/BuildSetup @@ -417,6 +417,10 @@ HOST_BUILD_COMPATIBILITY_LIB_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) lib ] ; # also removes the attributes. 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) { # the C++ standard and support libraries if $(HOST_GCC_VERSION[1]) < 3 { @@ -427,9 +431,6 @@ if $(HOST_PLATFORM_BEOS_COMPATIBLE) { HOST_LIBSUPC++ = supc++ ; } - HOST_LIBROOT = root ; - HOST_STATIC_LIBROOT = $(HOST_LIBROOT) ; - HOST_LIBBE = libbe_build.so ; HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR = "export LIBRARY_PATH=$LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ; HOST_PTHREAD_LINKFLAGS = ; @@ -440,15 +441,9 @@ if $(HOST_PLATFORM_BEOS_COMPATIBLE) { HaikuBuildCompatibility.h ] ; HOST_CCFLAGS += $(compatibilityHeader) ; HOST_C++FLAGS += $(compatibilityHeader) ; - - # compatibility library - HOST_HAIKU_COMPATIBILITY_LIBS = libhaikucompat.a ; } else { HOST_LINKFLAGS += -lm ; 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 { HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR = "export PATH=$PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ; diff --git a/build/jam/MainBuildRules b/build/jam/MainBuildRules index 0e526a1f68..9114c8fdbd 100644 --- a/build/jam/MainBuildRules +++ b/build/jam/MainBuildRules @@ -650,11 +650,9 @@ rule BuildPlatformMain USES_BE_API on $(objects) = $(usesBeAPI) ; # add the build libroot - if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) { - local libroot = [ on $(target) return $(HOST_LIBROOT) ] ; - Depends $(target) : $(libroot) ; - NEEDLIBS on $(target) += $(libroot) ; - } + local libroot = [ on $(target) return $(HOST_LIBROOT) ] ; + Depends $(target) : $(libroot) ; + NEEDLIBS on $(target) += $(libroot) ; } Main $(target) : $(sources) ; diff --git a/headers/build/os/support/Errors.h b/headers/build/os/support/Errors.h index 6cccf9425a..b7fe19d6a4 100644 --- a/headers/build/os/support/Errors.h +++ b/headers/build/os/support/Errors.h @@ -2,8 +2,8 @@ * Copyright 2007-2014 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ -#ifndef _ERRORS_H -#define _ERRORS_H +#ifndef _BUILD_ERRORS_H +#define _BUILD_ERRORS_H #include /* build-specific overrides errno */ @@ -493,7 +493,8 @@ #undef errno #define errno (*_haiku_build_errno()) - +#elif defined(HAIKU_HOST_PLATFORM_HAIKU) +# include <../os/support/Errors.h> #endif // ! BUILDING_HAIKU_ERROR_MAPPER #ifdef __cplusplus @@ -508,4 +509,4 @@ extern int _haiku_to_host_error(int error); #endif -#endif /* _ERRORS_H */ +#endif /* _BUILD_ERRORS_H */ diff --git a/src/bin/rc/Jamfile b/src/bin/rc/Jamfile index 43bc689a1e..ee8436cba2 100644 --- a/src/bin/rc/Jamfile +++ b/src/bin/rc/Jamfile @@ -6,27 +6,10 @@ GENERATE_C++ on [ FGristFiles lexer.l parser.y ] = true ; SubDirC++Flags -Wno-sign-compare -Wno-unused ; -local r5Compatibility = [ FDirName $(SUBDIR) R5Compatibility.h ] ; -SubDirCcFlags -include $(r5Compatibility) ; -SubDirC++Flags -include $(r5Compatibility) ; - StaticLibrary librdef.a : 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 : rc.cpp - - # these two are needed for R5 only - $(strlSources) : librdef.a [ TargetLibstdc++ ] be ; - -SEARCH on [ FGristFiles $(strlSources) ] - = [ FDirName $(HAIKU_TOP) src system libroot posix string ] ; diff --git a/src/bin/rc/R5Compatibility.h b/src/bin/rc/R5Compatibility.h deleted file mode 100644 index 3b3e318cfb..0000000000 --- a/src/bin/rc/R5Compatibility.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef RC_R5_COMPATIBILITY_H -#define RC_R5_COMPATIBILITY_H - -#ifndef __HAIKU__ - -#include - -#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 diff --git a/src/build/Jamfile b/src/build/Jamfile index 6e07352cdc..ea21ddaaa9 100644 --- a/src/build/Jamfile +++ b/src/build/Jamfile @@ -1,7 +1,6 @@ SubDir HAIKU_TOP src build ; SubInclude HAIKU_TOP src build libbe ; -SubInclude HAIKU_TOP src build libhaikucompat ; SubInclude HAIKU_TOP src build libicon ; SubInclude HAIKU_TOP src build libpackage ; SubInclude HAIKU_TOP src build libroot ; diff --git a/src/build/libroot/Jamfile b/src/build/libroot/Jamfile index f146d85b87..1d22d3cd33 100644 --- a/src/build/libroot/Jamfile +++ b/src/build/libroot/Jamfile @@ -36,7 +36,7 @@ MakeLocate libroot_build.so : $(HOST_BUILD_COMPATIBILITY_LIB_DIR) ; # darwin already has strlcpy and strlcat in libSystem local strlSources ; -if $(HOST_PLATFORM) != darwin { +if $(HOST_PLATFORM) != darwin && $(HOST_PLATFORM) != haiku_host { strlSources = strlcpy.c strlcat.c ; } diff --git a/src/build/libroot/function_remapper.cpp b/src/build/libroot/function_remapper.cpp index 35121f3e2c..5ba25b6426 100644 --- a/src/build/libroot/function_remapper.cpp +++ b/src/build/libroot/function_remapper.cpp @@ -5,6 +5,7 @@ #include +#include #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 creat(const char* path, mode_t mode) { - HIDDEN_FUNCTION(RESOLVE(creat)); + HIDDEN_FUNCTION(creat); return _haiku_build_creat(path, mode); } diff --git a/src/tools/rc/Jamfile b/src/tools/rc/Jamfile index 3c36683254..80235997be 100644 --- a/src/tools/rc/Jamfile +++ b/src/tools/rc/Jamfile @@ -8,18 +8,10 @@ GENERATE_C++ on [ FGristFiles lexer.l parser.y ] = true ; 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 librdef.a : compile.cpp decompile.cpp lexer.l parser.y rdef.cpp ; BuildPlatformMain rc : rc.cpp - : librdef.a $(HOST_LIBSTDC++) $(HOST_LIBBE) $(HOST_LIBSUPC++) ; - -SEARCH on [ FGristFiles $(strlSources) ] - = [ FDirName $(HAIKU_TOP) src system libroot posix string ] ;