haiku/build/jam/BuildSetup

843 lines
28 KiB
Plaintext
Raw Normal View History

# Variable naming conventions:
# TARGET_*: A build system variable specifying a property for building for
# the target platform (usually Haiku). E.g. TARGET_CC specifies the
# compiler when building a target for the target platform.
# HOST_*: A build system variable specifying a property of the platform
# hosting the build. E.g. HOST_CC specifies the compiler when
# building a target for the host platform (a build tool for
# instance).
# HAIKU_*: A build system variable specifying a build system property. Usually
# directory paths and the like.
# The Haiku (base) version. For development builds the revision will be
# attached.
HAIKU_VERSION = r1~beta4 ;
#pragma mark - container settings
# Haiku image
HAIKU_IMAGE_CONTAINER_NAME = haiku-image-container ;
HAIKU_CONTAINER_GRIST on $(HAIKU_IMAGE_CONTAINER_NAME) = HaikuImage ;
HAIKU_INCLUDE_IN_CONTAINER_VAR on $(HAIKU_IMAGE_CONTAINER_NAME)
= HAIKU_INCLUDE_IN_IMAGE ;
HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_IMAGE_CONTAINER_NAME)
= HAIKU_IMAGE_INSTALL_TARGETS ;
HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(HAIKU_IMAGE_CONTAINER_NAME)
= system non-packaged ;
# network boot archive
HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME = haiku-netboot-archive-container ;
HAIKU_CONTAINER_GRIST on $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME)
= NetBootArchive ;
# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported
HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME)
= HAIKU_NET_BOOT_ARCHIVE_INSTALL_TARGETS ;
HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME)
= system ;
# boot floppy
HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME = haiku-boot-floppy-container ;
HAIKU_CONTAINER_GRIST on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME)
= FloppyBootImage ;
# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported
HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME)
= HAIKU_FLOPPY_BOOT_IMAGE_INSTALL_TARGETS ;
HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME)
= system ;
# boot CD image
HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME = haiku-boot-cd-container ;
HAIKU_CONTAINER_GRIST on $(HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME) = CDBootImage ;
# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported
HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME)
= HAIKU_CD_BOOT_IMAGE_INSTALL_TARGETS ;
HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME)
= system ;
# boot MMC image
HAIKU_MMC_BOOT_IMAGE_CONTAINER_NAME = haiku-boot-mmc-container ;
HAIKU_CONTAINER_GRIST on $(HAIKU_MMC_BOOT_IMAGE_CONTAINER_NAME) = MMCImage ;
# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported
HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_MMC_BOOT_IMAGE_CONTAINER_NAME)
= HAIKU_MMC_BOOT_IMAGE_INSTALL_TARGETS ;
HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(HAIKU_MMC_BOOT_IMAGE_CONTAINER_NAME)
= system ;
# Haiku image/install defaults
HAIKU_DEFAULT_IMAGE_NAME = haiku.image ;
HAIKU_DEFAULT_IMAGE_DIR = $(HAIKU_OUTPUT_DIR) ;
HAIKU_DEFAULT_VMWARE_IMAGE_NAME = haiku.vmdk ;
HAIKU_DEFAULT_INSTALL_DIR = /Haiku ;
HAIKU_DEFAULT_IMAGE_SIZE ?= 300 ; # 300 MB
HAIKU_DEFAULT_IMAGE_LABEL ?= Haiku ;
# Haiku CD defaults
HAIKU_DEFAULT_CD_NAME = haiku-cd.iso ;
HAIKU_DEFAULT_CD_DIR = $(HAIKU_OUTPUT_DIR) ;
HAIKU_DEFAULT_CD_LABEL = Haiku ;
# Haiku Anyboot defaults
HAIKU_DEFAULT_ANYBOOT_NAME = haiku-anyboot.iso ;
HAIKU_DEFAULT_ANYBOOT_DIR = $(HAIKU_OUTPUT_DIR) ;
HAIKU_DEFAULT_ANYBOOT_LABEL ?= Haiku ;
# Haiku MMC defaults
HAIKU_DEFAULT_MMC_NAME = haiku-mmc.image ;
HAIKU_DEFAULT_MMC_DIR = $(HAIKU_OUTPUT_DIR) ;
HAIKU_DEFAULT_MMC_LABEL ?= Haiku ;
# analyze and optionally replace jam's target parameters
ProcessCommandLineArguments ;
# supported debug levels
HAIKU_DEBUG_LEVELS = 0 1 2 3 4 5 ;
# configuration header directories
HAIKU_CONFIG_HEADERS = [ FDirName $(HAIKU_TOP) build user_config_headers ]
[ FDirName $(HAIKU_TOP) build config_headers ] ;
# object directories common to all architectures
HAIKU_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) haiku ] ;
HAIKU_COMMON_ARCH_OBJECT_DIR = [ FDirName $(HAIKU_OBJECT_BASE_DIR) common ] ;
#pragma mark - haiku target platform settings
local architecture ;
for architecture in $(HAIKU_PACKAGING_ARCHS) {
ArchitectureSetup $(architecture) ;
}
if $(HAIKU_PACKAGING_ARCH) {
local kernelArch = $(HAIKU_PACKAGING_ARCH) ;
# Always use the non-legacy GCC for the kernel.
if $(kernelArch) = x86_gcc2 {
kernelArch = x86 ;
}
KernelArchitectureSetup $(kernelArch) ;
}
# define primary packaging architecture macro
HAIKU_DEFINES = __HAIKU_PRIMARY_PACKAGING_ARCH=\\\"$(HAIKU_PACKAGING_ARCH)\\\" ;
# distro compatibility level defines
HAIKU_DISTRO_COMPATIBILITY ?= "default" ;
switch $(HAIKU_DISTRO_COMPATIBILITY) {
case official :
HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_OFFICIAL ;
HAIKU_INCLUDE_TRADEMARKS = "" ;
case compatible :
HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_COMPATIBLE ;
HAIKU_INCLUDE_TRADEMARKS = "" ;
case "default" :
HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_DEFAULT ;
HAIKU_INCLUDE_TRADEMARKS = ;
case * :
Exit "Invalid value for HAIKU_DISTRO_COMPATIBILITY:"
$(HAIKU_DISTRO_COMPATIBILITY) ;
}
# network libraries
HAIKU_NETWORK_LIBS = network ;
HAIKU_NETAPI_LIB = bnetapi ;
HAIKU_SELECT_UNAME_ETC_LIB = ; # libroot, against which we link anyway
HAIKU_EXECUTABLE_MIME_TYPE = "application/x-vnd.Be-elfexecutable" ;
# TODO: The version stuff should probably go into a separate file and be made
# available as macro, too.
# Set our version number if not already set and mark it as a developer build
if ! $(HAIKU_BUILD_VERSION) {
HAIKU_BUILD_VERSION ?= "1 0 0 a 1" ;
HAIKU_BUILD_DESCRIPTION ?= "Developer Build" ;
}
# If HAIKU_BUILD_VERSION is set, but HAIKU_BUILD_DESCRIPTION isn't, mark it as
# an unknown build.
HAIKU_BUILD_DESCRIPTION ?= "Unknown Build" ;
#pragma mark - host platform settings
# analyze the host gcc machine spec to find out about 64-bitness
HOST_PLATFORM_IS_64_BIT = ;
switch $(HOST_GCC_MACHINE) {
case i686-apple-darwin10 : HOST_PLATFORM_IS_64_BIT = 1 ;
case i686-apple-darwin11 : HOST_PLATFORM_IS_64_BIT = 1 ;
case x86_64-* : HOST_PLATFORM_IS_64_BIT = 1 ;
case amd64-* : HOST_PLATFORM_IS_64_BIT = 1 ;
case arm64-* : HOST_PLATFORM_IS_64_BIT = 1 ;
case aarch64-* : HOST_PLATFORM_IS_64_BIT = 1 ;
case riscv64-* : HOST_PLATFORM_IS_64_BIT = 1 ;
}
# If HAIKU_HOST_USE_32BIT is set, add the required gcc base flag (the LD flag
# is set later), or, if the architecture isn't actually 64 bit, clear
# HAIKU_HOST_USE_32BIT.
# Afterwards HOST_PLATFORM_IS_64_BIT will indicate whether the architecture is
# effectively (i.e. when using the compiler/linker flags) 64 bit and
# HAIKU_HOST_USE_32BIT will be set, iff the architecture is really 64 bit and
# 32 bit mode was requested.
if $(HAIKU_HOST_USE_32BIT) = 1 {
if $(HOST_PLATFORM_IS_64_BIT) {
# enable GCC -m32 option
HOST_GCC_BASE_FLAGS = -m32 ;
HOST_PLATFORM_IS_64_BIT = ;
} else {
HAIKU_HOST_USE_32BIT = 0 ;
}
}
# save jam's variables for the build platform
HOST_AR ?= $(AR) ;
HOST_ARFLAGS ?= $(ARFLAGS) ;
HOST_CC ?= $(CC) ;
HOST_C++ ?= $(HOST_CC) ;
HOST_LINK ?= $(HOST_CC) ;
HOST_RANLIB ?= $(RANLIB) ;
HOST_CPPFLAGS ?= $(CPPFLAGS) ;
HOST_CCFLAGS ?= $(HOST_GCC_BASE_FLAGS) $(CCFLAGS) ;
HOST_C++FLAGS ?= $(HOST_GCC_BASE_FLAGS) $(C++FLAGS) ;
HOST_LDFLAGS ?= $(LDFLAGS) ;
HOST_LINKFLAGS ?= $(HOST_GCC_BASE_FLAGS) $(LINKFLAGS) ;
HOST_DEFINES ?= $(DEFINES) ;
HOST_HDRS ?= $(HDRS) ;
# split up HOST_AR into the command name and flags
HOST_AR = [ Match "([^ ]*) *(.*)" : $(HOST_AR[1]) ]
$(HOST_AR[2-]) ;
HOST_ARFLAGS = $(HOST_AR[2-]) $(HOST_ARFLAGS) ;
HOST_AR = $(HOST_AR[1]) ;
HOST_UNARFLAGS ?= x ;
# check the host platform compatibility
SetPlatformCompatibilityFlagVariables HOST_PLATFORM : HOST : host
: linux openbsd freebsd darwin ;
2013-09-18 17:26:35 +04:00
HOST_PLATFORM_(host)_COMPATIBLE = 1 ;
if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd
|| $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = openbsd {
# don't use lex: otherwise rc will not work correctly
if $(LEX) = lex {
LEX = flex ;
}
}
2013-09-18 17:26:35 +04:00
HOST_CPU ?= $(OSPLAT:L) ;
# Jam doesn't know x86_64, so override HOST_CPU, if 64 bit.
if $(HOST_CPU) = x86 && $(HOST_PLATFORM_IS_64_BIT) {
HOST_CPU = x86_64 ;
}
2013-09-18 17:26:35 +04:00
HOST_ARCH ?= $(HOST_CPU) ;
HOST_ARCHS = $(HOST_ARCH) ;
2013-09-18 17:26:35 +04:00
HOST_KERNEL_ARCH = host ;
# set packaging architecture
HOST_PACKAGING_ARCH ?= $(HOST_CPU) ;
if $(HOST_PACKAGING_ARCH) = x86 && $(HOST_CC_IS_LEGACY_GCC) = 1 {
HOST_PACKAGING_ARCH = x86_gcc2 ;
}
HOST_PACKAGING_ARCHS = $(HOST_PACKAGING_ARCH) ;
# directories
HOST_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) $(HOST_PLATFORM) ] ;
HOST_COMMON_ARCH_OBJECT_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) common ] ;
HOST_ARCH_OBJECT_DIR
= [ FDirName $(HOST_OBJECT_BASE_DIR) $(HOST_PACKAGING_ARCH) ] ;
HOST_COMMON_DEBUG_OBJECT_DIR = [ FDirName $(HOST_ARCH_OBJECT_DIR) common ] ;
HOST_DEBUG_0_OBJECT_DIR = [ FDirName $(HOST_ARCH_OBJECT_DIR) release ] ;
local level ;
for level in $(HAIKU_DEBUG_LEVELS[2-]) {
HOST_DEBUG_$(level)_OBJECT_DIR
= [ FDirName $(HOST_ARCH_OBJECT_DIR) debug_$(level) ] ;
}
# set variables for gcc header options
SetIncludePropertiesVariables HOST ;
# assembler flags
HOST_ASFLAGS = ;
# C/C++ flags
HOST_CCFLAGS += -Wno-multichar ;
HOST_C++FLAGS += -Wno-multichar ;
HOST_PIC_CCFLAGS += -fPIC ;
HOST_PIC_C++FLAGS += -fPIC ;
if $(HOST_CC_IS_LEGACY_GCC) != 1 {
HOST_GCC_BASE_FLAGS += -fno-strict-aliasing -fno-delete-null-pointer-checks ;
}
HOST_KERNEL_CCFLAGS += $(HOST_GCC_BASE_FLAGS) -finline -fno-builtin
-D_KERNEL_MODE ;
HOST_KERNEL_C++FLAGS += $(HOST_GCC_BASE_FLAGS) -finline -fno-builtin
-fno-exceptions -D_KERNEL_MODE ;
Merged branch haiku/branches/developer/bonefish/optimization revision 23139 into trunk, with roughly the following changes (for details svn log the branch): * The int 99 syscall handler is now fully in assembly. * Added a sysenter/sysexit handler and use it on Pentiums that support it (via commpage). * Got rid of i386_handle_trap(). A bit of functionality was moved into the assembly handler which now uses a jump table to call C functions handling the respective interrupt. * Some optimizations to get user debugger support code out of the interrupt handling path. * Introduced a thread::flags fields which allows to skip handling of rare events (signals, user debug enabling/disabling) on the common interrupt handling path. * Got rid of the explicit iframe stack. The iframes can still be retrieved by iterating through the stack frames. * Made the commpage an architecture independent feature. It's used for the real time data stuff (instead of creating a separate area). * The x86 CPU modules can now provide processor optimized versions for common functions (currently memcpy() only). They are used in the kernel and are provided to the userland via commpage entries. * Introduced build system feature allowing easy use of C structure member offsets in assembly code. Changes after merging: * Fixed merge conflict in src/system/kernel/arch/x86/arch_debug.cpp (caused by refactoring and introduction of "call" debugger command). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23370 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-11 03:36:44 +03:00
HOST_KERNEL_DEFINES += _KERNEL_MODE ;
HOST_KERNEL_PIC_CCFLAGS = -fno-pic ;
HOST_KERNEL_PIC_LINKFLAGS = ;
if $(HOST_ARCH) = ppc {
# Build a position independent PPC kernel. We need to be able to relocate
# the kernel, since the virtual address space layout at boot time is not
# fixed.
HOST_KERNEL_PIC_CCFLAGS = -fPIE ;
HOST_KERNEL_PIC_LINKFLAGS = -shared -fPIE ;
}
if $(HOST_ARCH) = m68k {
# Build a position independent M68K kernel. We need to be able to relocate
# the kernel, since the virtual address space layout at boot time is not
# fixed.
HOST_KERNEL_PIC_CCFLAGS = $(HAIKU_KERNEL_PIC_CCFLAGS) ;
HOST_KERNEL_PIC_LINKFLAGS = $(HAIKU_KERNEL_PIC_LINKFLAGS) ;
}
if $(HOST_PLATFORM) != darwin {
# fix for new changes to DSO linking policies
2020-05-21 11:47:14 +03:00
HOST_LINKFLAGS += -Xlinker --no-as-needed ;
if $(HOST_CC_IS_LEGACY_GCC) != 1 {
2020-05-21 11:47:14 +03:00
HOST_LINKFLAGS += -Wl,--copy-dt-needed-entries ;
}
}
# warning flags
HOST_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes -Wpointer-arith
-Wcast-align -Wsign-compare ;
HOST_WARNING_C++FLAGS = -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy
-Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare ;
HOST_KERNEL_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes ;
HOST_KERNEL_WARNING_C++FLAGS = -Wall -Wno-trigraphs ;
HOST_WERROR_FLAGS = ;
# debug flags
local hostDebugFlags ;
switch $(HOST_PLATFORM) {
case haiku : hostDebugFlags ?= -ggdb ;
case haiku_host : hostDebugFlags ?= -ggdb ;
case linux : hostDebugFlags ?= -ggdb ;
case freebsd : hostDebugFlags ?= -ggdb ;
case darwin : hostDebugFlags ?= -ggdb ;
case * : hostDebugFlags ?= -g ;
}
# debug 0: suppress asserts
HOST_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
HOST_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
HOST_KERNEL_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
HOST_KERNEL_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
local level ;
for level in $(HAIKU_DEBUG_LEVELS[2-]) {
local flags = $(hostDebugFlags) [ FDefines DEBUG=$(level) ] ;
HOST_DEBUG_$(level)_CCFLAGS = $(flags) ;
HOST_DEBUG_$(level)_C++FLAGS = $(flags) ;
HOST_KERNEL_DEBUG_$(level)_CCFLAGS = $(flags) ;
HOST_KERNEL_DEBUG_$(level)_C++FLAGS = $(flags) ;
}
# ld flags
if $(HAIKU_HOST_USE_32BIT) = 1 {
HOST_LDFLAGS += -melf_i386 ;
}
# private kernel headers do be used when compiling kernel code
HOST_PRIVATE_KERNEL_HEADERS = ;
# private shared kernel/libroot headers
HOST_PRIVATE_SYSTEM_HEADERS = ;
# under Haiku use copyattr instead of cp
if $(HOST_PLATFORM_HAIKU_COMPATIBLE) {
CP = copyattr --data ;
}
HOST_DEFINES += ARCH_$(HOST_CPU) ;
HOST_DEFINES += _NO_INLINE_ASM __NO_INLINE__ ;
# for builds of tools in the current environment
HOST_BUILD_COMPATIBILITY_LIB_DIR = [ FDirName $(PWD) $(HOST_OBJECT_BASE_DIR) lib ] ;
# For the generic attributes emulation: Target rm_attrs -- rm replacement that
# 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 ;
# adding rpath allows directly invoking host tools without specifying
# a library search path
if $(HOST_PLATFORM) != darwin {
HOST_LINKFLAGS += -Wl,-rpath,$(HOST_BUILD_COMPATIBILITY_LIB_DIR) ;
}
if $(HOST_PLATFORM_HAIKU_COMPATIBLE) {
# the C++ standard and support libraries
if $(HOST_CC_IS_LEGACY_GCC) = 1 {
HOST_LIBSTDC++ = stdc++.r4 ;
HOST_LIBSUPC++ = ;
} else {
HOST_LIBSTDC++ = stdc++ ;
HOST_LIBSUPC++ = supc++ ;
}
HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR
= "LIBRARY_PATH=\"$LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)\"" ;
HOST_PTHREAD_LINKFLAGS = ;
HOST_LINKFLAGS += -lbsd ;
HOST_LIBRARY_NAME_MAP_input_server = /system/servers/input_server ;
HOST_DEFINES += __STDC_FORMAT_MACROS __STDC_LIMIT_MACROS ;
local compatibilityHeader = -include [ FDirName $(HAIKU_TOP) headers build
HaikuBuildCompatibility.h ] ;
HOST_CCFLAGS += $(compatibilityHeader) ;
HOST_C++FLAGS += $(compatibilityHeader) ;
} else {
HOST_LINKFLAGS += -lm -ldl ;
HOST_LIBSTDC++ = stdc++ ;
if $(HOST_PLATFORM) = darwin {
HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR
= "DYLD_LIBRARY_PATH=\"$DYLD_LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)\"" ;
} else {
HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR
= "LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)\"" ;
}
HOST_PTHREAD_LINKFLAGS = -pthread ;
# the C++ support library
if $(HOST_CC_IS_LEGACY_GCC) = 1 {
HOST_LIBSUPC++ = ;
} else {
HOST_LIBSUPC++ = supc++ ;
}
if $(HOST_PLATFORM) = darwin {
# part of the C++ runtime lives in libstdc++ on Darwin
HOST_LIBSUPC++ = gcc_s.1 stdc++ ;
HOST_LIBSTDC++ = ;
} else if $(HOST_PLATFORM) = freebsd {
if $(HOST_CPU) = x86_64 {
# amd64 FreeBSD 8 doesn't come without a shared libsupc++, and the
# static one prevents us from building shared libraries. So we have
# to work around by using the shared libstdc++.
HOST_LIBSUPC++ = stdc++ ;
HOST_LIBSTDC++ = ;
}
}
# Supposing this is a glibc platform, let's try to get features like large
# file support, ISO C 99 definitions, etc. On some platforms we need to
# request 64 bit off_t support explicitely.
HOST_DEFINES += _GNU_SOURCE _FILE_OFFSET_BITS=64 __STDC_FORMAT_MACROS
__STDC_LIMIT_MACROS ;
libroot_build: *Actually* fix attribute usage on Haiku. To quote jscipione (from 95e8362c52af35a4012ca4d0facd62fb9856b619), "Let me tell you a story about a bug" -- though this tale spans a much lesser time than that one did. In 5e19679ea35a79a26477c6215c7abba9bb7c4d00, I enabled libroot_build for Haiku, instead of using the system libroot as we had before. There were a number of bugs introduced along with this that I hadn't fixed (and there may be more after this), but most of the obvious ones (crashes on x86_64...) were fixed shortly enough. Attribute usage, though, was a different story. Unlike most of the POSIX calls in libroot, which were aliasing system functions no matter what the platform, the attribute calls were not, as they are specific to Haiku. Initially I had completely forgot about them, and it wasn't until a few days later when I noticed that I had an "attributes" directory in my generated that I realized that the "generic" attribute layer was being used on Haiku. I attempted a fix for this in 5e19679ea35a79a26477c6215c7abba9bb7c4d00, thinking that would clear the problem up, but I didn't actually run a test beyond seeing that my BuildConfig had been updated properly. In fact, BuildSetup was hard-wired to not even pass that definition through on Haiku, and so that commit had in effect caused nothing. My initial "fix" of just changing BuildSetup then caused a build failure, as while libroot_build itself compiled, it ran into errors whenever attributes were used, because in letting the real libroot's attribute calls shine through, I had bypassed libroot_build's FD emulation/shim layer. Then I tried and failed at three separate attempts to solve this with code: - a version of the "fs_attr_...h" interface for Haiku. This proved possible in theory, but in practice I would need to reimplement a lot of attribute handling code in it, because all I had access to from there was syscalls. - a version of "fs_attr_untyped" that bypassed its reimplementations of the "fs*attr" functions for the libroot ones, only using the FD shim layer. This proved possibly not even theoretically possible because it would have caused preprocessor hell in some of the build headers, and also assumptions about how attributes are read were totally different. - a completely new "fs_attr_haiku" that was a completely new interface to the fs*attr functions. This proved practically impossible because of the need to include structures from the system libroot to call out to readdir, etc. that attempts to solve would also have caused preprocessor hell. Then I realized that the Linux xattr emulation library, which I'd used as a reference when attempting the first solution, was shipped by default as a system library in all builds of Haiku ... and so I could just tell fs_attr_untyped to use the Linux xattr handler, and then link against libgnu. So that is how I arrived at this strange and decidedly unorthodox solution to a problem of my own creation.
2017-12-30 05:26:00 +03:00
}
libroot_build: *Actually* fix attribute usage on Haiku. To quote jscipione (from 95e8362c52af35a4012ca4d0facd62fb9856b619), "Let me tell you a story about a bug" -- though this tale spans a much lesser time than that one did. In 5e19679ea35a79a26477c6215c7abba9bb7c4d00, I enabled libroot_build for Haiku, instead of using the system libroot as we had before. There were a number of bugs introduced along with this that I hadn't fixed (and there may be more after this), but most of the obvious ones (crashes on x86_64...) were fixed shortly enough. Attribute usage, though, was a different story. Unlike most of the POSIX calls in libroot, which were aliasing system functions no matter what the platform, the attribute calls were not, as they are specific to Haiku. Initially I had completely forgot about them, and it wasn't until a few days later when I noticed that I had an "attributes" directory in my generated that I realized that the "generic" attribute layer was being used on Haiku. I attempted a fix for this in 5e19679ea35a79a26477c6215c7abba9bb7c4d00, thinking that would clear the problem up, but I didn't actually run a test beyond seeing that my BuildConfig had been updated properly. In fact, BuildSetup was hard-wired to not even pass that definition through on Haiku, and so that commit had in effect caused nothing. My initial "fix" of just changing BuildSetup then caused a build failure, as while libroot_build itself compiled, it ran into errors whenever attributes were used, because in letting the real libroot's attribute calls shine through, I had bypassed libroot_build's FD emulation/shim layer. Then I tried and failed at three separate attempts to solve this with code: - a version of the "fs_attr_...h" interface for Haiku. This proved possible in theory, but in practice I would need to reimplement a lot of attribute handling code in it, because all I had access to from there was syscalls. - a version of "fs_attr_untyped" that bypassed its reimplementations of the "fs*attr" functions for the libroot ones, only using the FD shim layer. This proved possibly not even theoretically possible because it would have caused preprocessor hell in some of the build headers, and also assumptions about how attributes are read were totally different. - a completely new "fs_attr_haiku" that was a completely new interface to the fs*attr functions. This proved practically impossible because of the need to include structures from the system libroot to call out to readdir, etc. that attempts to solve would also have caused preprocessor hell. Then I realized that the Linux xattr emulation library, which I'd used as a reference when attempting the first solution, was shipped by default as a system library in all builds of Haiku ... and so I could just tell fs_attr_untyped to use the Linux xattr handler, and then link against libgnu. So that is how I arrived at this strange and decidedly unorthodox solution to a problem of my own creation.
2017-12-30 05:26:00 +03:00
if $(HAIKU_HOST_USE_XATTR) = 1 {
HOST_DEFINES += HAIKU_HOST_USE_XATTR ;
} else {
# Otherwise the generic attribute emulation is used, which uses a
# directory per file to store its attribute. We need to redefine RM so
# that the attributes are removed as well. We use a wrapper script,
# which invokes a build tool. If the build tool hasn't been built yet,
# the normal "rm" is used and the attributes are leaked (likely there
# aren't any yet).
RM = $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
libroot_build: *Actually* fix attribute usage on Haiku. To quote jscipione (from 95e8362c52af35a4012ca4d0facd62fb9856b619), "Let me tell you a story about a bug" -- though this tale spans a much lesser time than that one did. In 5e19679ea35a79a26477c6215c7abba9bb7c4d00, I enabled libroot_build for Haiku, instead of using the system libroot as we had before. There were a number of bugs introduced along with this that I hadn't fixed (and there may be more after this), but most of the obvious ones (crashes on x86_64...) were fixed shortly enough. Attribute usage, though, was a different story. Unlike most of the POSIX calls in libroot, which were aliasing system functions no matter what the platform, the attribute calls were not, as they are specific to Haiku. Initially I had completely forgot about them, and it wasn't until a few days later when I noticed that I had an "attributes" directory in my generated that I realized that the "generic" attribute layer was being used on Haiku. I attempted a fix for this in 5e19679ea35a79a26477c6215c7abba9bb7c4d00, thinking that would clear the problem up, but I didn't actually run a test beyond seeing that my BuildConfig had been updated properly. In fact, BuildSetup was hard-wired to not even pass that definition through on Haiku, and so that commit had in effect caused nothing. My initial "fix" of just changing BuildSetup then caused a build failure, as while libroot_build itself compiled, it ran into errors whenever attributes were used, because in letting the real libroot's attribute calls shine through, I had bypassed libroot_build's FD emulation/shim layer. Then I tried and failed at three separate attempts to solve this with code: - a version of the "fs_attr_...h" interface for Haiku. This proved possible in theory, but in practice I would need to reimplement a lot of attribute handling code in it, because all I had access to from there was syscalls. - a version of "fs_attr_untyped" that bypassed its reimplementations of the "fs*attr" functions for the libroot ones, only using the FD shim layer. This proved possibly not even theoretically possible because it would have caused preprocessor hell in some of the build headers, and also assumptions about how attributes are read were totally different. - a completely new "fs_attr_haiku" that was a completely new interface to the fs*attr functions. This proved practically impossible because of the need to include structures from the system libroot to call out to readdir, etc. that attempts to solve would also have caused preprocessor hell. Then I realized that the Linux xattr emulation library, which I'd used as a reference when attempting the first solution, was shipped by default as a system library in all builds of Haiku ... and so I could just tell fs_attr_untyped to use the Linux xattr handler, and then link against libgnu. So that is how I arrived at this strange and decidedly unorthodox solution to a problem of my own creation.
2017-12-30 05:26:00 +03:00
[ FDirName $(HAIKU_TOP) build scripts rm_attrs ]
[ FDirName $(HAIKU_OBJECT_DIR) $(HOST_PLATFORM) $(HOST_ARCH) release
tools rm_attrs ] -f ;
# assumes that rm_attrs is built with debugging disabled
HOST_RM_ATTRS_TARGET = <build>rm_attrs ;
# If specified, use xattr support to tag files with unique IDs.
if $(HAIKU_HOST_USE_XATTR_REF) = 1 {
HOST_DEFINES += HAIKU_HOST_USE_XATTR_REF ;
}
}
# network libraries
if $(HOST_PLATFORM_HAIKU_COMPATIBLE) {
HOST_NETWORK_LIBS = network ;
HOST_NETAPI_LIB = bnetapi ;
HOST_SELECT_UNAME_ETC_LIB = ; # libroot
} else {
2018-11-24 00:29:57 +03:00
# Linux, ...
HOST_NETWORK_LIBS = ;
HOST_NETAPI_LIB = ;
HOST_SELECT_UNAME_ETC_LIB = ;
}
# define the executable MIME type
HOST_EXECUTABLE_MIME_TYPE = "application/x-vnd.Be-elfexecutable" ;
if $(METROWERKS) {
# at least parts of Haiku still can be compiled with
# the Metrowerks compiler on BeOS/PPC
HOST_EXECUTABLE_MIME_TYPE = "application/x-be-executable" ;
}
# Be API compatibility
HOST_BE_API_HEADERS = ;
HOST_BE_API_CCFLAGS = ;
HOST_BE_API_C++FLAGS = ;
# Add directory with system headers we need when building something for the host
# platform, e.g. containing missing POSIX/GNU headers.
HOST_HDRS += [ FDirName $(HAIKU_TOP) headers build host $(HOST_PLATFORM) ] ;
if $(HOST_PLATFORM) = freebsd {
2013-09-30 04:55:11 +04:00
# FreeBSD's gcc doesn't include /usr/local/* in its search paths,
# though that's where most things from ports wind up being installed.
HOST_HDRS += /usr/local/include /usr/include/gnu ;
HOST_LINKFLAGS += -L/usr/local/lib ;
}
if $(HOST_PLATFORM) = darwin {
HOST_HDRS += [ FDirName $(HAIKU_TOP) src build libgnuregex ] ;
# Mac OS X users may be using macports libraries, in which case the headers
# and the libs are located in /opt/local/.
HOST_HDRS += /opt/local/include ;
HOST_LINKFLAGS += -L/opt/local/lib ;
# Mac OS X users may be using homebrew libraries, in which case the headers
# and the libs are locted in the /usr/local/.
HOST_HDRS += /usr/local/include ;
HOST_LINKFLAGS += -L/usr/local/lib ;
}
HOST_BE_API_HEADERS =
[ FDirName $(HAIKU_TOP) headers build ]
[ FDirName $(HAIKU_TOP) headers build os ]
[ FDirName $(HAIKU_TOP) headers build os add-ons registrar ]
[ FDirName $(HAIKU_TOP) headers build os app ]
[ FDirName $(HAIKU_TOP) headers build os bluetooth ]
[ FDirName $(HAIKU_TOP) headers build os drivers ]
[ FDirName $(HAIKU_TOP) headers build os kernel ]
[ FDirName $(HAIKU_TOP) headers build os interface ]
[ FDirName $(HAIKU_TOP) headers build os locale ]
[ FDirName $(HAIKU_TOP) headers build os storage ]
[ FDirName $(HAIKU_TOP) headers build os support ]
[ FDirName $(HAIKU_TOP) headers build private ]
;
HOST_BE_API_CCFLAGS = -include [ FDirName $(HAIKU_TOP) headers build
BeOSBuildCompatibility.h ] ;
HOST_BE_API_C++FLAGS = $(HOST_BE_API_CCFLAGS) ;
if ! $(HOST_PYTHON) {
Echo "HOST_PYTHON variable not defined --> will default to 'python'" ;
HOST_PYTHON ?= "python" ;
}
#pragma mark - target platform settings
# check the target platform compatibility
SetPlatformCompatibilityFlagVariables TARGET_PLATFORM : TARGET : target ;
# Haiku architecture is undefined on host-only builds
# set here to host arch to prevent recusive loops.
if $(HAIKU_HOST_BUILD_ONLY) = 1 {
Echo "Host tools build for $(HOST_ARCH)" ;
HAIKU_ARCH = $(HOST_ARCH) ;
HAIKU_KERNEL_ARCH = $(HOST_ARCH) ;
HAIKU_KERNEL_ARCH_DIR = $(HAIKU_KERNEL_ARCH) ;
}
# Set TARGET_* variables either from HAIKU_* or HOST_* depending on the
# specified TARGET_PLATFORM. Some variables are package architecture dependent
# and their name gets a respective suffix. A few variables exist both with and
# without suffix. The latter is either equivalent to the variable with the
# primary architecture suffix (e.g. TARGET_ARCH) or is (additionally) applicable
# for all architectures (e.g. TARGET_DEFINES).
local buildVars =
ARCH ARCHS KERNEL_ARCH KERNEL_ARCH_DIR PACKAGING_ARCH PACKAGING_ARCHS
DEFINES
Merged branch haiku/branches/developer/bonefish/optimization revision 23139 into trunk, with roughly the following changes (for details svn log the branch): * The int 99 syscall handler is now fully in assembly. * Added a sysenter/sysexit handler and use it on Pentiums that support it (via commpage). * Got rid of i386_handle_trap(). A bit of functionality was moved into the assembly handler which now uses a jump table to call C functions handling the respective interrupt. * Some optimizations to get user debugger support code out of the interrupt handling path. * Introduced a thread::flags fields which allows to skip handling of rare events (signals, user debug enabling/disabling) on the common interrupt handling path. * Got rid of the explicit iframe stack. The iframes can still be retrieved by iterating through the stack frames. * Made the commpage an architecture independent feature. It's used for the real time data stuff (instead of creating a separate area). * The x86 CPU modules can now provide processor optimized versions for common functions (currently memcpy() only). They are used in the kernel and are provided to the userland via commpage entries. * Introduced build system feature allowing easy use of C structure member offsets in assembly code. Changes after merging: * Fixed merge conflict in src/system/kernel/arch/x86/arch_debug.cpp (caused by refactoring and introduction of "call" debugger command). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23370 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-11 03:36:44 +03:00
KERNEL_DEFINES
BOOT_DEFINES
KERNEL_CCFLAGS KERNEL_C++FLAGS
KERNEL_PIC_CCFLAGS KERNEL_PIC_LINKFLAGS KERNEL_ADDON_LINKFLAGS
BOOT_CCFLAGS BOOT_C++FLAGS BOOT_LINKFLAGS BOOT_LDFLAGS
KERNEL_WARNING_CCFLAGS KERNEL_WARNING_C++FLAGS
KERNEL_DEBUG_$(HAIKU_DEBUG_LEVELS)_CCFLAGS
KERNEL_DEBUG_$(HAIKU_DEBUG_LEVELS)_C++FLAGS
PRIVATE_KERNEL_HEADERS
NETWORK_LIBS NETAPI_LIB SELECT_UNAME_ETC_LIB
EXECUTABLE_MIME_TYPE
OBJECT_BASE_DIR COMMON_ARCH_OBJECT_DIR
;
local archDependentBuildVars =
ARCH CPU
AR CC C++ ELFEDIT LD OBJCOPY RANLIB STRIP
CC_IS_LEGACY_GCC CC_IS_CLANG
ARFLAGS ASFLAGS UNARFLAGS CPPFLAGS CCFLAGS C++FLAGS HDRS LDFLAGS
LINK LINKFLAGS
WARNING_CCFLAGS WARNING_C++FLAGS WERROR_FLAGS
DEBUG_$(HAIKU_DEBUG_LEVELS)_CCFLAGS DEBUG_$(HAIKU_DEBUG_LEVELS)_C++FLAGS
INCLUDES_SEPARATOR LOCAL_INCLUDES_OPTION SYSTEM_INCLUDES_OPTION
PRIVATE_SYSTEM_HEADERS
ARCH_OBJECT_DIR COMMON_DEBUG_OBJECT_DIR
DEBUG_$(HAIKU_DEBUG_LEVELS)_OBJECT_DIR
;
# target platform setup
local var ;
for var in $(buildVars) {
TARGET_$(var) = $(HAIKU_$(var)) ;
}
for var in $(archDependentBuildVars)_$(TARGET_PACKAGING_ARCHS) {
TARGET_$(var) = $(HAIKU_$(var)) ;
}
TARGET_BOOT_LIBGCC = $(HAIKU_BOOT_LIBGCC_$(TARGET_PACKAGING_ARCH)) ;
TARGET_BOOT_LIBSUPC++ = $(HAIKU_BOOT_LIBSUPC++_$(TARGET_PACKAGING_ARCH)) ;
TARGET_BOOT_32_LIBGCC = $(HAIKU_BOOT_32_LIBGCC_$(TARGET_PACKAGING_ARCH)) ;
TARGET_BOOT_32_LIBSUPC++ = $(HAIKU_BOOT_32_LIBSUPC++_$(TARGET_PACKAGING_ARCH)) ;
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true. Library names are now mapped for all targets but "host" (not only for "haiku") -- added one more level of indirection to achieve that. (TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*). * Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h (auto-included when compiling something that uses the Be API for platform "host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h, which can be included when compiling something that can be built for both, Haiku and BeOS compatible platforms. * Introduced libhaikucompat.a, a library that adds a few functions existing under Haiku, but not under BeOS. * New rule AddSubDirSupportedPlatforms. * Renamed libopenbeos.so to libbe_haiku.so. * Introduced new target platform "libbe_test", which is basically equivalent to a BeOS compatible host platform target, with the exception, that instead of the host platform's libbe.so a special build of Haiku's libbe.so (libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore Haiku's public app, interface, storage, and support kit headers are used when compiling. This replaces the less nice way in which the test app server and applications for this test environment were built. When building for platform "libbe_test", the library name "be" is autotranslated to "libbe_haiku.so". Thus most applications don't need special fiddling when them building them for the app server test environment; usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice. * Reduced the dependencies of <syscalls.h> and fixed problems caused by this (e.g. source files not including the needed headers directly). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
TARGET_KERNEL_PLATFORM ?= $(HAIKU_KERNEL_PLATFORM) ;
local architecture ;
for architecture in $(TARGET_PACKAGING_ARCHS) {
TARGET_DEFINES_$(architecture) = $(HAIKU_DEFINES_$(architecture)) ;
TARGET_LIBRARY_NAME_MAP_$(architecture)
= HAIKU_LIBRARY_NAME_MAP_$(architecture) ;
}
# define macro, for identifying the platform
switch $(TARGET_PLATFORM) {
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true. Library names are now mapped for all targets but "host" (not only for "haiku") -- added one more level of indirection to achieve that. (TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*). * Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h (auto-included when compiling something that uses the Be API for platform "host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h, which can be included when compiling something that can be built for both, Haiku and BeOS compatible platforms. * Introduced libhaikucompat.a, a library that adds a few functions existing under Haiku, but not under BeOS. * New rule AddSubDirSupportedPlatforms. * Renamed libopenbeos.so to libbe_haiku.so. * Introduced new target platform "libbe_test", which is basically equivalent to a BeOS compatible host platform target, with the exception, that instead of the host platform's libbe.so a special build of Haiku's libbe.so (libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore Haiku's public app, interface, storage, and support kit headers are used when compiling. This replaces the less nice way in which the test app server and applications for this test environment were built. When building for platform "libbe_test", the library name "be" is autotranslated to "libbe_haiku.so". Thus most applications don't need special fiddling when them building them for the app server test environment; usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice. * Reduced the dependencies of <syscalls.h> and fixed problems caused by this (e.g. source files not including the needed headers directly). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
case haiku : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_HAIKU ;
case libbe_test : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_LIBBE_TEST ;
}
# define macro, for identifying the host platform
switch $(HOST_PLATFORM) {
case haiku_host : HOST_DEFINES += HAIKU_HOST_PLATFORM_HAIKU ;
case linux : HOST_DEFINES += HAIKU_HOST_PLATFORM_LINUX ;
case freebsd : HOST_DEFINES += HAIKU_HOST_PLATFORM_FREEBSD ;
case darwin : HOST_DEFINES += HAIKU_HOST_PLATFORM_DARWIN ;
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true. Library names are now mapped for all targets but "host" (not only for "haiku") -- added one more level of indirection to achieve that. (TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*). * Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h (auto-included when compiling something that uses the Be API for platform "host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h, which can be included when compiling something that can be built for both, Haiku and BeOS compatible platforms. * Introduced libhaikucompat.a, a library that adds a few functions existing under Haiku, but not under BeOS. * New rule AddSubDirSupportedPlatforms. * Renamed libopenbeos.so to libbe_haiku.so. * Introduced new target platform "libbe_test", which is basically equivalent to a BeOS compatible host platform target, with the exception, that instead of the host platform's libbe.so a special build of Haiku's libbe.so (libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore Haiku's public app, interface, storage, and support kit headers are used when compiling. This replaces the less nice way in which the test app server and applications for this test environment were built. When building for platform "libbe_test", the library name "be" is autotranslated to "libbe_haiku.so". Thus most applications don't need special fiddling when them building them for the app server test environment; usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice. * Reduced the dependencies of <syscalls.h> and fixed problems caused by this (e.g. source files not including the needed headers directly). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
}
# define host platform 64 bit macro
if $(HOST_PLATFORM_IS_64_BIT) {
HOST_DEFINES += HAIKU_HOST_PLATFORM_64_BIT ;
}
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true. Library names are now mapped for all targets but "host" (not only for "haiku") -- added one more level of indirection to achieve that. (TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*). * Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h (auto-included when compiling something that uses the Be API for platform "host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h, which can be included when compiling something that can be built for both, Haiku and BeOS compatible platforms. * Introduced libhaikucompat.a, a library that adds a few functions existing under Haiku, but not under BeOS. * New rule AddSubDirSupportedPlatforms. * Renamed libopenbeos.so to libbe_haiku.so. * Introduced new target platform "libbe_test", which is basically equivalent to a BeOS compatible host platform target, with the exception, that instead of the host platform's libbe.so a special build of Haiku's libbe.so (libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore Haiku's public app, interface, storage, and support kit headers are used when compiling. This replaces the less nice way in which the test app server and applications for this test environment were built. When building for platform "libbe_test", the library name "be" is autotranslated to "libbe_haiku.so". Thus most applications don't need special fiddling when them building them for the app server test environment; usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice. * Reduced the dependencies of <syscalls.h> and fixed problems caused by this (e.g. source files not including the needed headers directly). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
Switch build system from optional package to repositories * Build libsolv and the dependency solver part of the package kit for the build platform. * Add build tool get_package_dependencies. Given a list of package files and a list of repository files it determines the additional packages that need to be retrieved from the repositories and prints their URLs. * Add rules to work with external repositories in the build system (build/jam/RepositoryRules): - PackageRepository declares an external repository with all its packages. The URL of the repository file isn't specified. It is computed from a given base URL and the SHA256 hash of the list of package files. - GeneratedRepositoryPackageList generates a file containing the file names of all packages in a repository. - IsPackageAvailable returns whether a package is available in any repository. - PackageURL returns the URL for a package. * Declare the HaikuPorts repository for x86_gcc2 (build/jam/repositories/HaikuPorts/x86_gcc2). * Add rule AddHaikuImagePackages to add a package to the image and rule IsHaikuImagePackageAdded to determine whether a package has been added. * OptionalPackages: Remove all entries that just downloaded and installed an external package. AddHaikuImagePackages can be used instead and is used in the remaining entries. Also move the remaining optional package dependency declarations from OptionalPackageDependencies here. * ExtractBuildFeatureArchives: Instead of the URL parameter a package name must be specified now. This allows to simplify BuildFeatures significantly, since there's no dealing with URLs anymore. "if" out the entries that aren't supported yet. * build_haiku_image: For the packages installed in system and common resolve their dependencies and download and install them as well.
2013-07-05 12:51:42 +04:00
# define Haiku packaging architecture macro for host build
HOST_DEFINES += HAIKU_PACKAGING_ARCH=\\\"$(HAIKU_PACKAGING_ARCH)\\\" ;
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true. Library names are now mapped for all targets but "host" (not only for "haiku") -- added one more level of indirection to achieve that. (TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*). * Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h (auto-included when compiling something that uses the Be API for platform "host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h, which can be included when compiling something that can be built for both, Haiku and BeOS compatible platforms. * Introduced libhaikucompat.a, a library that adds a few functions existing under Haiku, but not under BeOS. * New rule AddSubDirSupportedPlatforms. * Renamed libopenbeos.so to libbe_haiku.so. * Introduced new target platform "libbe_test", which is basically equivalent to a BeOS compatible host platform target, with the exception, that instead of the host platform's libbe.so a special build of Haiku's libbe.so (libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore Haiku's public app, interface, storage, and support kit headers are used when compiling. This replaces the less nice way in which the test app server and applications for this test environment were built. When building for platform "libbe_test", the library name "be" is autotranslated to "libbe_haiku.so". Thus most applications don't need special fiddling when them building them for the app server test environment; usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice. * Reduced the dependencies of <syscalls.h> and fixed problems caused by this (e.g. source files not including the needed headers directly). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
#pragma mark -
# special target libbe_test
if $(TARGET_PLATFORM) = libbe_test {
# headers and flags
TARGET_HDRS_$(TARGET_PACKAGING_ARCH) +=
[ PublicHeaders $(DOT) app drivers game interface kernel locale storage
support ]
[ PrivateHeaders $(DOT) ] ;
TARGET_DEFINES += __HAIKU__ ;
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true. Library names are now mapped for all targets but "host" (not only for "haiku") -- added one more level of indirection to achieve that. (TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*). * Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h (auto-included when compiling something that uses the Be API for platform "host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h, which can be included when compiling something that can be built for both, Haiku and BeOS compatible platforms. * Introduced libhaikucompat.a, a library that adds a few functions existing under Haiku, but not under BeOS. * New rule AddSubDirSupportedPlatforms. * Renamed libopenbeos.so to libbe_haiku.so. * Introduced new target platform "libbe_test", which is basically equivalent to a BeOS compatible host platform target, with the exception, that instead of the host platform's libbe.so a special build of Haiku's libbe.so (libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore Haiku's public app, interface, storage, and support kit headers are used when compiling. This replaces the less nice way in which the test app server and applications for this test environment were built. When building for platform "libbe_test", the library name "be" is autotranslated to "libbe_haiku.so". Thus most applications don't need special fiddling when them building them for the app server test environment; usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice. * Reduced the dependencies of <syscalls.h> and fixed problems caused by this (e.g. source files not including the needed headers directly). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
TARGET_PRIVATE_SYSTEM_HEADERS_$(TARGET_PACKAGING_ARCH) =
[ PrivateHeaders $(DOT) system system/arch/$(TARGET_ARCH) ] ;
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true. Library names are now mapped for all targets but "host" (not only for "haiku") -- added one more level of indirection to achieve that. (TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*). * Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h (auto-included when compiling something that uses the Be API for platform "host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h, which can be included when compiling something that can be built for both, Haiku and BeOS compatible platforms. * Introduced libhaikucompat.a, a library that adds a few functions existing under Haiku, but not under BeOS. * New rule AddSubDirSupportedPlatforms. * Renamed libopenbeos.so to libbe_haiku.so. * Introduced new target platform "libbe_test", which is basically equivalent to a BeOS compatible host platform target, with the exception, that instead of the host platform's libbe.so a special build of Haiku's libbe.so (libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore Haiku's public app, interface, storage, and support kit headers are used when compiling. This replaces the less nice way in which the test app server and applications for this test environment were built. When building for platform "libbe_test", the library name "be" is autotranslated to "libbe_haiku.so". Thus most applications don't need special fiddling when them building them for the app server test environment; usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice. * Reduced the dependencies of <syscalls.h> and fixed problems caused by this (e.g. source files not including the needed headers directly). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
# directories
TARGET_OBJECT_BASE_DIR
= [ FDirName $(HAIKU_OBJECT_DIR) $(TARGET_PLATFORM) ] ;
TARGET_COMMON_ARCH_OBJECT_DIR
= [ FDirName $(TARGET_OBJECT_BASE_DIR) common ] ;
TARGET_ARCH_OBJECT_DIR_$(TARGET_PACKAGING_ARCH)
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true. Library names are now mapped for all targets but "host" (not only for "haiku") -- added one more level of indirection to achieve that. (TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*). * Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h (auto-included when compiling something that uses the Be API for platform "host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h, which can be included when compiling something that can be built for both, Haiku and BeOS compatible platforms. * Introduced libhaikucompat.a, a library that adds a few functions existing under Haiku, but not under BeOS. * New rule AddSubDirSupportedPlatforms. * Renamed libopenbeos.so to libbe_haiku.so. * Introduced new target platform "libbe_test", which is basically equivalent to a BeOS compatible host platform target, with the exception, that instead of the host platform's libbe.so a special build of Haiku's libbe.so (libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore Haiku's public app, interface, storage, and support kit headers are used when compiling. This replaces the less nice way in which the test app server and applications for this test environment were built. When building for platform "libbe_test", the library name "be" is autotranslated to "libbe_haiku.so". Thus most applications don't need special fiddling when them building them for the app server test environment; usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice. * Reduced the dependencies of <syscalls.h> and fixed problems caused by this (e.g. source files not including the needed headers directly). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
= [ FDirName $(TARGET_OBJECT_BASE_DIR) $(TARGET_ARCH) ] ;
TARGET_COMMON_DEBUG_OBJECT_DIR_$(TARGET_PACKAGING_ARCH)
= [ FDirName $(TARGET_ARCH_OBJECT_DIR_$(TARGET_PACKAGING_ARCH))
common ] ;
TARGET_DEBUG_0_OBJECT_DIR_$(TARGET_PACKAGING_ARCH)
= [ FDirName $(TARGET_ARCH_OBJECT_DIR_$(TARGET_PACKAGING_ARCH))
release ] ;
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true. Library names are now mapped for all targets but "host" (not only for "haiku") -- added one more level of indirection to achieve that. (TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*). * Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h (auto-included when compiling something that uses the Be API for platform "host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h, which can be included when compiling something that can be built for both, Haiku and BeOS compatible platforms. * Introduced libhaikucompat.a, a library that adds a few functions existing under Haiku, but not under BeOS. * New rule AddSubDirSupportedPlatforms. * Renamed libopenbeos.so to libbe_haiku.so. * Introduced new target platform "libbe_test", which is basically equivalent to a BeOS compatible host platform target, with the exception, that instead of the host platform's libbe.so a special build of Haiku's libbe.so (libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore Haiku's public app, interface, storage, and support kit headers are used when compiling. This replaces the less nice way in which the test app server and applications for this test environment were built. When building for platform "libbe_test", the library name "be" is autotranslated to "libbe_haiku.so". Thus most applications don't need special fiddling when them building them for the app server test environment; usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice. * Reduced the dependencies of <syscalls.h> and fixed problems caused by this (e.g. source files not including the needed headers directly). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
local level ;
for level in $(HAIKU_DEBUG_LEVELS[2-]) {
TARGET_DEBUG_$(level)_OBJECT_DIR_$(TARGET_PACKAGING_ARCH)
= [ FDirName $(TARGET_ARCH_OBJECT_DIR_$(TARGET_PACKAGING_ARCH))
debug_$(level) ] ;
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true. Library names are now mapped for all targets but "host" (not only for "haiku") -- added one more level of indirection to achieve that. (TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*). * Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h (auto-included when compiling something that uses the Be API for platform "host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h, which can be included when compiling something that can be built for both, Haiku and BeOS compatible platforms. * Introduced libhaikucompat.a, a library that adds a few functions existing under Haiku, but not under BeOS. * New rule AddSubDirSupportedPlatforms. * Renamed libopenbeos.so to libbe_haiku.so. * Introduced new target platform "libbe_test", which is basically equivalent to a BeOS compatible host platform target, with the exception, that instead of the host platform's libbe.so a special build of Haiku's libbe.so (libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore Haiku's public app, interface, storage, and support kit headers are used when compiling. This replaces the less nice way in which the test app server and applications for this test environment were built. When building for platform "libbe_test", the library name "be" is autotranslated to "libbe_haiku.so". Thus most applications don't need special fiddling when them building them for the app server test environment; usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice. * Reduced the dependencies of <syscalls.h> and fixed problems caused by this (e.g. source files not including the needed headers directly). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
}
# library name map
TARGET_LIBRARY_NAME_MAP_$(TARGET_PACKAGING_ARCH) = LIBBE_LIBRARY_NAME_MAP ;
LIBBE_LIBRARY_NAME_MAP_be = libbe_test.so ;
}
#pragma mark - common stuff
# start with a clean state
CCFLAGS = ;
C++FLAGS = ;
DEFINES = ;
# Set CC, C++, LINK to invalid values, so that we realize early, that we use
# the wrong compiler.
CC = bad-cc ;
C++ = bad-c++ ;
LINK = bad-link ;
# Defaults for warnings, optimization, and debugging.
#
WARNINGS ?= 1 ;
OPTIM ?= -O2 ;
DEBUG ?= 0 ;
# Set a sane default for whether this is a CI build.
HAIKU_CONTINUOUS_INTEGRATION_BUILD ?= 0 ;
# Set the defaults for PLATFORM and SUPPORTED_PLATFORMS. PLATFORM is only
# overridden for targets to be built for the host platform. SUPPORTED_PLATFORMS
# can be overridden by the author of a component.
PLATFORM = $(TARGET_PLATFORM) ;
SUPPORTED_PLATFORMS = haiku ;
# Define two pseudo targets for the target and buildhost platform. The main
# build rules (Cc, C++, As, ...) depend on these pseude targets such that global
# initializations that are required before anything is built for a specific
# platform can be forced by depending the pseudo target for the platform on the
# initializations.
# This is currently used to unpack the external headers from the
# gcc_syslibs_devel build feature before anything is built for the target
# platform.
NotFile $(TARGET_PLATFORM) ;
NotFile host ;
# Instructs the Library rule to not make its object files temporary.
# This is needed as some objects are used in a static library and for an
# executable.
KEEPOBJS = true ;
# Set permissions to how they should be on the image.
EXEMODE = 755 ;
FILEMODE = 644 ;
SHELLMODE = 755 ;
# output directories
# TODO: Review this.
HAIKU_DOCUMENTATION_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) documentation ] ;
HAIKU_DOCUMENTATION_OBJECT_DIR ?= [ FDirName $(HAIKU_COMMON_PLATFORM_OBJECT_DIR)
documentation ] ;
# TODO: Rethink test stuff.
HAIKU_TEST_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) tests
$(TARGET_PLATFORM) $(HAIKU_ARCH) ] ;
HAIKU_APP_TEST_DIR ?= [ FDirName $(HAIKU_TEST_DIR) apps ] ;
HAIKU_APP_TEST_LIB_DIR ?= [ FDirName $(HAIKU_APP_TEST_DIR) lib ] ;
HAIKU_TMP_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) tmp ] ;
local architecture ;
for architecture in $(HAIKU_PACKAGING_ARCHS) {
local baseDir
= [ FDirName $(TARGET_OBJECT_BASE_DIR) $(architecture) packaging ] ;
HAIKU_PACKAGES_DIR_$(architecture) = [ FDirName $(baseDir) packages ] ;
HAIKU_PACKAGES_BUILD_DIR_$(architecture)
= [ FDirName $(baseDir) packages_build ] ;
HAIKU_PACKAGE_REPOSITORIES_DIR_$(architecture)
= [ FDirName $(baseDir) repositories ] ;
}
HAIKU_PACKAGE_INFOS_DIR = [ FDirName $(HAIKU_TOP) src data
package_infos ] ;
TARGET_TEST_DIR ?= [ FDirName $(HAIKU_TEST_DIR)
$(TARGET_PLATFORM) ] ;
TARGET_UNIT_TEST_DIR ?= [ FDirName $(TARGET_TEST_DIR) unittests ] ;
TARGET_UNIT_TEST_LIB_DIR ?= [ FDirName $(TARGET_UNIT_TEST_DIR) lib ] ;
# automatically setup the objects directory per subdirectory
SUBDIRRULES += SetupObjectsDir ;
# Add the standard (userland) warning flags variables to the ones restored in
# every subdirectory. Thus we can easily meddle with them in subdirectories
# with imported sources.
AUTO_SET_UP_CONFIG_VARIABLES +=
HOST_WARNING_CCFLAGS HOST_WARNING_C++FLAGS
TARGET_WARNING_CCFLAGS_$(TARGET_PACKAGING_ARCHS)
TARGET_WARNING_C++FLAGS_$(TARGET_PACKAGING_ARCHS)
;
# also add PLATFORM and SUPPORTED_PLATFORMS
AUTO_SET_UP_CONFIG_VARIABLES += PLATFORM SUPPORTED_PLATFORMS ;
# set up warnings
local architecture ;
for architecture in $(TARGET_PACKAGING_ARCHS) {
ArchitectureSetupWarnings $(architecture) ;
}
build features/bootstrap repo: support secondary arch * Add rule FSplitPackageName. It splits a package name into port name and package suffix. * FSetConditionsHold: Rename to FConditionsHold and replace the set parameter by a predicate rule parameter, thus adding more flexibility. * FIsBuildFeatureEnabled: Use the faster check. * Add rule FQualifiedBuildFeatureName. Given a build feature name, it prepends the current packaging architecture to yield a qualified feature name. Is used by the other build feature rules so that the same build feature can be configured differently for each arch. * ExtractBuildFeatureArchives: The supplied list is now filtered via FFilterByBuildFeatures, allowing for build feature conditions in the list. * Add rule InitArchitectureBuildFeatures. It is called early for each configured architecture, setting up some basic build features for it. "primary" is set for the primary architecture and a "secondary_<arch>" is set for each secondary architecture. * BuildFeatures: Add secondary architecture support: Use the correct paths for libraries and headers (subdir for secondary architecture) and configure the icu and zlib sources only for the primary architecture. * BootstrapPackageRepository: The package lists are now filtered via FFilterByBuildFeatures, allowing for build feature conditions in the lists. * IsPackageAvailable, FetchPackage: Add secondary architecture support. * HaikuPortsCross/x86_gcc2: Add icu and zlib x86 secondary packages. The second stage Haiku cross devel package for the secondary architecture can now be built.
2013-08-05 09:09:45 +04:00
# set up architecture build features
local architecture ;
for architecture in $(TARGET_PACKAGING_ARCHS) {
InitArchitectureBuildFeatures $(architecture) ;
}
# The following directories cannot currently be compiled with DEBUG=1
SetConfigVar DEBUG : HAIKU_TOP src add-ons disk_systems bfs : 0 : local ;
SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel drivers audio hda : 0 : local ;
SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel drivers audio ac97 auich : 0 : local ; # fails with gcc4 only
SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel drivers audio ac97 auvia : 0 : local ; # fails with gcc4 only
SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel drivers audio ac97 sis7018 : 0 : local ;
SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel file_systems btrfs : 0 : local ;
SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel file_systems ntfs libntfs : 0 : local ;
SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel file_systems udf : 0 : local ;
SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel file_systems userlandfs server : 0 : local ; # fails with gcc2 only
SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel file_systems userlandfs server haiku : 0 : local ; # fails with gcc2 only
SetConfigVar DEBUG : HAIKU_TOP src add-ons media media-add-ons dvb : 0 : local ;
SetConfigVar DEBUG : HAIKU_TOP src add-ons print drivers gutenprint : 0 : local ;
SetConfigVar DEBUG : HAIKU_TOP src servers input : 0 : local ;
SetConfigVar DEBUG : HAIKU_TOP src servers media_addon : 0 : local ;
SetConfigVar DEBUG : HAIKU_TOP src system boot loader file_systems bfs : 0 : local ;