Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[cross-compilation] Added some flexibility regarding the location of …

…development packages

The script now supports an extra cross-compilation directory in which you can unpack the
library and development packages necessary for the build to succeed (glib, zlib etc). Also
supported now is specifying the location at which Mono will be installed on Windows.
Replaced SVN and GIT-SVN version checks with git checks.
  • Loading branch information...
commit a8362f1a1469ae47ff9b21116f8272f145c115f1 1 parent 90f74ba
@grendello grendello authored
Showing with 94 additions and 32 deletions.
  1. +94 −32 build-mingw32.sh
View
126 build-mingw32.sh
@@ -2,6 +2,7 @@
CURDIR="`pwd`"
MINGW=i386-mingw32msvc
CROSS_DIR=/opt/cross/$MINGW
+EXTRA_CROSS_DIR=
INSTALL_DESTDIR="$CURDIR/mono-win32"
PROFILES="default net_2_0 net_3_5 net_4_0 moonlight"
TEMPORARY_PKG_CONFIG_DIR=/tmp/$RANDOM-pkg-config-$RANDOM
@@ -16,63 +17,119 @@ function cleanup ()
fi
}
+function check_pkg_config_dir ()
+{
+ local DIR="$1"
+ local DIR_PREFIX="$2"
+
+ if [ ! -d "$DIR" ]; then
+ return
+ fi
+
+ install -d -m 755 "$TEMPORARY_PKG_CONFIG_DIR"
+ for pc in "$DIR"/*.pc; do
+ if [ -f $pc ]; then
+ pcname="`basename $pc`"
+ sed -e "s;^prefix=.*;prefix=$DIR_PREFIX;g" < $pc > "$TEMPORARY_PKG_CONFIG_DIR"/$pcname
+ fi;
+ done
+
+ if [ -z "$CROSS_PKG_CONFIG_DIR" ]; then
+ CROSS_PKG_CONFIG_DIR="$TEMPORARY_PKG_CONFIG_DIR"
+ fi
+}
+
+function show_build_info ()
+{
+ cat <<EOF
+Installation prefix: $MONO_PREFIX
+ CPPFLAGS: ${CPPFLAGS:=not set}
+ LDFLAGS: ${LDFLAGS:=not set}
+ MONO_PATH: ${MONO_PATH:=not set}
+EOF
+}
+
function setup ()
{
local pcname
CROSS_BIN_DIR="$CROSS_DIR/bin"
CROSS_DLL_DIR="$CROSS_DIR/bin"
- CROSS_PKG_CONFIG_DIR=$CROSS_DIR/lib/pkgconfig
PATH=$CROSS_BIN_DIR:$PATH
MONO_VERSION=`grep AM_INIT_AUTOMAKE configure.in | cut -d ',' -f 2|tr -d '\)'`
- export PATH
- if [ -d ./.git/svn ]; then
- SVN_INFO='git svn info'
- elif [ -d ./.svn ]; then
- SVN_INFO='svn info'
- else
- SVN_INFO=""
- fi
-
- if [ -n "$SVN_INFO" ]; then
- MONO_SVN_REVISION=`$SVN_INFO | grep Revision | sed 's/.*: //'`
- MONO_BRANCH=`$SVN_INFO | grep URL | sed -e 's;.*source/;;g' -e 's;/mono;;g'`
- MONO_RELEASE="$MONO_VERSION-$MONO_BRANCH-r$MONO_SVN_REVISION"
+
+ if [ -d ./.git ]; then
+ MONO_GIT_COMMIT="`git log -1 --format=format:%t`"
+ MONO_GIT_BRANCH="`git branch|grep '\*'|cut -d ' ' -f 2`"
+ MONO_RELEASE="$MONO_VERSION-$MONO_GIT_BRANCH-$MONO_GIT_COMMIT"
else
MONO_RELEASE="$MONO_VERSION"
fi
- MONO_PREFIX="/mono-$MONO_RELEASE"
+ MONO_PREFIX="$MONO_PREFIX/mono-$MONO_RELEASE"
NOCONFIGURE=yes
export NOCONFIGURE
- if [ -d "$CROSS_PKG_CONFIG_DIR" ]; then
- install -d -m 755 "$TEMPORARY_PKG_CONFIG_DIR"
- for pc in "$CROSS_PKG_CONFIG_DIR"/*.pc; do
- if [ -f $pc ]; then
- pcname="`basename $pc`"
- sed -e "s;^prefix=.*;prefix=$CROSS_DIR;g" < $pc > "$TEMPORARY_PKG_CONFIG_DIR"/$pcname
- fi;
- done
- CROSS_PKG_CONFIG_DIR="$TEMPORARY_PKG_CONFIG_DIR"
+ check_pkg_config_dir "$CROSS_DIR/lib/pkgconfig" "$CROSS_DIR"
+
+ if [ -n "$EXTRA_CROSS_DIR" -a -d "$EXTRA_CROSS_DIR" ]; then
+ if [ -d "$EXTRA_CROSS_DIR/bin" ]; then
+ PATH="$EXTRA_CROSS_DIR/bin":$PATH
+ fi
+
+ check_pkg_config_dir "$EXTRA_CROSS_DIR/lib/pkgconfig" "$EXTRA_CROSS_DIR"
+
+ if [ -d "$EXTRA_CROSS_DIR/include" ]; then
+ if [ -z "$CPPFLAGS" ]; then
+ CPPFLAGS="-I \"$EXTRA_CROSS_DIR/include\""
+ else
+ CPPFLAGS="-I \"$EXTRA_CROSS_DIR/include\" $CFLAGS"
+ fi
+ fi
+
+ if [ -d "$EXTRA_CROSS_DIR/lib" ]; then
+ if [ -z "$LDFLAGS" ]; then
+ LDFLAGS="-I \"$EXTRA_CROSS_DIR/lib\""
+ else
+ LDFLAGS="-I \"$EXTRA_CROSS_DIR/lib\" $LDFLAGS"
+ fi
+ fi
+
+ if [ -d "$EXTRA_CROSS_DIR/share/aclocal" ]; then
+ if [ -z "$MONO_PATH" ]; then
+ MONO_PATH="\"$EXTRA_CROSS_DIR\""
+ else
+ MONO_PATH="\"$EXTRA_CROSS_DIR\":$MONO_PATH"
+ fi
+ fi
fi
-
- echo Mono Win32 installation prefix: $MONO_PREFIX
+
+ export PATH MONO_PATH CPPFLAGS
+ show_build_info
}
function build ()
{
- ./autogen.sh
-
- BUILD="`./config.guess`"
-
if [ -f ./Makefile ]; then
make distclean
- rm -rf autom4te.cache
fi
+ if [ -d ./autom4te.cache ]; then
+ rm -rf ./autom4te.cache
+ fi
+
+ if [ -f ./config.status ]; then
+ for f in `find -name config.status -type f`; do
+ rm $f
+ done
+ fi
+
+ ./autogen.sh
+
+ BUILD="`./config.guess`"
+
if [ ! -d "$CURDIR/build-cross-windows" ]; then
mkdir "$CURDIR/build-cross-windows"
fi
@@ -140,7 +197,9 @@ Usage: build-mingw32.sh [OPTIONS]
where OPTIONS are:
-d DIR Sets the location of directory where MINGW is installed [$CROSS_DIR]
+ -e DIR Sets the location of directory where additional cross develoment packages are installed [${EXTRA_CROSS_DIR:=none}]
-m MINGW Sets the MINGW target name to be passed to configure [$MINGW]
+ -p PREFIX Prefix at which Mono is to be installed. Build will append the 'mono-X.Y' string to that path
EOF
exit 1
@@ -150,10 +209,12 @@ trap cleanup 0
pushd . > /dev/null
-while getopts "d:m:h" opt; do
+while getopts "d:m:e:p:" opt; do
case "$opt" in
d) CROSS_DIR="$OPTARG" ;;
m) MINGW="$OPTARG" ;;
+ e) EXTRA_CROSS_DIR="$OPTARG" ;;
+ p) MONO_PREFIX="$OPTARG" ;;
*) usage ;;
esac
done
@@ -161,5 +222,6 @@ done
setup
build
doinstall
+show_build_info
popd > /dev/null
Please sign in to comment.
Something went wrong with that request. Please try again.