monodevelop

Форк
0
/
configure 
331 строка · 8.5 Кб
1
#!/usr/bin/env bash
2
VERSION=2.1.0
3
profile=default
4
tests=no
5
release=no
6
prefix=NONE
7
test -e "$CONFIG_SITE" && . "$CONFIG_SITE"
8
test "$prefix" = NONE && prefix=/usr/local
9

10
usage ()
11
{
12
	profiles=`ls profiles | sed -e "s/$/,/g" | fmt | sed -e 's/,$//' -e "s/ChangeLog, //"`
13
	echo ""
14
	echo "Usage : configure [--prefix=PREFIX] [--select] [--profile=PROFILE] [--release-builds]"
15
	echo ""
16
	echo "This script allows selecting and configuring a set of MonoDevelop"
17
	echo "modules to be included in an integrated build."
18
	echo ""
19
	echo "The MonoDevelop build system consists of a 'main' module, which "
20
	echo "contains the main distribution, and a number of additional add-ins"
21
	echo "in subdirectories of 'extras'. "
22
	echo ""
23
	echo "The 'extras' add-ins are designed to be built and distributed separately,"
24
	echo "and therefore build against your system-installed MonoDevelop by default."
25
	echo "However, this script sets them up to build against the MonoDevelop in"
26
	echo "'main', and ensures that they will be loaded when MonoDevelop is launched"
27
	echo "with 'make run' in this top-level directory. This is very useful for"
28
	echo "development and testing."
29
	echo ""
30
	echo "The first time the configure script is executed, it will ask you"
31
	echo "to select the add-ins to be included in the build. Further executions"
32
	echo "will configure only the selected add-ins. To select a new list of"
33
	echo "add-ins, run this script using the --select option."
34
	echo ""
35
	echo "You can also configure a predefined list of modules by specifying"
36
	echo "a build profile using the --profile option."
37
	echo ""
38
	echo "Options:"
39
	echo ""
40
	echo "--prefix=PREFIX"
41
	echo ""
42
	echo "  Select the install directory prefix."
43
	echo ""
44
	echo "--select"
45
	echo ""
46
	echo "  Shows a list of add-ins and allows selecting which ones should be"
47
	echo "  included in the build. It can be used in combination with --profile"
48
	echo "  to select the add-ins to be built for a specific profile."
49
	echo ""
50
	echo "--enable-tests"
51
	echo "  Build the md test suite"
52
	echo ""
53
	echo "--enable-release"
54
	echo "  Builds md in release mode"
55
	echo ""
56
	echo "--enable-mac32"
57
	echo "  Build for i386 on OS X"
58
	echo ""
59
	echo "--profile=PROFILE"
60
	echo ""
61
	echo "  Configure the build system using the provided profile."
62
	echo "  A 'profile' is a list of 'extras' directories and arguments for their "
63
	echo "  configure scripts, and arguments for the 'main' configure script. To "
64
	echo "  add a profile, simply create a file in the 'profiles' directory."
65
	echo "  The 'default' profile is used when none is specified."
66
	echo ""
67
	echo "  Profiles available:" $profiles
68
	echo ""
69
}
70

71
validate_profile ()
72
{
73
	test -z "$1" && return 0
74
	for c in `ls profiles`; do
75
		if [ "$c" = "$1" ]; then
76
			return 1
77
		fi
78
	done
79
	return 0
80
}
81

82
select_packages ()
83
{
84
	if [[ ! -a profiles/$profile ]] ; then
85
		cp profiles/stable profiles/$profile
86
	fi
87
	n=1
88
	for p in `sed -e /#/d -e 's/ /,/g' < profiles/all` ; do
89
		packages[$n]=$p
90
		if test x1 == x`grep -c -s $p profiles/$profile`; then
91
			sel=X
92
		else
93
			sel=" "
94
		fi
95
		selection[$n]=$sel
96
		let "n=n+1"
97
	done
98
	pcount=$n
99
	while [[ 1 ]]
100
	do
101
		echo Select the packages to include in the build for the profile \'$profile\':
102
		echo
103
		n=1
104
		for p in ${packages[*]} ; do
105
			echo $n. [${selection[n]}] $p
106
			let "n=n+1"
107
		done
108
		echo
109
		echo "Enter the number of an add-in to enable/disable,"
110
		read -a response  -p"(q) quit, (c) clear all, (s) select all, or ENTER to continue:  "
111
		echo
112
		if [ -z $response ] ; then
113
			break
114
		elif [ $response == q -o $response == Q ] ; then
115
			exit 1
116
		elif [ $response == c -o $response == C ] ; then
117
			for ((n=1; n < pcount; n++))
118
			do
119
				selection[$n]=" "
120
			done
121
		elif [ $response == s -o $response == S ] ; then
122
			for ((n=1; n < pcount; n++))
123
			do
124
				selection[$n]=X
125
			done
126
		elif [ x${selection[response]} = xX ] ; then
127
			selection[$response]=" "
128
		else
129
			selection[$response]=X
130
		fi
131
	done
132
	n=1
133
	rm -f profiles/$profile
134
	for p in ${packages[*]} ; do
135
		if [ x${selection[n]} == xX ]; then
136
			echo ${packages[n]} >> profiles/$profile
137
		fi
138
		let "n=n+1"
139
	done
140
}
141

142
handle_config_error ()
143
{
144
	if test `uname` = "Darwin"; then
145
		echo ""
146
		echo "Have you followed http://www.monodevelop.com/developers/building-monodevelop/#macosx ?"
147
		echo ""
148
	fi
149
	exit 1
150
}
151

152
configure_packages ()
153
{
154
	rm -f local-config/*
155
	localconf=`pwd`/local-config
156
	for p in `sed -e /#/d -e 's/ /,/g' < profiles/$profile` ; do
157
		path=`echo $p | cut -d ',' -f 1`
158
		ops=`echo $p | sed -e s,$path,, -e 's/,/ /'g`
159
		if test xyes == x$tests; then
160
			enable_tests=--enable-tests
161
		else
162
			enable_tests=" "
163
		fi
164

165
		if test `uname` != "Darwin" || test xno == x$x64; then
166
			enable_x64=--with-macarch=i386
167
		else
168
			enable_x64=--with-macarch=x86_64
169
		fi
170

171
		prefixarg="--prefix=$prefix"
172
		builddir=`pwd`/$path/build
173

174
		for p in $ops ; do
175
			arg=`echo $p | cut -d '=' -f 1`
176
			if [ $arg == "--addins-dir" ] ; then
177
				builddir=`pwd`/$path/`echo $p | cut -d '=' -f 2`
178
			fi
179
			if [ $p == "--no-prefix" ] ; then
180
				prefixarg=""
181
			fi
182
		done
183
		if test xyes == x$release; then
184
			ops="$ops --enable-release"
185
		fi
186

187
		title="Configuring package: $path"
188
		nc=`echo $title | wc -m`
189
		echo $title
190
		for ((n=1; n < nc; n++)); do echo -n "-"; done
191
		echo
192
		echo "Configuration options: $ops"
193
		if test -a $path/autogen.sh; then
194
			sct="./autogen.sh $enable_tests $enable_x64"
195
		elif test -a $path/configure; then
196
			sct=./configure
197
		elif test -a $path/configure.sh; then
198
			sct=./configure.sh
199
		else
200
			echo -en '\033[0;31m'
201
			echo Configuration script not found in directory: $path
202
			echo Try running $ git submodule update --init --recursive
203
			echo -en '\033[0m'
204
			exit 1
205
		fi
206
		pushd $path > /dev/null
207
		PKG_CONFIG_PATH=$localconf:$PKG_CONFIG_PATH $sct $prefixarg $ops || handle_config_error
208
		popd > /dev/null
209
		create_local_config $path $builddir
210
		packages="$packages $path"
211
	done
212
	rm -f local-config/main.addins
213
	return 0
214
}
215

216
create_local_config ()
217
{
218
	# Get the version from the version.config file, if it exists
219
	if test -a version.config; then
220
		ver=`grep ^Version version.config|cut -d '=' -f 2|tr -d '\n'`
221
	else
222
		ver=VERSION
223
	fi
224

225
	# Copy the .pc file to local-config, and set the base lib directory
226
	mkdir -p local-config
227
	builddir=$2
228
	for f in `ls $1/*.pc.in 2>/dev/null`; do
229
		pcfile=`echo $f | sed s,.*/,, | sed s/\.in$//`
230
		sed -e s,libdir=.*,libdir=$builddir, -e s/@VERSION@/$ver/g $f> local-config/$pcfile
231
	done
232

233
	# Generate the .addins file for the package
234
	addins=local-config/`echo $path | sed s,/,_,g`.addins
235
	echo "<Addins>" > $addins
236
	echo "  <Directory include-subdirs=\"true\">$builddir</Directory>" >> $addins
237
	echo "</Addins>" >> $addins
238
}
239

