[Mono-list] Cygwin build script

Norman Lorrain normanlorrainmailinglists@telus.net
Mon, 20 Jan 2003 21:07:58 -0700


This is a multi-part message in MIME format.

------=_NextPart_000_0001_01C2C0C8.03615DA0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

This may be useful for those using Win32/Cygwin

I modified the mono-build-w32.sh script to build from a tarball.
It also creates a unique install directory, e.g. install-0.19, letting
you keep the releases separate.

The new script is mono-build-given-w32.sh (see attached)

Good job on the 0.19 release!

Norman 

------=_NextPart_000_0001_01C2C0C8.03615DA0
Content-Type: application/octet-stream;
	name="mono-build-given-w32.sh"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="mono-build-given-w32.sh"

#!/bin/bash=0A=
#similar to mono-build-w32, only here we are setting up and building a =0A=
# given tarball of mono=0A=
=0A=
=0A=
echo "installing tarball for mono Release $1"=0A=
if [ ! -f mono-$1.tar.gz ]=0A=
then =0A=
    echo "Can't find mono-$1.tar.gz"=0A=
    echo "USAGE:  $0 <release number>"=0A=
    exit -1=0A=
fi=0A=
=0A=
=0A=
=0A=
=0A=
echo "checking cygwin environment..."=0A=
DIE=3D0=0A=
test_file ()=0A=
{=0A=
  if [ ! -f $2/$1 ]=0A=
  then =0A=
    echo "$1 is missing."=0A=
    DIE=3D1=0A=
  fi=0A=
}=0A=
=0A=
test_file wget /usr/bin=0A=
test_file tar /usr/bin=0A=
test_file make /usr/bin=0A=
test_file automake /usr/bin=0A=
test_file libiconv.la /usr/lib =0A=
    =0A=
if [ $DIE -eq 1 ]=0A=
then=0A=
    echo "Please run Cygwin setup and install missing packages" =0A=
    exit -1=0A=
else=0A=
    echo "Cygwin OK"=0A=
