Patch by Samuel Rodriguez Perez, slightly modified by myself: New

configure flag "--use-32bit" enabling 32 bit builds with a 64 bit host
compiler.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22046 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2007-08-22 22:07:03 +00:00
parent 2652981136
commit 0385b0657b
3 changed files with 49 additions and 31 deletions

View File

@ -346,6 +346,12 @@ HAIKU_BUILD_DESCRIPTION ?= "Unknown Build" ;
# host platform settings
# enable GCC -m32 option, if requested
if $(HAIKU_HOST_USE_32BIT) = 1 {
HOST_GCC_BASE_FLAGS = -m32 ;
}
# save jam's variables for the build platform
HOST_AR ?= $(AR) ;
HOST_CC ?= $(CC) ;
@ -355,13 +361,14 @@ HOST_LD ?= ld ; # TODO: Fix this!
HOST_OBJCOPY ?= objcopy ; #
HOST_RANLIB ?= $(RANLIB) ;
HOST_CPPFLAGS ?= $(CPPFLAGS) ;
HOST_CCFLAGS ?= $(CCFLAGS) ;
HOST_C++FLAGS ?= $(C++FLAGS) ;
HOST_LDFLAGS ?= $(LDFLAGS) ;
HOST_LINKFLAGS ?= $(LINKFLAGS) ;
HOST_CCFLAGS ?= $(HOST_GCC_BASE_FLAGS) $(CCFLAGS) ;
HOST_C++FLAGS ?= $(HOST_GCC_BASE_FLAGS) $(C++FLAGS) ;
HOST_LDFLAGS ?= $(HOST_GCC_BASE_FLAGS) $(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-]) ;
@ -415,10 +422,10 @@ HOST_C++FLAGS += -Wno-multichar ;
HOST_PIC_CCFLAGS += -fPIC ;
HOST_PIC_C++FLAGS += -fPIC ;
HOST_KERNEL_CCFLAGS += -finline -fno-builtin
-DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ;
HOST_KERNEL_C++FLAGS += -finline -fno-builtin -fno-exceptions
HOST_KERNEL_CCFLAGS += $(HOST_GCC_BASE_FLAGS) -finline -fno-builtin
-DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ;
HOST_KERNEL_C++FLAGS += $(HOST_GCC_BASE_FLAGS) -finline -fno-builtin
-fno-exceptions -DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ;
HOST_KERNEL_PIC_CCFLAGS = -fno-pic ;
HOST_KERNEL_PIC_LINKFLAGS = ;
@ -465,6 +472,11 @@ for level in $(HAIKU_DEBUG_LEVELS[2-]) {
HOST_KERNEL_DEBUG_$(level)_C++FLAGS = $(flags) ;
}
# ld flags
if $(HOST_ARCH) = x86 && $(HAIKU_HOST_USE_32BIT) = 1 {
HOST_LDFLAGS += -melf_i386 ;
}
# private kernel headers do be used when compiling kernel code
HOST_PRIVATE_KERNEL_HEADERS = ;
@ -517,7 +529,7 @@ if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
} else if $(HOST_PLATFORM) = darwin {
HOST_LIBROOT += /opt/local/lib/libgnuregex.dylib ;
}
# The BeOS compilers define __INTEL__ respectively __POWERPC__. On the
# build platform we need to make sure, this is also defined.

View File

