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