MXE build script: more cleanups

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-09-23 12:25:14 -07:00
parent a30e78140f
commit 148b30849a

View file

@ -126,10 +126,10 @@ exec 1> >(tee ./winbuild.log) 2>&1
# this is run on a rather powerful machine - if you want less # this is run on a rather powerful machine - if you want less
# build parallelism, please change this variable # build parallelism, please change this variable
JOBS="-j12" JOBS="-j12"
BASEDIR=$(cd "`dirname $0`/.."; pwd) BASEDIR=$(cd "$(dirname $0)/.."; pwd)
BUILDDIR=$(cd "`dirname $0`"; pwd) BUILDDIR=$(cd "$(dirname $0)"; pwd)
if [[ ! -d $BASEDIR/mxe ]] ; then if [[ ! -d "$BASEDIR"/mxe ]] ; then
echo "Please start this from the right directory " echo "Please start this from the right directory "
echo "usually a winbuild directory parallel to the mxe directory" echo "usually a winbuild directory parallel to the mxe directory"
exit 1 exit 1
@ -137,20 +137,26 @@ fi
echo "Building in $BUILDDIR ..." echo "Building in $BUILDDIR ..."
export PATH=$BASEDIR/mxe/usr/bin:$PATH:$BASEDIR/mxe/usr/i686-w64-mingw32.shared/qt5/bin/ export PATH="$BASEDIR"/mxe/usr/bin:$PATH:"$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/qt5/bin/
if [[ "$1" == "debug" ]] ; then
RELEASE="Debug"
shift
else
RELEASE="Release"
fi
# grantlee # grantlee
cd $BUILDDIR cd "$BUILDDIR"
if [[ ! -d grantlee || -f build.grantlee ]] ; then if [[ ! -d grantlee || -f build.grantlee ]] ; then
rm -f build.grantlee rm -f build.grantlee
mkdir -p grantlee mkdir -p grantlee
cd grantlee cd grantlee
cmake -DCMAKE_TOOLCHAIN_FILE=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \ cmake -DCMAKE_TOOLCHAIN_FILE="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=$RELEASE \
-DBUILD_TESTS=OFF \ -DBUILD_TESTS=OFF \
$BASEDIR/grantlee "$BASEDIR"/grantlee
make $JOBS make $JOBS
make install make install
@ -159,33 +165,34 @@ fi
# libssh2: # libssh2:
cd $BUILDDIR cd "$BUILDDIR"
if [[ ! -d libssh2 || -f build.libssh2 ]] ; then if [[ ! -d libssh2 || -f build.libssh2 ]] ; then
rm -f build.libssh2 rm -f build.libssh2
mkdir -p libssh2 mkdir -p libssh2
cd libssh2 cd libssh2
cmake -DCMAKE_TOOLCHAIN_FILE=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \ cmake -DCMAKE_TOOLCHAIN_FILE="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \
-DCMAKE_BUILD_TYPE=$RELEASE \
-DBUILD_EXAMPLES=OFF \ -DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF \ -DBUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=ON \ -DBUILD_SHARED_LIBS=ON \
$BASEDIR/libssh2 "$BASEDIR"/libssh2
make $JOBS make $JOBS
make install make install
# don't install your dlls in bin, please # don't install your dlls in bin, please
cp $BASEDIR/mxe/usr/i686-w64-mingw32.shared/bin/libssh2.dll $BASEDIR/mxe/usr/i686-w64-mingw32.shared/lib cp "$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/bin/libssh2.dll "$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/lib
fi fi
# libcurl # libcurl
cd $BUILDDIR cd "$BUILDDIR"
if [[ ! -d libcurl || -f build.libcurl ]] ; then if [[ ! -d libcurl || -f build.libcurl ]] ; then
rm -f build.libcurl rm -f build.libcurl
mkdir -p libcurl mkdir -p libcurl
cd libcurl cd libcurl
../../libcurl/configure --host=i686-w64-mingw32.shared \ ../../libcurl/configure --host=i686-w64-mingw32.shared \
--prefix=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/ \ --prefix="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/ \
--disable-ftp \ --disable-ftp \
--disable-ldap \ --disable-ldap \
--disable-ldaps \ --disable-ldaps \
@ -200,7 +207,7 @@ if [[ ! -d libcurl || -f build.libcurl ]] ; then
--disable-smtp \ --disable-smtp \
--disable-gopher \ --disable-gopher \
--disable-manual \ --disable-manual \
--with-libssh2=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/ --with-libssh2="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/
# now remove building the executable # now remove building the executable
sed -i 's/SUBDIRS = lib src include/SUBDIRS = lib include/' Makefile sed -i 's/SUBDIRS = lib src include/SUBDIRS = lib include/' Makefile
@ -212,15 +219,15 @@ fi
# libzip # libzip
cd $BUILDDIR cd "$BUILDDIR"
if [[ ! -d libzip || -f build.libzip ]] ; then if [[ ! -d libzip || -f build.libzip ]] ; then
rm -f build.libzip rm -f build.libzip
mkdir -p libzip mkdir -p libzip
cd libzip cd libzip
# cmake -DCMAKE_TOOLCHAIN_FILE=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \ # cmake -DCMAKE_TOOLCHAIN_FILE="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \
# -DCMAKE_BUILD_TYPE=Release \ # -DCMAKE_BUILD_TYPE=Release \
# $BASEDIR/libzip # "$BASEDIR"/libzip
$BASEDIR/libzip/configure --host=i686-w64-mingw32.shared --prefix=$BASEDIR/mxe/usr/i686-w64-mingw32.shared "$BASEDIR"/libzip/configure --host=i686-w64-mingw32.shared --prefix="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared
make $JOBS make $JOBS
make install make install
fi fi
@ -228,15 +235,16 @@ fi
# libgit2: # libgit2:
cd $BUILDDIR cd "$BUILDDIR"
if [[ ! -d libgit2 || -f build.libgit2 ]] ; then if [[ ! -d libgit2 || -f build.libgit2 ]] ; then
rm -f build.libgit2 rm -f build.libgit2
mkdir -p libgit2 mkdir -p libgit2
cd libgit2 cd libgit2
cmake -DCMAKE_TOOLCHAIN_FILE=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \ cmake -DCMAKE_TOOLCHAIN_FILE="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \
-DBUILD_CLAR=OFF -DTHREADSAFE=ON \ -DBUILD_CLAR=OFF -DTHREADSAFE=ON \
-DDLLTOOL=$BASEDIR/mxe/usr/bin/i686-w64-mingw32.shared-dlltool \ -DCMAKE_BUILD_TYPE=$RELEASE \
$BASEDIR/libgit2 -DDLLTOOL="$BASEDIR"/mxe/usr/bin/i686-w64-mingw32.shared-dlltool \
"$BASEDIR"/libgit2
make $JOBS make $JOBS
make install make install
fi fi
@ -245,21 +253,21 @@ fi
# #
# this one is special because we want to make sure it's in sync # this one is special because we want to make sure it's in sync
# with the Linux builds, but we don't want the autoconf files cluttering # with the Linux builds, but we don't want the autoconf files cluttering
# the original source directory... so the $BASEDIR/libdivecomputer is # the original source directory... so the "$BASEDIR"/libdivecomputer is
# a local clone of the "real" libdivecomputer directory # a local clone of the "real" libdivecomputer directory
cd $BUILDDIR cd "$BUILDDIR"
if [[ ! -d libdivecomputer || -f build.libdivecomputer ]] ; then if [[ ! -d libdivecomputer || -f build.libdivecomputer ]] ; then
rm build.libdivecomputer rm build.libdivecomputer
cd $BASEDIR/libdivecomputer cd "$BASEDIR"/libdivecomputer
git pull git pull
cd $BUILDDIR cd "$BUILDDIR"
mkdir -p libdivecomputer mkdir -p libdivecomputer
cd libdivecomputer cd libdivecomputer
$BASEDIR/libdivecomputer/configure --host=i686-w64-mingw32.shared \ "$BASEDIR"/libdivecomputer/configure --host=i686-w64-mingw32.shared \
--enable-static --disable-shared \ --enable-static --disable-shared \
--prefix=$BASEDIR/mxe/usr/i686-w64-mingw32.shared --prefix="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared
make $JOBS make $JOBS
make install make install
else else
@ -274,74 +282,79 @@ fi
# marble: # marble:
cd $BUILDDIR cd "$BUILDDIR"
if [[ ! -d marble || -f build.marble ]] ; then if [[ ! -d marble || -f build.marble ]] ; then
rm build.marble rm build.marble
mkdir -p marble mkdir -p marble
cd marble cd marble
cmake -DCMAKE_TOOLCHAIN_FILE=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \ cmake -DCMAKE_TOOLCHAIN_FILE="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \
-DCMAKE_PREFIX_PATH=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/qt5 \ -DCMAKE_PREFIX_PATH="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/qt5 \
-DQTONLY=ON -DQT5BUILD=ON \ -DQTONLY=ON -DQT5BUILD=ON \
-DBUILD_MARBLE_APPS=OFF -DBUILD_MARBLE_EXAMPLES=OFF \ -DBUILD_MARBLE_APPS=OFF -DBUILD_MARBLE_EXAMPLES=OFF \
-DBUILD_MARBLE_TESTS=OFF -DBUILD_MARBLE_TOOLS=OFF \ -DBUILD_MARBLE_TESTS=OFF -DBUILD_MARBLE_TOOLS=OFF \
-DBUILD_TESTING=OFF -DWITH_DESIGNER_PLUGIN=OFF \ -DBUILD_TESTING=OFF -DWITH_DESIGNER_PLUGIN=OFF \
-DBUILD_WITH_DBUS=OFF \ -DBUILD_WITH_DBUS=OFF \
$BASEDIR/marble-source -DCMAKE_BUILD_TYPE=$RELEASE \
"$BASEDIR"/marble-source
make $JOBS make $JOBS
make install make install
# what the heck is marble doing? # what the heck is marble doing?
mv $BASEDIR/mxe/usr/i686-w64-mingw32.shared/libssrfmarblewidget.dll $BASEDIR/mxe/usr/i686-w64-mingw32.shared/lib mv "$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/libssrfmarblewidget.dll "$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/lib
fi fi
############### ###############
# finally, Subsurface # finally, Subsurface
cd $BUILDDIR cd "$BUILDDIR"
# things go weird if we don't create a new build directory... Subsurface
# suddenly gets linked against Qt5Guid.a etc...
rm -rf subsurface
# first copy the Qt plugins in place # first copy the Qt plugins in place
mkdir -p subsurface/staging/plugins mkdir -p subsurface/staging/plugins
cd subsurface/staging/plugins cd subsurface/staging/plugins
cp -a $BASEDIR/mxe/usr/i686-w64-mingw32.shared/qt5/plugins/iconengines . cp -a "$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/qt5/plugins/iconengines .
cp -a $BASEDIR/mxe/usr/i686-w64-mingw32.shared/qt5/plugins/imageformats . cp -a "$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/qt5/plugins/imageformats .
cp -a $BASEDIR/mxe/usr/i686-w64-mingw32.shared/qt5/plugins/platforms . cp -a "$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/qt5/plugins/platforms .
cp -a $BASEDIR/mxe/usr/i686-w64-mingw32.shared/qt5/plugins/printsupport . cp -a "$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/qt5/plugins/printsupport .
# for some reason we aren't installing libssrfmarblewidget.dll and # Qt5Xml.dll # for some reason we aren't installing libssrfmarblewidget.dll and # Qt5Xml.dll
# I need to figure out why and fix that, but for now just manually copy that as well # I need to figure out why and fix that, but for now just manually copy that as well
cp $BASEDIR/mxe/usr/i686-w64-mingw32.shared/lib/libssrfmarblewidget.dll $BUILDDIR/subsurface/staging cp "$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/lib/libssrfmarblewidget.dll "$BUILDDIR"/subsurface/staging
cp $BASEDIR/mxe/usr/i686-w64-mingw32.shared/qt5/bin/Qt5Xml.dll $BUILDDIR/subsurface/staging cp "$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/qt5/bin/Qt5Xml.dll "$BUILDDIR"/subsurface/staging
cd $BUILDDIR/subsurface cd "$BUILDDIR"/subsurface
if [[ "$1" == "qmake" ]] ; then if [[ "$1" == "qmake" ]] ; then
shift shift
export objdump=$BASEDIR/mxe/usr/bin/i686-w64-mingw32.shared-objdump export objdump="$BASEDIR"/mxe/usr/bin/i686-w64-mingw32.shared-objdump
i686-w64-mingw32.shared-qmake-qt5 \ i686-w64-mingw32.shared-qmake-qt5 \
LIBMARBLEDEVEL=../marble \ LIBMARBLEDEVEL=../marble \
LIBGIT2DEVEL=../libgit2 CONFIG+=libgit21-api \ LIBGIT2DEVEL=../libgit2 CONFIG+=libgit21-api \
CROSS_PATH=$BASEDIR/mxe/usr/i686-w64-mingw32.shared \ CROSS_PATH="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared \
QMAKE_LRELEASE=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/qt5/bin/lrelease \ QMAKE_LRELEASE="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/qt5/bin/lrelease \
SPECIAL_MARBLE_PREFIX=1 \ SPECIAL_MARBLE_PREFIX=1 \
MAKENSIS=i686-w64-mingw32.shared-makensis \ MAKENSIS=i686-w64-mingw32.shared-makensis \
$BASEDIR/../subsurface/subsurface.pro "$BASEDIR"/../subsurface/subsurface.pro
# LIBDCDEVEL=../libdivecomputer \ # LIBDCDEVEL=../libdivecomputer \
else else
cmake -DCMAKE_TOOLCHAIN_FILE=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \ cmake -DCMAKE_TOOLCHAIN_FILE="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \
-DCMAKE_PREFIX_PATH=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/qt5 \ -DCMAKE_PREFIX_PATH="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/qt5 \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=$RELEASE \
-DQT_TRANSLATION_DIR=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/qt5/translations \ -DQT_TRANSLATION_DIR="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/qt5/translations \
-DMAKENSIS=i686-w64-mingw32.shared-makensis \ -DMAKENSIS=i686-w64-mingw32.shared-makensis \
-DUSE_LIBGIT23_API=1 \ -DUSE_LIBGIT23_API=1 \
-DLIBDIVECOMPUTER_INCLUDE_DIR=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/include \ -DLIBDIVECOMPUTER_INCLUDE_DIR="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/include \
-DLIBDIVECOMPUTER_LIBRARIES=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/lib/libdivecomputer.a \ -DLIBDIVECOMPUTER_LIBRARIES="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/lib/libdivecomputer.a \
-DMARBLE_INCLUDE_DIR=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/include \ -DMARBLE_INCLUDE_DIR="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/include \
-DMARBLE_LIBRARIES=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/lib/libssrfmarblewidget.dll \ -DMARBLE_LIBRARIES="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/lib/libssrfmarblewidget.dll \
$BASEDIR/subsurface "$BASEDIR"/subsurface
#sed -i 's@-lssh2@/home/hohndel/src/win/win32/libgit2/libssh2.dll@g' CMakeFiles/subsurface.dir/link.txt #sed -i 's@-lssh2@/home/hohndel/src/win/win32/libgit2/libssh2.dll@g' CMakeFiles/subsurface.dir/link.txt
fi fi
make $JOBS $@ make $JOBS "$@"