@ -2,7 +2,7 @@
rule AddSharedObjectGlueCode
{
# AddSharedObjectGlueCode <target> : <isExecutable> ;
# we link with -nostdlib and add the required libs manually, when building
# for Haiku
local platform ;
@ -94,7 +94,7 @@ rule Preference
rule Server
{
# Server <name> : <sources> : <libraries> : <res> ;
Executable $(1) : $(2) : $(3) : $(4) ;
}
@ -141,7 +141,7 @@ rule StaticLibrary
# <lib>: The static library to be built.
# <sources>: List of source files.
# <otherObjects>: List of additional object files.
#
#
local lib = $(1) ;
local sources = [ FGristFiles $(2) ] ;
local otherObjects = $(3) ;
@ -192,12 +192,12 @@ rule Ld
NEEDLIBS on $(target) = $(NEEDLIBS) ;
LINKLIBS on $(target) = $(LINKLIBS) ;
}
LocalClean clean : $(target) ;
LocalDepends all : $(target) ;
Depends $(target) : $(objects) ;
MakeLocateDebug $(target) ;
MakeLocateDebug $(target) ;
}
actions Ld
@ -224,8 +224,10 @@ rule MergeObjectFromObjects
if $(PLATFORM) = host {
LINK on $(1) = $(HOST_LD) ;
LINKFLAGS on $(target) = $(HOST_LDFLAGS) ;
} else {
LINK on $(1) = $(TARGET_LD) ;
LINKFLAGS on $(target) = $(TARGET_LDFLAGS) ;
}
}
@ -238,7 +240,7 @@ rule MergeObjectFromObjects
actions MergeObjectFromObjects1
{
$(LINK) -r $(2) -o $(1) ;
$(LINK) $(LINKFLAGS) -r $(2) -o $(1) ;
}
rule MergeObject
@ -362,7 +364,7 @@ rule LinkAgainst
linkLibs += $(i) ;
}
}
NEEDLIBS on $(1) = $(NEEDLIBS) $(needLibs) ;
LINKLIBS on $(1) = $(LINKLIBS) -l$(linkLibs) ;
@ -403,10 +405,10 @@ rule BuildPlatformObjects
{
# Usage BuildPlatformObjects <sources> ;
# <sources> The sources.
#
#
local sources = [ FGristFiles $(1) ] ;
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
PLATFORM on $(objects) = host ;
SUPPORTED_PLATFORMS on $(objects) = host ;
@ -419,7 +421,7 @@ rule BuildPlatformMain
# <target> The executable/library.
# <sources> The sources.
# <libraries> Libraries to link against.
#
#
local target = $(1) ;
local sources = $(2) ;
local libs = $(3) ;
@ -440,7 +442,7 @@ rule BuildPlatformMain
NEEDLIBS on $(target) += $(HOST_LIBROOT) ;
}
}
Main $(target) : $(sources) ;
LinkAgainst $(target) : $(libs) ;
}
@ -455,7 +457,7 @@ rule BuildPlatformSharedLibrary
local target = $(1) ;
local sources = $(2) ;
local libs = $(3) ;
BuildPlatformMain $(target) : $(sources) : $(libs) ;
if $(HOST_PLATFORM) = darwin {
@ -467,8 +469,8 @@ rule BuildPlatformSharedLibrary
}
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
CCFLAGS on $(objects) += $(HOST_PIC_CCFLAGS) ;
C++FLAGS on $(objects) += $(HOST_PIC_C++FLAGS) ;
CCFLAGS on $(objects) += $(HOST_PIC_CCFLAGS) ;
C++FLAGS on $(objects) += $(HOST_PIC_C++FLAGS) ;
}
rule BuildPlatformMergeObject
@ -484,7 +486,7 @@ rule BuildPlatformMergeObject
local sources = $(2) ;
local otherObjects = $(3) ;
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
PLATFORM on $(target) = host ;
SUPPORTED_PLATFORMS on $(target) = host ;
@ -520,11 +522,11 @@ rule BuildPlatformStaticLibrary
# Creates a static library from sources.
# <lib>: The library.
# <sources>: List of source files.
local lib = $(1) ;
local sources = $(2) ;
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
PLATFORM on $(lib) = host ;
SUPPORTED_PLATFORMS on $(lib) = host ;

16
configure vendored
View File

@ -12,7 +12,7 @@ usage()
Usage: $0 <options>
options:
--bochs-debug Enables bochs serial debug emulation (activated
--bochs-debug Enables bochs serial debug emulation (activated
via kernel settings file).
--build-cross-tools <build tools dir>
Assume cross compilation. <build tools dir>
@ -47,6 +47,7 @@ options:
valid targets=r5,bone,dano,haiku
--use-gcc-pipe Build with GCC option -pipe. Speeds up the build
process, but uses more memory.
--use-32bit Use -m32 flag on 64bit host gcc compiler.
--use-xattr Use Linux xattr support for BeOS attribute
emulation. Warning: Make sure your file system
supports sufficient attribute sizes (4 KB per
@ -105,7 +106,7 @@ standard_gcc_settings()
haikuGCCVersion=`$HAIKU_CC -dumpversion`
haikuGCCMachine=`$HAIKU_CC -dumpmachine`
HAIKU_GCC_LIB_DIR=${gccdir}
HAIKU_GCC_LIBGCC=${gccdir}/libgcc.a
HAIKU_GCC_GLUE_CODE="crtbegin.o crtend.o"
@ -131,8 +132,8 @@ standard_gcc_settings()
$headers/$d"
done
# when not building the crosscompiler, to use cpp headers from
# when not building the crosscompiler, to use cpp headers from
# tree first, but fallback to local C++ system headers (like <new>)
# if [ "$buildCrossTools" = "" ]; then
# haikuCxxHeadersDir="headers/cpp $haikuCxxHeadersDir"
@ -181,7 +182,7 @@ get_build_tool_path()
local var="HAIKU_$1"
local tool=$2
local path="${crossToolsPrefix}$tool"
if [ -f "$path" ]; then
# get absolute path
local oldPwd=$(pwd)
@ -194,7 +195,7 @@ get_build_tool_path()
exit 1
}
fi
eval "$var=$path"
}
@ -220,6 +221,7 @@ include_gpl_addons=0
distroCompatibility=default
target=haiku
use_gcc_pipe=0
use_32bit=0
use_xattr=0
crossToolsPrefix=
buildCrossTools=
@ -273,6 +275,7 @@ while [ $# -gt 0 ] ; do
shift 2;;
--target=*) target=`echo $1 | cut -d'=' -f2-`; shift 1;;
--use-gcc-pipe) use_gcc_pipe=1; shift 1;;
--use-32bit) use_32bit=1; shift 1;;
--use-xattr) use_xattr=1; shift 1;;
*) echo Invalid argument: \`$1\'; exit 1;;
esac
@ -350,6 +353,7 @@ BOCHS_DEBUG_HACK ?= "${bochs_debug}" ;
INCLUDE_GPL_ADDONS ?= "${include_gpl_addons}" ;
HAIKU_DISTRO_COMPATIBILITY ?= "${distroCompatibility}" ;
HAIKU_USE_GCC_PIPE ?= "${use_gcc_pipe}" ;
HAIKU_HOST_USE_32BIT ?= "${use_32bit}" ;
HAIKU_HOST_USE_XATTR ?= "${use_xattr}" ;
HAIKU_GCC_RAW_VERSION ?= ${haikuGCCVersion} ;