银河

SKYIV STUDIO

  博客园 :: 首页 :: 博问 :: 闪存 :: :: :: 订阅 订阅 :: 管理 ::

我们知道,在 2009-10-29 发布的 Ubuntu 9.10 操作系统中已经内置 mono 2.4.2.3 版本了。到了 2009-12-08,mono 2.4.3 版本发布了。随后,在 2009-12-14 日,又发布了 mono 2.6 版本。而 Patric 又在 2009-11-29 日发表了 Mono 2.6 parallel environment on Ubuntu 9.10 ,如下所示:

Mono 2.6 parallel environment on Ubuntu 9.10

This is a simple work in progress to make the process a bit easier. There are many good reasons not to follow various scripts on the internet that install mono over the top of your packaged distribution install.The fact the Mono 2.6 isn’t released yet is an overriding one because any application depending on mono might stop working, Banshee, Tomboy,F-Spot, etc

At the moment this scripts only supports Mono 2.6 + Ubuntu 9.10, see the TODOs! It will install mono into /opt/mono-2.6 and checkout & build in ~/mono-src/mono-2.6. Run it again to update your working copy and rebuild/install.

Please let me know if you like/hate/improve the script :)

Download script here http://patrick.qmtech.net/downloads/mono_parallel.sh

You will need these packages installed: build-essential automake libtool mono-complete gendarme subversion libpng-dev libtiff-dev libgif-dev libjpeg-dev libxul-dev libexif-dev autoconf automake bison flex libcairo-dev libpango-dev

在上述文章最后提到了软件包中,automake 出现了两次,只需要保留一次。libpango-dev 应该用 libpango1.0-dev 代替。而 libxul-dev 会和 firefox 冲突,我决定不安装 libxul-dev 。于是,就执行以下命令来安装 mono-2.6:

$ sudo apt-get install build-essential automake libtool mono-complete gendarme subversion libpng-dev libtiff-dev libgif-dev libjpeg-dev libexif-dev autoconf bison flex libcairo-dev libpango1.0-dev

$ wget http://patrick.qmtech.net/downloads/mono_parallel.sh

$ . mono_parallel.sh

经过漫长的等待,终于安装好了 mono 2.6:

ben@ben-m4000t:~$ cat /usr/local/bin/mono-2.6
#!/bin/bash
MONO_PREFIX=/opt/mono-2.6
GNOME_PREFIX=/opt/gnome
export DYLD_LIBRARY_PATH=/opt/mono-2.6/lib:
export LD_LIBRARY_PATH=/opt/mono-2.6/lib:
export C_INCLUDE_PATH=/opt/mono-2.6/include:/include
export ACLOCAL_PATH=/opt/mono-2.6/share/aclocal
export PKG_CONFIG_PATH=/opt/mono-2.6/lib/pkgconfig:/lib/pkgconfig
PATH=/opt/mono-2.6/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

exec "$@"
ben@ben-m4000t:~$
ben@ben-m4000t:~$ mono-2.6 mono --version
Mono JIT compiler version 2.6.1 (/branches/mono-2-6/mono r148738 2009年 12月 18日 星期五 09:50:50 CST)
Copyright (C) 2002-2008 Novell, Inc and Contributors. www.mono-project.com
TLS: __thread
GC: Included Boehm (with typed GC and Parallel Mark)
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
ben@ben-m4000t:~$
ben@ben-m4000t:~$ du -hs mono-src /opt/mono-2.6
1.4G mono-src
134M /opt/mono-2.6
ben@ben-m4000t:~$

从上面可以看到,mono 2.6 的源程序占用 1.4GB 的磁盘空间,mono 2.6 目标程序占用 134MB 的磁盘空间。实际上,安装完成后,mono 2.6 的源程序就可以使用 rm -rf mono-src 命令删除了。

附:mono_parallel.sh :

#!/bin/bash
#
# Version 0.1
# This script is to install a parallel mono environment with ease
# It only checks out/installs mono 2.6 branch on Ubuntu 9.10 atm
#
# Copyright 2009 (c) QMTech Ltd (http://www.qmtech.net)
# Authors: Patrick McEvoy (firegrass) patrick@qmtech.net
# This is free script under GNU GPL version 3.

# config
# TODO: Allow opt or home install option (hence sudo/no sudo)
# TODO: Allow have 2.6 or trunk
VERSION=2.6
MONO_PREFIX=/opt/mono-$VERSION
#GNOME_PREFIX=/opt/gnome-2.6
WORKING_DIR=~/mono-src/mono-$VERSION
# TODO: webserver/server/workstation (+mod_mono,-gnome,-mono-tools/-gnome,-mono-tools/-mod_mono)
MODE=server
# TODO: Option to hide all output
DEBUG=
#1>&2

