Check in the proper version of this file instead of the old version.
[mono.git] / scripts / get-cygwin-deps.sh
1 #!/bin/bash
2
3 #
4 # This script will download and install the dependencies needed for compiling
5 # mono on cygwin
6 #
7
8 # Check for required packages
9
10 commands="wget unzip automake autoconf libtool make bison"
11
12 failed=0
13 for i in $commands; do
14         if ! which $i > /dev/null 2>&1; then 
15                 echo "You must have the '$i' package installed."
16                 failed=1
17         fi
18 done
19
20 if [ $failed = 1 ]; then
21         exit 1
22 fi
23
24 dir=cygwin-deps
25 mkdir -p $dir
26
27 echo -n "Downloading deps... "
28 if [ ! -f $dir/glib-2.6.6.zip ]; then
29         wget -P $dir ftp://ftp.gtk.org/pub/gtk/v2.6/win32/glib-2.6.6.zip || exit 1
30 fi
31 if [ ! -f $dir/glib-dev-2.6.6.zip ]; then
32         wget -P $dir ftp://ftp.gtk.org/pub/gtk/v2.6/win32/glib-dev-2.6.6.zip || exit 1
33 fi
34 if [ ! -f $dir/gettext-runtime-0.17-1.zip ]; then
35         wget -P $dir http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime-0.17-1.zip
36 fi
37 if [ ! -f $dir/libiconv-1.13-mingw32-dev.tar.gz ]; then
38         wget -P $dir http://sourceforge.net/projects/mingw/files/MinGW%20libiconv/release%201.13/libiconv-1.13-mingw32-dev.tar.gz/download
39 fi
40 echo "done."
41
42 echo -n "Extracting to cygwin-deps/ ..."
43 (cd $dir && for i in *.zip; do unzip -oq $i || exit 1; done) || exit 1
44 (cd $dir && for i in *.tar.gz; do tar xzf $i || exit 1; done) || exit 1
45 # This is needed because windows can't use dll's without an x flag.
46 chmod a+x $dir/bin/*.dll
47 echo "done."
48
49 echo -n "Patching PC files... "
50 prefix=$PWD/$dir
51 find $dir -name "*.pc" > $dir/pc-files
52 for i in `cat $dir/pc-files`; do
53         (sed -e "s,^prefix=.*,prefix=$prefix,g" < $i > $i.tmp && mv $i.tmp $i) || exit 1
54 done
55 rm -f $dir/pc-files
56 echo "done."
57
58 # Create an environment shell file
59 rm -f $dir/env.sh
60 echo "export PKG_CONFIG_PATH=\"$PWD/$dir/lib/pkgconfig:\$PKG_CONFIG\"" >> $dir/env.sh
61 echo "export PATH=\"$PWD/$dir/bin:\$PATH\"" >> $dir/env.sh
62
63 echo "Source $dir/env.sh into your environment using:"
64 echo ". $dir/env.sh"
65 echo "Then run mono's configure."