This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

building Linux --> gnuwin32 crosscompiler


I finally succeded in building this beast.
Below is a commented script that does the who|e job.
If somebody knows a better way to do it, give me a holler.

	-ulrich

:
# script for building a Linux -> gnuwin32 cross compiler
# to be run from the cdk source directory, e.g., /usr/local/src/cdk
# you will need (after installing the cdk source) about 75 MByte of free
# disk space
# I assume, that the binary gnuwin32 package is already installed on a
# mounted NT or 95 VFAT partition.

# change this for yor setup:

NT_LOCATION=/dos/gnuwin32/b18	# where your native gnuwin32 package lives
PREFIX=/usr/gnuwin32            # where to install the cross compiler system
BINDIR=/usr/local/bin           # this should be in your PATH
                                # a symlink gnuwin32gcc will be made here

make distclean

./configure --host=i586-pc-linux-gnu --target=i586-pc-cygwin32 --prefix=$PREFIX

cd i586-pc-cygwin32
ln -s ../include include 
ln -s ../install-sh install-sh
cd ..

# this will fail to build gcc
make > make1.out 2> make1.err   

# prevent the cross assembler to be used when building build gcc
rm gcc/as 
# and try again ...
make > make2.out 2> make2.err   

make install > make3.out 2> make3.err   

# make links to include files and libs not installed by above commands

rm -rf $PREFIX/i586-pc-cygwin32/include
ln -s $NT_LOCATION/H-i386-cygwin32/i386-cygwin32/include \
      $PREFIX/i586-pc-cygwin32/include

ln -s $NT_LOCATION/include/g++\
      $PREFIX/include

rm -rf $PREFIX/i586-pc-cygwin32/lib
ln -s $NT_LOCATION/H-i386-cygwin32/i386-cygwin32/lib \
      $PREFIX/i586-pc-cygwin32/lib

# make link in /usr/local/bin to the cross gcc executable:

rm -f $BINDIR/gnuwin32gcc
ln -s $PREFIX/i586-pc-cygwin32/bin/gcc $BINDIR/gnuwin32gcc

# fix the libs:

for i in $PREFIX/lib/gcc-lib/i586-pc-cygwin32/cygnus-2.7.2-970404/*.a
do 
  ranlib $i
done

# fix permissions:

chmod -R a+r $PREFIX

# now a quick test:

cat << EOF > /tmp/hello.C
#include <stdio.h>
main () {
  printf("Hello World!\n");
}
EOF

gnuwin32gcc -o hello.exe /tmp/hello.C

# now carry hello.exe to a Window 95 or NT system and enjoy!


# make a distribution:

tar czf /tmp/gnuwin32-cross.tgz $PREFIX $BINDIR/gnuwin32gcc
-- 
	-lauther

----------------------------------------------------------------------------
Ulrich Lauther          ph: +49 89 636 48834 fx: ... 636 42284
Siemens ZT AN 1         Internet: Ulrich.Lauther@mchp.siemens.de
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]