⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mono-build.sh

📁 C#语言编译器和库文件源码
💻 SH
字号:
#! /usr/bin/env bash# Script to automate the building of mono and its dependencies.# Relies on wget being installed (could make it fall back to using# lynx, links, w3, curl etc), assumes that gcc, make, tar, automake,# etc are already installed too (may be worth testing for all that# right at the top and bailing out if missing/too old/too new etc).# See where we are.  This will become the top level directory for the# installation, unless we are given an alternative locationhere=$1test -z "$here" && here=`pwd`echo "Building Mono and dependencies in $here, installing to $here/install"PATH=$here/install/bin:$PATHLD_LIBRARY_PATH=$here/install/lib:$LD_LIBRARY_PATH# Find a tool to fetch files. It must take an HTTP URL on the command line and# save the file in the current directory.  (It must also talk HTTP/1.1, which# rules out BSD's ftp(1), at least on FreeBSD 4.4.)viable_downloaders="wget fetch"for i in $viable_downloadersdo    if which $i > /dev/null; then	downloader=`which $i`	break    fidoneif [ -z "$downloader" ]; then    echo "Can't find a commandline download tool (tried: $viable_downloaders)"    exit -1else    echo "Using $downloader to fetch files"fi # We need to prefer GNU make if there's a choice.  BSD make falls over in# the glib build if gtk-doc is disabled.viable_makers="gmake make"for i in $viable_makersdo    if which $i > /dev/null; then	MAKE=$i	break    fidoneif [ -z "$MAKE" ]; then    echo "Can't find a make tool (tried: $viable_makers)"    exit -1else    echo "Using $MAKE"    export MAKEfi# Need to install pkgconfig and set ACLOCAL_FLAGS if there is not a# pkgconfig installed already.  Otherwise set PKG_CONFIG_PATH to the# glib we're about to install in $here/install.  This script could# attempt to be clever and see if glib 2 is already installed, too.# --print-ac-dir was added in 1.2h according to the ChangeLog.  This# should mean that any automake new enough for us has it.function aclocal_scan () {    # Quietly ignore the rogue '-I' and other aclocal flags that    # aren't actually directories...    for i in `aclocal --print-ac-dir` $ACLOCAL_FLAGS    do	if [ -f $i/$1 ]; then	    return 0	fi    done    return 1}function pkgconfig_scan () {    module=$1    echo "Finding pkgconfig files for $module..."    # Should we use locate? or just a list of well-known directories?    # locate has the problem of false positives in src dirs    for i in /usr/lib/pkgconfig /usr/local/lib/pkgconfig    do	echo "Looking in $i..."	if [ -f $i/${module}.pc ]; then	    echo $i	    return	fi    done}function install_package() {    tarfile=$1    dirname=$2    name=$3    configure_options=$4    echo "Installing $name..."    if [ ! -f $here/$tarfile ]; then	(cd $here && $downloader http://www.go-mono.com/archive/$tarfile)    fi    # Assume that the package built correctly if the dir is there    if [ ! -d $here/$dirname ]; then	# Build and install package	(cd $here && tar xzf $tarfile) || exit -1	(cd $here/$dirname; ./configure --prefix=$here/install $configure_options || exit -1; $MAKE || exit -1; $MAKE install || exit -1)	success=$?	if [ $success -ne 0 ]; then	    echo "***** $name build failure. Run rm -rf $here/$dirname to have this script attempt to build $name again next time"	    exit -1	fi    fi}if aclocal_scan pkg.m4 ; then    install_pkgconfig=noelse    install_pkgconfig=yesfiif aclocal_scan glib-2.0.m4 ; then    install_glib=no    if [ $install_pkgconfig = "yes" ]; then	# We have to tell the newly-installed pkgconfig about the	# system-installed glib	PKG_CONFIG_PATH=`pkgconfig_scan glib-2.0`:$PKG_CONFIG_PATH    fielse    install_glib=yes    PKG_CONFIG_PATH="$here/install/lib/pkgconfig:$PKG_CONFIG_PATH"fiif [ -f /usr/include/gc/gc.h ]; then    install_libgc=noelse    install_libgc=yesfiif [ $install_pkgconfig = "yes" -o $install_glib = "yes" ]; then    ACLOCAL_FLAGS="-I $here/install/share/aclocal $ACLOCAL_FLAGS"fiexport PATHexport LD_LIBRARY_PATHexport ACLOCAL_FLAGSexport PKG_CONFIG_PATH# Freebsd puts iconv in /usr/local, so see if we need to add# /usr/local/include and /usr/local/lib to CPPFLAGS and LDFLAGS.  We could# skip this if it would add /usr/include and /usr/lib, but leaving it# shouldnt break anything.iconvh=`locate include/iconv.h`iconvh_dir=`dirname $iconvh`iconvlib_dir=`echo $iconvh_dir | sed -e 's/include/lib/'`echo "Adding $iconvh_dir to CPPFLAGS"echo "Adding $iconvlib_dir to LDFLAGS"CPPFLAGS="$CPPFLAGS -I$here/install/include -I$iconvh_dir"LDFLAGS="$LDFLAGS -L$here/install/lib -L$iconvlib_dir"export CPPFLAGSexport LDFLAGS# Grab pkg-config, glib and libgc if necessaryif [ $install_pkgconfig = "yes" ]; then    install_package pkgconfig-0.8.0.tar.gz pkgconfig-0.8.0 pkgconfig ""else    echo "Not installing pkgconfig, you already seem to have it installed"fiif [ $install_glib = "yes" ]; then    install_package glib-2.0.6.tar.gz glib-2.0.6 glib ""else    echo "Not installing glib, you already seem to have it installed"fiif [ $install_libgc = "yes" ]; then    install_package gc6.1alpha5.tar.gz gc6.1alpha5 libgc "--enable-threads=pthreads"    # make install didnt do the headers!    mkdir -p $here/install/include/gc    cp -r $here/gc6.1alpha5/include/* $here/install/include/gcelse    echo "Not installing libgc, you already seem to have it installed"fi# End of build dependencies, now get the latest mono checkout and build thattest -z "$CVSROOT" && CVSROOT=:pserver:anonymous@anoncvs.go-mono.com:/monoexport CVSROOTecho "Updating mono"# cvs checkout does the same as cvs update, except that it copes with# new modules being added# Older versions of cvs insist on a cvs login for :pserver: methods# Make sure cvs is using ssh for :ext: methodsif [ ${CVSROOT:0:5} = ":ext:" ]; then    CVS_RSH=ssh    export CVS_RSHelif [ ${CVSROOT:0:9} = ":pserver:" ]; then    # Chop off the trailing /mono because cvs 1.11 adds the port number    # into the .cvspass line    if ! grep ${CVSROOT%:/mono} ~/.cvspass > /dev/null 2>&1 ; then	echo "Logging into CVS server.  Anonymous CVS password is probably empty"	cvs login    fifi(cd $here && cvs checkout mono) || exit -1# Build and install monoecho "Building and installing mono"(cd $here/mono; ./autogen.sh --prefix=$here/install || exit -1; $MAKE || exit -1; $MAKE install || exit -1) || exit -1echo ""echo ""echo "All done."echo "Add $here/install/bin to \$PATH"echo "Add $here/install/lib to \$LD_LIBRARY_PATH"echo "Don't forget to copy the class libraries to $here/install/lib"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -