* MonoDevelop.VersionControl.Views/CellRendererDiff.cs: Correcty
[monodevelop.git] / configure
blobe80f1b768e8a2973d13263e251a5c2c226f390d7
1 #!/bin/bash
2 VERSION=1.9.2
3 profile=default
5 prefix=NONE
6 test -e "$CONFIG_SITE" && . "$CONFIG_SITE"
7 test "$prefix" = NONE && prefix=/usr/local
9 usage ()
11 echo ""
12 echo "Usage : configure [--prefix=PREFIX] [--select] [--profile=PROFILE]"
13 echo ""
14 echo "This script allows selecting and configuring a set of MonoDevelop"
15 echo "modules to be included in an integrated build."
16 echo ""
17 echo "The MonoDevelop build system consists of a 'main' module, which "
18 echo "contains the main distribution, and a number of additional add-ins"
19 echo "in subdirectories of 'extras'. "
20 echo ""
21 echo "The 'extras' add-ins are designed to be built and distributed separately,"
22 echo "and therefore build against your system-installed MonoDevelop by default."
23 echo "However, this script sets them up to build against the MonoDevelop in"
24 echo "'main', and ensures that they will be loaded when MonoDevelop is launched"
25 echo "with 'make run' in this top-level directory. This is very useful for"
26 echo "development and testing."
27 echo ""
28 echo "The first time the configure script is executed, it will ask you"
29 echo "to select the add-ins to be included in the build. Further executions"
30 echo "will configure only the selected add-ins. To select a new list of"
31 echo "add-ins, run this script using the --select option."
32 echo ""
33 echo "You can also configure a predefined list of modules by specifying"
34 echo "a build profile using the --profile option."
35 echo ""
36 echo "Options:"
37 echo ""
38 echo "--prefix=PREFIX"
39 echo ""
40 echo " Select the install directory prefix."
41 echo ""
42 echo "--select"
43 echo ""
44 echo " Shows a list of add-ins and allows selecting which ones should be"
45 echo " included in the build. It can be used in combination with --profile"
46 echo " to select the add-ins to be built for a specific profile."
47 echo ""
48 echo "--profile=PROFILE"
49 echo ""
50 echo " Configure the build system using the provided profile."
51 echo " A 'profile' is a list of 'extras' directories and arguments for their "
52 echo " configure scripts, and arguments for the 'main' configure script. To "
53 echo " add a profile, simply create a file in the 'profiles' directory."
54 echo " The 'default' profile is used when none is specified."
55 echo ""
56 echo " Profiles available:" `ls --format=commas profiles | sed -e "s/ChangeLog, //"`
57 echo ""
60 validate_profile ()
62 test -z "$1" && return 0
63 for c in `ls profiles`; do
64 if [ "$c" = "$1" ]; then
65 return 1
67 done
68 return 0
71 select_packages ()
73 if [[ ! -a profiles/$profile ]] ; then
74 cp profiles/stable profiles/$profile
76 n=1
77 for p in `sed -e /#/d -e 's/ /,/g' < profiles/all` ; do
78 packages[$n]=$p
79 if test x1 == x`grep -c -s $p profiles/$profile`; then
80 sel=X
81 else
82 sel=" "
84 selection[$n]=$sel
85 let "n=n+1"
86 done
87 pcount=$n
88 while [[ 1 ]]
89 do
90 echo Select the packages to include in the build for the profile \'$profile\':
91 echo
92 n=1
93 for p in ${packages[*]} ; do
94 echo $n. [${selection[n]}] $p
95 let "n=n+1"
96 done
97 echo
98 echo "Enter the number of an add-in to enable/disable,"
99 read -a response -p"(q) quit, (c) clear all, (s) select all, or ENTER to continue: "
100 echo
101 if [ -z $response ] ; then
102 break
103 elif [ $response == q -o $response == Q ] ; then
104 exit 1
105 elif [ $response == c -o $response == C ] ; then
106 for ((n=1; n < pcount; n++))
108 selection[$n]=" "
109 done
110 elif [ $response == s -o $response == S ] ; then
111 for ((n=1; n < pcount; n++))
113 selection[$n]=X
114 done
115 elif [ x${selection[response]} = xX ] ; then
116 selection[$response]=" "
117 else
118 selection[$response]=X
120 done
122 rm -f profiles/$profile
123 for p in ${packages[*]} ; do
124 if [ x${selection[n]} == xX ]; then
125 echo ${packages[n]} >> profiles/$profile
127 let "n=n+1"
128 done
131 configure_packages ()
133 rm -f local-config/*
134 localconf=`pwd`/local-config
135 for p in `sed -e /#/d -e 's/ /,/g' < profiles/$profile` ; do
136 path=`echo $p | cut -d ',' -f 1`
137 ops=`echo $p | sed -e s,$path,, -e 's/,/ /'g`
138 title="Configuring package: $path"
139 nc=`echo $title | wc -m`
140 echo $title
141 for ((n=1; n < nc; n++)); do echo -n "-"; done
142 echo
143 echo "Configuration options: $ops"
144 if test -a $path/autogen.sh; then
145 sct=./autogen.sh
146 elif test -a $path/configure; then
147 sct=./configure
148 else
149 echo Configuration script not found in directory: $p
150 exit 1
152 pushd $path > /dev/null
153 PKG_CONFIG_PATH=$localconf:$PKG_CONFIG_PATH $sct --prefix=$prefix $ops || exit 1
154 popd > /dev/null
155 create_local_config $path
156 packages="$packages $path"
157 done
158 return 0
161 create_local_config ()
163 # Get the version from configure.in, if it exists
164 if test -a $path/configure.in; then
165 ver=`grep AC_INIT $path/configure.in | cut -d "," -f 2 | sed "s/ //"`
166 elif test -a $path/configure; then
167 ver=`grep ^VERSION= $path/configure | cut -d "=" -f 2 | sed "s/ //"`
168 else
169 ver=VERSION
172 # Copy the .pc file to local-config, and set the base lib directory
173 mkdir -p local-config
174 builddir=`pwd`/$path/build
175 for f in `ls $1/*.pc.in` ; do
176 pcfile=`echo $f | sed s,.*/,, | sed s/\.in$//`
177 sed -e s,libdir=.*,libdir=$builddir, -e s/@VERSION@/$ver/g $f> local-config/$pcfile
178 done
180 # Generate the .addins file for the package
181 addins=local-config/`echo $path | sed s,/,_,`.addins
182 echo "<Addins>" > $addins
183 echo " <Directory include-subdirs=\"true\">$builddir</Directory>" >> $addins
184 echo "</Addins>" >> $addins
187 echo
189 while test x$1 != x; do
190 case $1 in
191 --prefix=*)
192 prefix=`echo $1 | sed 's/--prefix=//'`
194 --prefix)
195 shift
196 prefix=$1
198 --select)
199 select=yes
201 --profile=*)
202 prof=`echo $1 | sed 's/--profile=//'`
203 profile=$prof
205 --profile)
206 shift
207 profile=$1
209 --help)
210 usage
211 exit
214 echo Unknown argument $1 >&2
215 usage
216 exit 1
218 esac
219 shift
220 done
222 validate_profile "$profile"
223 if [ ! $? -eq 1 ]; then
224 echo "The build profile '$profile' does not exist. A new profile will be created."
226 if [ x$select == xyes -o ! -a profiles/$profile ]; then
227 select_packages
230 configure_packages
231 [ $? -eq 1 ] && exit 1
233 echo -n "SUBDIRS = " > config.make
235 echo Configuration Summary
236 echo ---------------------
237 echo
238 echo "MonoDevelop has been configured with "
239 echo " prefix = $prefix"
240 echo " profile = $profile"
241 echo
242 echo "Packages included in the build:"
243 for p in $packages; do
244 echo "\\" >> config.make
245 echo -n " $p" >> config.make
246 echo " $p"
247 done
248 echo >> config.make
249 echo