monodevelop
/
configure
331 строка · 8.5 Кб
1#!/usr/bin/env bash
2VERSION=2.1.03profile=default4tests=no5release=no6prefix=NONE7test -e "$CONFIG_SITE" && . "$CONFIG_SITE"8test "$prefix" = NONE && prefix=/usr/local9
10usage ()11{
12profiles=`ls profiles | sed -e "s/$/,/g" | fmt | sed -e 's/,$//' -e "s/ChangeLog, //"`13echo ""14echo "Usage : configure [--prefix=PREFIX] [--select] [--profile=PROFILE] [--release-builds]"15echo ""16echo "This script allows selecting and configuring a set of MonoDevelop"17echo "modules to be included in an integrated build."18echo ""19echo "The MonoDevelop build system consists of a 'main' module, which "20echo "contains the main distribution, and a number of additional add-ins"21echo "in subdirectories of 'extras'. "22echo ""23echo "The 'extras' add-ins are designed to be built and distributed separately,"24echo "and therefore build against your system-installed MonoDevelop by default."25echo "However, this script sets them up to build against the MonoDevelop in"26echo "'main', and ensures that they will be loaded when MonoDevelop is launched"27echo "with 'make run' in this top-level directory. This is very useful for"28echo "development and testing."29echo ""30echo "The first time the configure script is executed, it will ask you"31echo "to select the add-ins to be included in the build. Further executions"32echo "will configure only the selected add-ins. To select a new list of"33echo "add-ins, run this script using the --select option."34echo ""35echo "You can also configure a predefined list of modules by specifying"36echo "a build profile using the --profile option."37echo ""38echo "Options:"39echo ""40echo "--prefix=PREFIX"41echo ""42echo " Select the install directory prefix."43echo ""44echo "--select"45echo ""46echo " Shows a list of add-ins and allows selecting which ones should be"47echo " included in the build. It can be used in combination with --profile"48echo " to select the add-ins to be built for a specific profile."49echo ""50echo "--enable-tests"51echo " Build the md test suite"52echo ""53echo "--enable-release"54echo " Builds md in release mode"55echo ""56echo "--enable-mac32"57echo " Build for i386 on OS X"58echo ""59echo "--profile=PROFILE"60echo ""61echo " Configure the build system using the provided profile."62echo " A 'profile' is a list of 'extras' directories and arguments for their "63echo " configure scripts, and arguments for the 'main' configure script. To "64echo " add a profile, simply create a file in the 'profiles' directory."65echo " The 'default' profile is used when none is specified."66echo ""67echo " Profiles available:" $profiles68echo ""69}
70
71validate_profile ()72{
73test -z "$1" && return 074for c in `ls profiles`; do75if [ "$c" = "$1" ]; then76return 177fi78done79return 080}
81
82select_packages ()83{
84if [[ ! -a profiles/$profile ]] ; then85cp profiles/stable profiles/$profile86fi87n=188for p in `sed -e /#/d -e 's/ /,/g' < profiles/all` ; do89packages[$n]=$p90if test x1 == x`grep -c -s $p profiles/$profile`; then91sel=X92else93sel=" "94fi95selection[$n]=$sel96let "n=n+1"97done98pcount=$n99while [[ 1 ]]100do101echo Select the packages to include in the build for the profile \'$profile\':102echo103n=1104for p in ${packages[*]} ; do105echo $n. [${selection[n]}] $p106let "n=n+1"107done108echo109echo "Enter the number of an add-in to enable/disable,"110read -a response -p"(q) quit, (c) clear all, (s) select all, or ENTER to continue: "111echo112if [ -z $response ] ; then113break114elif [ $response == q -o $response == Q ] ; then115exit 1116elif [ $response == c -o $response == C ] ; then117for ((n=1; n < pcount; n++))118do119selection[$n]=" "120done121elif [ $response == s -o $response == S ] ; then122for ((n=1; n < pcount; n++))123do124selection[$n]=X125done126elif [ x${selection[response]} = xX ] ; then127selection[$response]=" "128else129selection[$response]=X130fi131done132n=1133rm -f profiles/$profile134for p in ${packages[*]} ; do135if [ x${selection[n]} == xX ]; then136echo ${packages[n]} >> profiles/$profile137fi138let "n=n+1"139done140}
141
142handle_config_error ()143{
144if test `uname` = "Darwin"; then145echo ""146echo "Have you followed http://www.monodevelop.com/developers/building-monodevelop/#macosx ?"147echo ""148fi149exit 1150}
151
152configure_packages ()153{
154rm -f local-config/*155localconf=`pwd`/local-config156for p in `sed -e /#/d -e 's/ /,/g' < profiles/$profile` ; do157path=`echo $p | cut -d ',' -f 1`158ops=`echo $p | sed -e s,$path,, -e 's/,/ /'g`159if test xyes == x$tests; then160enable_tests=--enable-tests161else162enable_tests=" "163fi164
165if test `uname` != "Darwin" || test xno == x$x64; then166enable_x64=--with-macarch=i386167else168enable_x64=--with-macarch=x86_64169fi170
171prefixarg="--prefix=$prefix"172builddir=`pwd`/$path/build173
174for p in $ops ; do175arg=`echo $p | cut -d '=' -f 1`176if [ $arg == "--addins-dir" ] ; then177builddir=`pwd`/$path/`echo $p | cut -d '=' -f 2`178fi179if [ $p == "--no-prefix" ] ; then180prefixarg=""181fi182done183if test xyes == x$release; then184ops="$ops --enable-release"185fi186
187title="Configuring package: $path"188nc=`echo $title | wc -m`189echo $title190for ((n=1; n < nc; n++)); do echo -n "-"; done191echo192echo "Configuration options: $ops"193if test -a $path/autogen.sh; then194sct="./autogen.sh $enable_tests $enable_x64"195elif test -a $path/configure; then196sct=./configure197elif test -a $path/configure.sh; then198sct=./configure.sh199else200echo -en '\033[0;31m'201echo Configuration script not found in directory: $path202echo Try running $ git submodule update --init --recursive203echo -en '\033[0m'204exit 1205fi206pushd $path > /dev/null207PKG_CONFIG_PATH=$localconf:$PKG_CONFIG_PATH $sct $prefixarg $ops || handle_config_error208popd > /dev/null209create_local_config $path $builddir210packages="$packages $path"211done212rm -f local-config/main.addins213return 0214}
215
216create_local_config ()217{
218# Get the version from the version.config file, if it exists219if test -a version.config; then220ver=`grep ^Version version.config|cut -d '=' -f 2|tr -d '\n'`221else222ver=VERSION223fi224
225# Copy the .pc file to local-config, and set the base lib directory226mkdir -p local-config227builddir=$2228for f in `ls $1/*.pc.in 2>/dev/null`; do229pcfile=`echo $f | sed s,.*/,, | sed s/\.in$//`230sed -e s,libdir=.*,libdir=$builddir, -e s/@VERSION@/$ver/g $f> local-config/$pcfile231done232
233# Generate the .addins file for the package234addins=local-config/`echo $path | sed s,/,_,g`.addins235echo "<Addins>" > $addins236echo " <Directory include-subdirs=\"true\">$builddir</Directory>" >> $addins237echo "</Addins>" >> $addins238}
239
240echo
241
242while test x$1 != x; do243case $1 in244--enable-tests)245tests=yes246;;247--enable-release)248release=yes249;;250--enable-mac32)251x64=no252;;253--prefix=*)254prefix=`echo $1 | sed 's/--prefix=//'`255;;256--prefix)257shift258prefix=$1259;;260--select)261select=yes262;;263--profile=*)264prof=`echo $1 | sed 's/--profile=//'`265profile=$prof266;;267--profile)268shift269profile=$1270;;271--help)272usage
273exit274;;275*)276echo Unknown argument $1 >&2277usage
278exit 1279;;280esac281shift282done
283
284if test `uname` = "Darwin" && test "x$profile" = "xdefault"; then285profile="mac"286fi
287
288validate_profile "$profile"289if [ ! $? -eq 1 ]; then290echo "The build profile '$profile' does not exist. A new profile will be created."291fi
292if [ x$select == xyes -o ! -a profiles/$profile ]; then293select_packages
294fi
295
296if test `uname` = "Darwin"; then297# if building on bots or in default environment, fix up paths to use system Mono298if test "x$BUILD_REVISION" != "x" -o "x$DYLD_FALLBACK_LIBRARY_PATH" = "x"; then299export DYLD_FALLBACK_LIBRARY_PATH="/Library/Frameworks/Mono.framework/Versions/Current/lib:/lib:/usr/lib"300export PATH="/Library/Frameworks/Mono.framework/Versions/Current/bin:$PATH"301export ACLOCAL_FLAGS="-I /Library/Frameworks/Mono.framework/Versions/Current/share/aclocal"302fi303# add in libsvn's directory as a fallback path. user-set paths will override it304export DYLD_FALLBACK_LIBRARY_PATH="$DYLD_FALLBACK_LIBRARY_PATH:/Library/Developer/CommandLineTools/usr/lib:/usr/local/lib:`pwd`/main/build/bin"305
306ruby dependency_checker.rb || exit 1307fi
308
309configure_packages
310[ $? -eq 1 ] && exit 1311
312echo "PROFILE = $profile" > config.make313echo -n "SUBDIRS = " >> config.make314
315echo Configuration Summary316echo ---------------------317echo
318echo "MonoDevelop has been configured with "319echo " prefix = $prefix"320echo " profile = $profile"321echo
322echo "Packages included in the build:"323for p in $packages; do324echo "\\" >> config.make325echo -n " $p" >> config.make326echo " $p"327done
328echo >> config.make329echo
330
331echo -n "prefix=$prefix" >> config.make332