fi=0A=
=0A=
=0A=
# Set up install directory=0A=
here=3D`pwd`=0A=
install_dir=3D$here/install-$1=0A=
=0A=
echo "Building Mono and dependencies in $here-$1, installing to =
$install_dir"=0A=
=0A=
PATH=3D$install_dir/bin:$install_dir/lib:$PATH=0A=
=0A=
# Check mono out first, so we can run aclocal from inside the mono dir =
(it=0A=
# needs to see which version of the real aclocal to run)=0A=
test -z "$CVSROOT" && =
CVSROOT=3D:pserver:anonymous@anoncvs.go-mono.com:/mono=0A=
export CVSROOT=0A=
=0A=
echo "opening up tarball mono"=0A=
tar xzvf mono-$1.tar.gz=0A=
=0A=
echo "Checking automake version"=0A=
automake_required=3D"1.6.2"=0A=
automake_version=3D`automake --version | head -1 | awk '{print $4}' | tr =
-d '[a-zA-Z]' | sed 's/-.*$//g'`=0A=
echo "Found automake version $automake_version"=0A=
if expr $automake_version \< $automake_required > /dev/null; then=0A=
	echo "Your automake is too old!  You need version $automake_required or =
newer."=0A=
	exit -1=0A=
else=0A=
	echo "Automake version new enough."=0A=
fi=0A=
=0A=
# Select the stable version anyway...=0A=
if [ ! -z "${AUTO_STABLE}" -o -e /usr/autotool/stable ]; then=0A=
    export AUTO_STABLE=3D${AUTO_STABLE:-/usr/autotool/stable}=0A=
    export AUTO_DEVEL=3D${AUTO_STABLE}=0A=
fi=0A=
=0A=
# Need to install pkgconfig and set ACLOCAL_FLAGS if there is not a=0A=
# pkgconfig installed already.  Otherwise set PKG_CONFIG_PATH to the=0A=
# glib we're about to install in $install_dir.=0A=
=0A=
=0A=
# --print-ac-dir was added in 1.2h according to the ChangeLog.  This=0A=
# should mean that any automake new enough for us has it.=0A=
=0A=
# This sets ACLOCAL_FLAGS to point to the freshly installed pkgconfig=0A=
# if it doesnt already exist on the system (otherwise auto* breaks if=0A=
# it finds two copies of the m4 macros).  The GIMP for Windows=0A=
# pkgconfig sets its prefix based on the location of its binary, so we=0A=
# dont need PKG_CONFIG_PATH (the internal pkgconfig config file=0A=
# $prefix is handled similarly). For the cygwin pkgconfig we do need to=0A=
# set it, and we need to edit the mingw pc files too.=0A=
=0A=
function aclocal_scan () {=0A=
    # Quietly ignore the rogue '-I' and other aclocal flags that=0A=
    # aren't actually directories...=0A=
    #=0A=
    # cd into mono/ so that the aclocal wrapper can work out which =
version=0A=
    # of aclocal to run, and add /usr/share/aclocal too cos aclocal =
looks there=0A=
    # too.=0A=
    for i in `(cd mono && aclocal --print-ac-dir)` /usr/share/aclocal =
$ACLOCAL_FLAGS=0A=
    do=0A=
	if [ -f $i/$1 ]; then=0A=
	    return 0=0A=
	fi=0A=
    done=0A=
=0A=
    return 1=0A=
}=0A=
=0A=
function install_package() {=0A=
    zipfile=3D$1=0A=
    markerfile=3D$2=0A=
    name=3D$3=0A=
=0A=
    echo "Installing $name..."=0A=
    if [ ! -f $here/$zipfile ]; then=0A=
	wget http://www.go-mono.com/archive/$zipfile=0A=
    fi=0A=
=0A=
    # Assume that the package is installed correctly if the marker=0A=
    # file is there=0A=
    if [ ! -f $install_dir/$markerfile ]; then=0A=
	(cd $install_dir || exit -1; unzip -o $here/$zipfile || exit -1) || =
exit -1=0A=
    fi=0A=
}=0A=
=0A=
# pkgconfig is only used during the build, so we can use the cygwin =
version=0A=
# if it exists=0A=
if aclocal_scan pkg.m4 ; then=0A=
    install_pkgconfig=3Dno=0A=
else=0A=
    install_pkgconfig=3Dyes=0A=
fi=0A=
=0A=
# But we still need to use the mingw libs for glib & co=0A=
ACLOCAL_FLAGS=3D"-I $install_dir/share/aclocal $ACLOCAL_FLAGS"=0A=
=0A=
export PATH=0A=
export ACLOCAL_FLAGS=0A=
=0A=
# Grab pkg-config, glib etc=0A=
if [ ! -d $install_dir ]; then=0A=
    mkdir $install_dir || exit -1=0A=
fi=0A=
=0A=
# Fetch and install pkg-config, glib, iconv, intl=0A=
=0A=
if [ $install_pkgconfig =3D "yes" ]; then=0A=
    install_package pkgconfig-0.11-20020310.zip bin/pkg-config.exe =
pkgconfig=0A=
else=0A=
    echo "Not installing pkgconfig, you already seem to have it =
installed"=0A=
fi=0A=
install_package glib-2.0.4-20020703.zip lib/libglib-2.0-0.dll glib=0A=
install_package glib-dev-2.0.4-20020703.zip lib/glib-2.0.lib glib-dev=0A=
install_package libiconv-1.7.zip lib/iconv.dll iconv=0A=
install_package libintl-0.10.40-20020101.zip lib/libintl-1.dll intl=0A=
install_package libgc-dev.zip lib/gc.dll gc-dev=0A=
=0A=
if [ $install_pkgconfig =3D "no" ]; then=0A=
    echo "Fixing up the pkgconfig paths"=0A=
    for i in $install_dir/lib/pkgconfig/*.pc=0A=
    do=0A=
	mv $i $i.orig=0A=
	sed -e "s@^prefix=3D/target\$@prefix=3D$install_dir@" < $i.orig > $i=0A=
    done=0A=
    export PKG_CONFIG_PATH=3D$install_dir/lib/pkgconfig=0A=
fi=0A=
=0A=
# Needed to find the libgc bits=0A=
CPPFLAGS=3D"$CPPFLAGS -I$install_dir/include"=0A=
LDFLAGS=3D"$LDFLAGS -L$install_dir/lib"=0A=
export CPPFLAGS=0A=
export LDFLAGS=0A=
=0A=
# Make sure we build native w32, not cygwin=0A=
#CC=3D"gcc -mno-cygwin"=0A=
#export CC=0A=
=0A=
# --prefix is used to set the class library dir in mono, and it needs=0A=
# to be in windows-native form.  It also needs to have '\' turned into=0A=
# '/' to avoid quoting issues during the build.=0A=
prefix=3D`cygpath -w $install_dir | sed -e 's@\\\\@/@g'`=0A=
=0A=
# Build and install mono=0A=
echo "Building and installing mono"=0A=
=0A=
(cd $here/mono-$1; ./configure --prefix=3D$prefix || exit -1; make || =
exit -1; make install || exit -1) || exit -1=0A=
=0A=
=0A=
echo ""=0A=
echo ""=0A=
echo "All done."=0A=
echo "Add $install_dir/bin and $install_dir/lib to your \$PATH =
environment"=0A=
echo "Don't forget to copy the class libraries to $install_dir/lib"=0A=
=0A=

------=_NextPart_000_0001_01C2C0C8.03615DA0--