240
echo
241

242
while test x$1 != x; do
243
	case $1 in
244
		--enable-tests)
245
			tests=yes
246
			;;
247
		--enable-release)
248
			release=yes
249
			;;
250
		--enable-mac32)
251
			x64=no
252
			;;
253
		--prefix=*)
254
			prefix=`echo $1 | sed 's/--prefix=//'`
255
			;;
256
		--prefix)
257
			shift
258
			prefix=$1
259
			;;
260
		--select)
261
			select=yes
262
			;;
263
		--profile=*)
264
			prof=`echo $1 | sed 's/--profile=//'`
265
			profile=$prof
266
			;;
267
		--profile)
268
			shift
269
			profile=$1
270
			;;
271
		--help)
272
			usage
273
			exit
274
			;;
275
		*)
276
			echo Unknown argument $1 >&2
277
			usage
278
			exit 1
279
			;;
280
	esac
281
	shift
282
done
283

284
if test `uname` = "Darwin" && test "x$profile" = "xdefault"; then
285
	profile="mac"
286
fi
287

288
validate_profile "$profile"
289
if [ ! $? -eq 1 ]; then
290
	echo "The build profile '$profile' does not exist. A new profile will be created."
291
fi
292
if [ x$select == xyes -o ! -a profiles/$profile ]; then
293
	select_packages
294
fi
295

296
if test `uname` = "Darwin"; then
297
	# if building on bots or in default environment, fix up paths to use system Mono
298
	if test "x$BUILD_REVISION" != "x" -o "x$DYLD_FALLBACK_LIBRARY_PATH" = "x"; then
299
		export DYLD_FALLBACK_LIBRARY_PATH="/Library/Frameworks/Mono.framework/Versions/Current/lib:/lib:/usr/lib"
300
		export PATH="/Library/Frameworks/Mono.framework/Versions/Current/bin:$PATH"
301
		export ACLOCAL_FLAGS="-I /Library/Frameworks/Mono.framework/Versions/Current/share/aclocal"
302
	fi
303
	# add in libsvn's directory as a fallback path. user-set paths will override it
304
	export DYLD_FALLBACK_LIBRARY_PATH="$DYLD_FALLBACK_LIBRARY_PATH:/Library/Developer/CommandLineTools/usr/lib:/usr/local/lib:`pwd`/main/build/bin"
305

306
	ruby dependency_checker.rb || exit 1
307
fi
308

309
configure_packages
310
[ $? -eq 1 ] && exit 1
311

312
echo "PROFILE = $profile" > config.make
313
echo -n "SUBDIRS = " >> config.make
314

315
echo Configuration Summary
316
echo ---------------------
317
echo
318
echo "MonoDevelop has been configured with "
319
echo "    prefix = $prefix"
320
echo "    profile = $profile"
321
echo
322
echo "Packages included in the build:"
323
for p in $packages; do
324
	echo "\\" >> config.make
325
	echo -n "	$p" >> config.make
326
	echo "    $p"
327
done
328
echo >> config.make
329
echo
330

331
echo -n  "prefix=$prefix" >> config.make
332

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.