echo "MI: This script will download/checkout mono and install in a parallel environment."
echo "MI: Report bugs to patrick@qmtech.net, firegrass on twitter, carrier pidgeon etc"

# 
if [ $MODE = "workstation" ] && [ "$(id -u)" = "0" ]; then
	echo "MI ERROR: This script should not be run as root" 1>&2
	exit 1
fi

echo "MI: Installing mono version $VERSION, building in $WORKING_DIR"
echo "MI: I need sudo access to install mono to /opt and mono-$VERSION in /usr/local/bin"
sudo echo "MI: If the sudo time limit is reached you will need to enter you password again."
# making a dir to work from
mkdir -p $WORKING_DIR
cd $WORKING_DIR

# svn checkouts
SVN_BASE=http://anonsvn.mono-project.com/source/branches/mono-2-6
# modules - hardcoded to branch 2.6

SVN_MODULES="libgdiplus mono mcs mono-tools mod_mono xsp"

for mod in $SVN_MODULES; do
	if [ -d $mod ]; then
		echo "MI: Updating $mod"
		svn up -q $mod || { echo "MI ERROR: Updating $mod failed"; exit 1; } 
	else
		echo "MI: Checking out $mod ($SVN_BASE/$mod)"
		svn co -q $SVN_BASE/$mod || { echo "MI ERROR: Checking out $mod failed"; exit 1; }
	fi
done

# create enviroment files
cat > "mono-$VERSION-environment" <<EOF
#!/bin/bash
MONO_PREFIX=$MONO_PREFIX
GNOME_PREFIX=/opt/gnome
export DYLD_LIBRARY_PATH=$MONO_PREFIX/lib:$DYLD_LIBRARY_PATH
export LD_LIBRARY_PATH=$MONO_PREFIX/lib:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=$MONO_PREFIX/include:$GNOME_PREFIX/include
export ACLOCAL_PATH=$MONO_PREFIX/share/aclocal
export PKG_CONFIG_PATH=$MONO_PREFIX/lib/pkgconfig:$GNOME_PREFIX/lib/pkgconfig
PATH=$MONO_PREFIX/bin:$PATH
PS1="[mono] \w @ "
EOF

cat > "mono-$VERSION" <<EOF
#!/bin/bash
MONO_PREFIX=$MONO_PREFIX
GNOME_PREFIX=/opt/gnome
export DYLD_LIBRARY_PATH=$MONO_PREFIX/lib:$DYLD_LIBRARY_PATH
export LD_LIBRARY_PATH=$MONO_PREFIX/lib:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=$MONO_PREFIX/include:$GNOME_PREFIX/include
export ACLOCAL_PATH=$MONO_PREFIX/share/aclocal
export PKG_CONFIG_PATH=$MONO_PREFIX/lib/pkgconfig:$GNOME_PREFIX/lib/pkgconfig
PATH=$MONO_PREFIX/bin:$PATH

exec "\$@"
EOF

# install environemnt
chmod +x mono-$VERSION-environment mono-$VERSION
sudo mv mono-$VERSION-environment /usr/local/bin/mono-$VERSION-environment
sudo mv mono-$VERSION /usr/local/bin/mono-$VERSION

# using new environment
. mono-$VERSION-environment

# configure, make, install
for mod in $SVN_MODULES; do
	if [ $mod = "mcs" ]; then
		# Ignore mcs as built from mono
		echo "MI: Skiping mcs module"
	elif [ $MODE = "server" ] && [ $mod = "mono-tools" ]; then
		echo "MI: Skipping mono-tools (server install)"
	elif [ $MODE = "server" ] && [ $mod = "mod_mono" ]; then
		echo "MI: Skipping mono-tools (server install)"
	else
		echo "MI: Installing $mod"
		cd $mod
		./autogen.sh --prefix=$MONO_PREFIX $DEBUG && \
		make $DEBUG && \
		sudo make install $DEBUG || { echo "MI ERROR: $mod failed"; exit 1; }
		cd ..
	fi
done

# Exit message
echo "Your parallel environment is installed"
echo "To start a mono-$VERSION environment, run: source mono-$VERSION-environment"
echo "To use mono-$VERSION to run a cli app, run: mono-$VERSION <your app> (eg mono-$VERSION mono -V)"
posted on 2009-12-18 15:37  银河  阅读(3588)  评论(10编辑  收藏  举报