This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: trying to build a mingw compiler on cygwin


Stephen Smith wrote:

I finally got the compiler to build (on a cygwin host) here is the script:

******************** Start of Script ********************************
#! /bin/bash

export INSTALL_LOC="`pwd`/htc/mingw32"
export PATH=${INSTALL_LOC}/bin:$PATH

set -e

export GCC=`which gcc`
export CC="${GCC}"
export GCC_SRC_LOCATION=../gcc-2.95.2-6
export GCC_LANGUAGES="c,c++"

#---------------------------------------------------------------------------------
currentDirectory=`pwd`

BINUTILS_BUILD_DIR=binutils_build
GCC_CORE_BUILD_DIR=gcc_core_build
GCC_FULL_BUILD_DIR=gcc_full_build
WIN32_BUILD=win32_build
MINGW_BUILD_DIR=minglib_build
MINGW_TREE=copies
mkdir -p ${BINUTILS_BUILD_DIR} ${GCC_CORE_BUILD_DIR} ${MINGW_BUILD_DIR} ${WIN32_BUILD} ${GCC_FULL_BUILD_DIR} ${MINGW_TREE}/usr/lib/mingw ${MINGW_TREE}/usr/include/mingw/g++-3 ${MINGW_TREE}/usr/include/mingw/w32api ${MINGW_TREE}/usr/include/mingw/sys ${MINGW_TREE}/usr/include/mingw/objc ${MINGW_TREE}/usr/include/mingw/2.95.2-6/include

#build binutils
cd ${BINUTILS_BUILD_DIR}
${currentDirectory}/binutils*/configure --target=mingw32 --prefix=${INSTALL_LOC}
make 2>&1 | tee make.out
make install 2>&1 | tee make-install.out
cd ${currentDirectory}

# Copy mingw include files
mkdir -p ${INSTALL_LOC}/i386-mingw32/include ${INSTALL_LOC}/include ${INSTALL_LOC}/mingw32/include
cd ${currentDirectory}/cygwin-*/winsup/mingw/include/
cp -pr * ${INSTALL_LOC}/i386-mingw32/include
cp -pr * ${INSTALL_LOC}/include
cp -pr * ${INSTALL_LOC}/mingw32/include
cd ${currentDirectory}

# build a *minimal* compiler
cd ${GCC_CORE_BUILD_DIR}
${currentDirectory}/gcc*/configure --with-gcc --with-ld --with-as --target=mingw32 --prefix=${INSTALL_LOC}
cd gcc
make installdirs
cd ..
make LANGUAGES=c all-gcc 2>&1 | tee make.log
make LANGUAGES=c install-gcc 2>&1 | tee install.log
cd ${currentDirectory}

# build the libraries
cd ${WIN32_BUILD}
${currentDirectory}/cygwin-*/winsup/w32api/configure --prefix=${INSTALL_LOC} --target=mingw32
make 2>&1 | tee make.log
make install 2>&1 | tee install.log
cd ${currentDirectory}

cd ${MINGW_BUILD_DIR}
export MING_AS=`ls ${INSTALL_LOC}/bin/*-as.exe`
export MING_LD=`ls ${INSTALL_LOC}/bin/*-ld.exe`
export MING_GCC=`ls ${INSTALL_LOC}/bin/*-gcc.exe`
export CC=${MING_GCC}
${currentDirectory}/cygwin-*/winsup/mingw/configure --prefix=${INSTALL_LOC} --target=mingw32
make 2>&1 | tee make.log
cp -p ${currentDirectory}/cygwin-*/winsup/mingw/mkinstalldirs ${currentDirectory}/cygwin-*/winsup/mkinstalldirs
make install 2>&1 | tee install.log
cd ${currentDirectory}

# Build the full compiler. this will get us the c++ libraries
cd ${GCC_FULL_BUILD_DIR}
export CC=${GCC}
${currentDirectory}/gcc*/configure --with-gcc --with-ld --with-as --target=mingw32 --prefix=${INSTALL_LOC}
make 2>&1 | tee make.log
make install 2>&1 | tee install.log
cd ${currentDirectory}

# Get files to be able to populate the cygwin tree
mv `find ${INSTALL_LOC} | grep -e "\.dll"` `find ${INSTALL_LOC} | grep -e "\.a"` ${MINGW_TREE}/usr/lib/mingw
mv `find ${INSTALL_LOC} | grep -e "\.o"` ${MINGW_TREE}/usr/lib/mingw
mv `find ${INSTALL_LOC} | grep -e "\.h" | grep "w32api"` ${MINGW_TREE}/usr/include/mingw/w32api
mv `find ${INSTALL_LOC} | grep -e "\.h" | grep 'g++'` ${MINGW_TREE}/usr/include/mingw/g++-3
mv `find ${INSTALL_LOC} | grep -e "\.h" | grep '/sys/'` ${MINGW_TREE}/usr/include/mingw/sys
mv `find ${INSTALL_LOC} | grep -e "\.h" | grep '/objc/'` ${MINGW_TREE}/usr/include/mingw/objc
mv `find ${INSTALL_LOC} | grep -e "\.h" | grep '/2.95.2-6/'` ${MINGW_TREE}/usr/include/mingw/2.95.2-6/include
mv `find ${INSTALL_LOC} | grep -e "\.h"` ${MINGW_TREE}/usr/include/mingw
(cd ${MINGW_TREE}/usr/include/mingw/2.95.2-6/include; for f in *; do if [ ! -f ../../$f ]; then mv $f ../../$f; fi; done)
(cd ${MINGW_TREE}; tar -cvjf ../mingw-library.tar.bz2 *)






------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


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