#!/bin/sh #this is a bash shell script to make a linux/cygwin32 cross compiler #it is designed to hopefully :^) minimize disk space usage, and #maximize the speed of the resulting cross-compiler set -a #export all variables #echo change the following variables to fit your setup CROSS_PREFIX=/dos/c/usr CWD=`pwd` GXXINCLUDE=$CROSS_PREFIX/include/g++ MY_HOST_COMPILER=i586-unknown-linux CC=gcc CPPNAME="gcc -E" SRC_DIR=$CROSS_PREFIX/src/cygwin32 CYG_VER=cygnus-2.7.2-961023 if [ ! -f $SRC_DIR/CYGNUS ];then echo "please show me the source Luke :^)" exit 1; fi # first make sure only the necessary dirs get built [ -d $SRC_DIR/znobuild ] || mkdir -p $SRC_DIR/znobuild if [ -d $SRC_DIR/byacc ];then pushd $SRC_DIR mv -f bash byacc dejagnu diff dosrel expect fileutils findutils flex gawk \ gdb gprof grep grez gzip less libg++ libgloss libio librx libstdc++ m4 \ make mmalloc ncurses newlib patch readline release sed send-pr \ shellutils sim tar tcl texinfo textutils time tk utils winsup xiberty \ znobuild/ popd fi if [ x"$TMP" = x ];then [ -d /tmp ] || mkdir /tmp TMP=/tmp; fi cd $TMP mkdir -p cx32o tmp/usr if [ ! -f $SRC_DIR/binutils/Makefile.in.* ];then patch -p0 -d $SRC_DIR/binutils/ < $CWD/ar_obj.dif; fi if [ ! -f $SRC_DIR/gas/Makefile.in.* ];then patch -p0 -d $SRC_DIR/gas/ < $CWD/gas.dif; fi cd cx32o if [ ! -f config.status ];then $SRC_DIR/configure --prefix=/usr\ --enable-commonbfdlib --enable-shared\ --host=$MY_HOST_COMPILER\ --target=i386-cygwin32 -v fi make CFLAGS="-O3 -m486 -malign-jumps=2 -malign-functions=2 -malign-loops=2 -fno-strength-reduce" LDFLAGS=-s make CFLAGS="-O3 -m486 -malign-jumps=2 -malign-functions=2 -malign-loops=2 -fno-strength-reduce" LDFLAGS=-s -C binutils/ ar_with_ranlib objcopy_with_strip make prefix=$TMP/tmp/usr install #this causes a bad invocation of cpp at least for me :^) so get rid of it. sed s/%\\[cpp_cpu\\]// < gcc/specs > $TMP/tmp/usr/lib/gcc-lib/i386-cygwin32/$CYG_VER/specs cd ../tmp/usr/bin rm protoize unprotoize ln -sf i386-cygwin32-ar i386-cygwin32-ranlib ln -sf i386-cygwin32-objcopy i386-cygwin32-strip ln -sf i386-cygwin32-g++ i386-cygwin32-c++ strip * cd ../lib rm -fr *.a ../man ../info strip * cd ../include ln -sf GXXINCLUDE g++cygwin32 cd ../i386-cygwin32/bin rmdir ../install-tools #how this got here I have no idea :) ln -sf ../../bin/i386-cygwin32-ar ranlib ln -sf ../../bin/i386-cygwin32-ar ar ln -sf ../../bin/i386-cygwin32-gcc gcc ln -sf ../../bin/i386-cygwin32-as as ln -sf ../../bin/i386-cygwin32-dlltool dlltool ln -sf ../../bin/i386-cygwin32-ld ld ln -sf ../../bin/i386-cygwin32-nm nm ln -sf ../../bin/i386-cygwin32-objcopy strip # for when you have to reset path in the Makefile to use all cross tools ln -sf ../../bin/i386-cygwin32-g++ g++ ln -sf ../../bin/i386-cygwin32-g++ c++ ln -sf ../../bin/i386-cygwin32-c++filt c++filt ln -sf ../../bin/i386-cygwin32-gasp gasp ln -sf ../../bin/i386-cygwin32-objcopy objcopy ln -sf ../../bin/i386-cygwin32-objdump objdump ln -sf ../../bin/i386-cygwin32-size size ln -sf ../../bin/i386-cygwin32-strings strings rm -fr ../include ../lib cd .. ln -s $CROSS_PREFIX/H-i386-cygwin32/i386-cygwin32/include include ln -s $CROSS_PREFIX/H-i386-cygwin32/i386-cygwin32/lib lib cd ../lib/gcc-lib/i386-cygwin32/$CYG_VER/ strip c* ld rm -fr include ln -s $CROSS_PREFIX/H-i386-cygwin32/lib/gcc-lib/i386-cygwin32/$CYG_VER/include include cd $TMP/tmp makepkg cx32.tgz;mv cx32.tgz .. # or put your binary package maker here cd $TMP if [ x"$1" = x--cleanup ];then rm -fr $TMP/tmp $TMP/cx32o; pushd $SRC_DIR mv -f znobuild/* . rmdir znobuild popd fi