diff options
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/configure b/configure new file mode 100755 index 0000000000..0589c0763b --- /dev/null +++ b/configure @@ -0,0 +1,134 @@ +#!/bin/sh +VERSION=0.17 +prefix=/usr/local +profile=stable + +usage () +{ + echo "Usage : configure [--prefix=PREFIX] [--prfile=PROFILE]" + echo + echo "Profiles available :" + ls -1 profiles +} + +validate_profile () +{ + test -z "$1" && return 0 + for c in `ls profiles`; do + if [ "$c" = "$1" ]; then + return 1 + fi + done + return 0 +} + +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 + popd > /dev/null + create_local_config $path + packages="$packages $path" + done + 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 +} + +while test x$1 != x; do + case $1 in + --prefix=*) + prefix=`echo $1 | sed 's/--prefix=//'` + ;; + --prefix) + echo --prefix needs an argument: --prefix=directory >&2 + + ;; + --profile=*) + prof=`echo $1 | sed 's/--profile=//'` + validate_profile "$prof" + if [ $? -eq 1 ]; then + profile=$prof + else + echo "Invalid profile name - $conf" + usage + exit 1 + fi + ;; + --help) + usage + exit + ;; + *) + echo Unknown argument $1 >&2 + usage + exit 1 + ;; + esac + shift +done + +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 + |