- switched some compile-time dependencies to target dependencies, such that

cross-compiling with BeOS target works.
- tweaked build-procedure to allow for proper generation of a i586-pc-beos
  cross-compiler on LINUX.
- added documentation for creation of cross-compiler.


git-svn-id: file:///srv/svn/repos/haiku/trunk/buildtools@11255 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe 2005-02-04 23:37:16 +00:00
parent cb67fd0162
commit 8f01cb10fd
7 changed files with 81 additions and 6 deletions

View File

@ -0,0 +1,74 @@
How to build gcc-2.95.3 for BeOS under Linux (a cross-compiler), which
will allow you to compile BeOS projects under Linux, i.e. the apps
that this compilers produces can only be executed on BeOS (not on Linux).
*** the major work of creating the cross-compiler and describing the
*** process how to build it has been done by Eric Petit <titer@m0k.org>,
*** so if you think this cross-compiler is great, please tell him.
-----------------------------------------------------------------------
On your Linux-box, open a shell...
0 - Preparations
----------------
...and fetch the 'buildtools' module from the haiku CVS. You should then
have a 'buildtools' folder that contains folders named 'binutils' and
'gcc' (and this file, too!).
cd buildtools
Now decide where you want to install the cross-compiler. The install
folder will be referred to as $PREFIX. I suggest to install to
/opt/cross-tools, but you can basically put it anywhere you like.
export PREFIX=/opt/cross-tools
and add it the path:
export PATH=$PATH:$PREFIX/bin
Create two folders for the headers and libraries, say $BEINC and
$BELIB:
mkdir beinc
export BEINC=$(pwd)/beinc
mkdir belib
export BELIB=$(pwd)/belib
Copy all contents from /boot/develop/lib/x86/ on your BeOS install to
$BELIBS on your Linux box (make sure symbolic links are followed). You
should have $BELIBS/libbe.so, etc.
Copy all contents from /boot/develop/headers/ on your BeOS install to
$BEINCS on your Linux box. You should have $BEINCS/be/AppKit.h, etc.
1 - Building binutils
---------------------
mkdir binutils-obj
cd binutils-obj
CFLAGS="-O2" CXXFLAGS="-O2" ../binutils/configure --prefix=$PREFIX \
--target=i586-pc-beos --disable-nls --enable-shared=yes
make && make install
cd ..
2 - Building gcc/g++
--------------------
mkdir -p $PREFIX/lib/gcc-lib/i586-pc-beos/2.95.3-beos-041202
mkdir gcc-obj
cd gcc-obj
CFLAGS="-O2" CXXFLAGS="-O2" ../gcc/configure --prefix=$PREFIX \
--target=i586-pc-beos --disable-nls --enable-shared=yes \
--enable-languages=c,c++ --with-headers=$BEINC --with-libs=$BELIB
make cross && make install
cd ..
Ok, now everything is compiled and installed, waiting to be used:
i586-pc-beos-gcc test.c
would compile the file test.c with the fresh cross-compiler.
So have fun!
Please send questions & bug-reports to: Oliver Tappe <gcc@hirschkaefer.de>

View File

@ -543,6 +543,7 @@ case "${targ}" in
i[3-7]86-*-beoself* | i[3-7]86-*-beos*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="i386pe_vec i386pei_vec"
targ_cflags=-DDT_RELCOUNT_IS_UNKNOWN_ON_TARGET
;;
i[3-7]86-*-interix*)
targ_defvec=i386pei_vec

View File

@ -7814,7 +7814,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
default:
continue;
/* BeOS (R5) doesn't know about DT_RELCOUNT, so we avoid using it */
#ifndef __BEOS__
#ifndef DT_RELCOUNT_IS_UNKNOWN_ON_TARGET
case DT_NULL:
if (relativecount > 0 && dyncon + bed->s->sizeof_dyn < dynconend)
{

View File

@ -19,4 +19,4 @@ EXTRA_PARTS += fix_bdirectwin_typeinfo.o
# function as provided by the Be-libs (which crashes GLTeapot).
#
fix_bdirectwin_typeinfo.o: $(srcdir)/beos-specific/fix_bdirectwin_typeinfo.cpp
gcc -c -O0 $(srcdir)/beos-specific/fix_bdirectwin_typeinfo.cpp
$(GCC_FOR_TARGET) -c -O0 $(srcdir)/beos-specific/fix_bdirectwin_typeinfo.cpp

View File

@ -350,7 +350,7 @@ flush_repeats (nrepeats, type)
return 0;
}
#ifdef __BEOS__
#ifdef USE_EGCS_MANGLED_NAMES
if (TREE_CODE(type) == POINTER_TYPE
&& TREE_CODE(TREE_TYPE(type)) == ARRAY_TYPE)
{

View File

@ -5,7 +5,9 @@ LIBGCC1 = $(CROSS_LIBGCC1)
# Dir to search for system headers. Normally /usr/include.
# Use CROSS_INCLUDE_DIR not TOOL_INCLUDE_DIR for other vendor's headers.
SYSTEM_HEADER_DIR = $(tooldir)/sys-include
# SYSTEM_HEADER_DIR = $(tooldir)/sys-include
# [zooey]: gcc looks for limits.h and float.h which under BeOS live in posix subfolder:
SYSTEM_HEADER_DIR = $(tooldir)/sys-include/posix
# Don't try to compile the things we can't compile.
ALL = all.cross

View File

@ -31,14 +31,12 @@ Boston, MA 02111-1307, USA. */
#include "tm.h"
#include <signal.h>
#ifdef __BEOS__
#include "gnu-regex.h"
#define xregcomp regcomp
#define xregexec regexec
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
#define TOUPPER(c) toupper((c))
#define ISIDNUM(c) (isalnum((c))||(c)=='_')
#endif
#include "machname.h"
#include "libiberty.h"