2016-08-17 19:36:50 +00:00
|
|
|
#!/bin/bash -e
|
2014-12-31 18:20:28 +00:00
|
|
|
|
|
|
|
# build Subsurface for Win32
|
|
|
|
#
|
2015-09-22 04:38:26 +00:00
|
|
|
# this file assumes that you have installed MXE on your system
|
2017-01-29 20:45:02 +00:00
|
|
|
# and installed a number of dependencies as well. Latest MXE
|
|
|
|
# version from git may not always work for Qt5 and Subsurface.
|
|
|
|
# Try to select an older release version like build-2016-10-12.
|
2015-09-22 04:38:26 +00:00
|
|
|
#
|
2017-01-29 20:45:02 +00:00
|
|
|
# cd ~/src
|
|
|
|
# git clone --branch build-2016-10-12 https://github.com/mxe/mxe
|
2015-09-22 04:38:26 +00:00
|
|
|
# cd mxe
|
2015-09-22 05:22:03 +00:00
|
|
|
#
|
|
|
|
# now create a file settings.mk
|
|
|
|
#---
|
|
|
|
# # This variable controls the number of compilation processes
|
|
|
|
# # within one package ("intra-package parallelism").
|
2017-01-29 20:45:02 +00:00
|
|
|
# # Set to higher value if you have a powerful machine.
|
|
|
|
# JOBS := 1
|
2015-09-22 05:22:03 +00:00
|
|
|
#
|
|
|
|
# # This variable controls the targets that will build.
|
|
|
|
# MXE_TARGETS := i686-w64-mingw32.shared
|
|
|
|
#---
|
|
|
|
# (documenting this in comments is hard... you need to remove
|
|
|
|
# the first '#' of course)
|
|
|
|
#
|
|
|
|
# now you can start the build
|
|
|
|
#
|
2017-01-02 13:21:30 +00:00
|
|
|
# make libxml2 libxslt libusb1 libzip qt5 nsis
|
2015-09-22 04:38:26 +00:00
|
|
|
#
|
|
|
|
# After quite a while (depending on your machine anywhere from 15-20
|
|
|
|
# minutes to several hours) you should have a working MXE install in
|
2017-01-29 20:45:02 +00:00
|
|
|
# ~/src/mxe
|
2015-09-22 04:38:26 +00:00
|
|
|
#
|
|
|
|
# Now this script will come in:
|
|
|
|
#
|
2017-01-29 20:45:02 +00:00
|
|
|
# This makes some assumption about the filesystem layout so you
|
|
|
|
# can build linux and windows build out of the same sources
|
2014-12-31 18:20:28 +00:00
|
|
|
# Something like this:
|
|
|
|
#
|
2017-01-29 20:45:02 +00:00
|
|
|
# ~/src/mxe <- MXE git with Qt5, automake (see above)
|
|
|
|
# /grantlee <- Grantlee 5.0.0 sources from git
|
|
|
|
# /libssh2 <- from git - v1.6 seems to work
|
|
|
|
# /libcurl <- from git - 7.42.1 seems to work - rename folder!
|
|
|
|
# /subsurface <- current subsurface git
|
|
|
|
# /libdivecomputer <- appropriate libdc/Subsurface-branch branch
|
|
|
|
# /marble-source <- appropriate marble/Subsurface-branch branch
|
|
|
|
# /libgit2 <- libgit2 0.23.1 or similar
|
2014-12-31 18:20:28 +00:00
|
|
|
#
|
2017-01-29 20:45:02 +00:00
|
|
|
# ~/src/win32 <- build directory
|
2014-12-31 18:20:28 +00:00
|
|
|
#
|
2017-01-29 20:45:02 +00:00
|
|
|
# then start this script from ~/src/win32
|
2014-12-31 18:20:28 +00:00
|
|
|
#
|
2017-01-29 20:45:02 +00:00
|
|
|
# cd ~/src/win32
|
|
|
|
# bash ../subsurface/packaging/windows/mxe-based-build.sh installer
|
2014-12-31 18:20:28 +00:00
|
|
|
#
|
|
|
|
# this should create the latest daily installer
|
2015-09-22 04:38:26 +00:00
|
|
|
#
|
|
|
|
# in order not to keep recompiling everything this script only compiles
|
|
|
|
# the other components if their directories are missing or if a "magic
|
|
|
|
# file" has been touched.
|
|
|
|
#
|
|
|
|
# so if you update one of the other libs do
|
|
|
|
#
|
2017-01-29 20:45:02 +00:00
|
|
|
# cd ~/src/win32
|
2015-09-22 04:38:26 +00:00
|
|
|
# touch build.<component>
|
2017-01-29 20:45:02 +00:00
|
|
|
# bash ../subsurface/packaging/windows/mxe-based-build.sh installer
|
2015-09-22 04:38:26 +00:00
|
|
|
#
|
|
|
|
# and that component gets rebuilt as well. E.g.
|
|
|
|
# touch build.libdivecomputer
|
|
|
|
# to rebuild libdivecomputer before you build Subsurface
|
|
|
|
#
|
|
|
|
# please send patches / additions to this file!
|
|
|
|
#
|
2014-12-31 18:20:28 +00:00
|
|
|
|
2015-09-22 04:38:26 +00:00
|
|
|
exec 1> >(tee ./winbuild.log) 2>&1
|
2014-12-31 18:20:28 +00:00
|
|
|
|
2015-09-22 04:38:26 +00:00
|
|
|
# for debugging
|
|
|
|
#trap "set +x; sleep 1; set -x" DEBUG
|
|
|
|
|
|
|
|
# this is run on a rather powerful machine - if you want less
|
|
|
|
# build parallelism, please change this variable
|
2015-12-16 16:14:59 +00:00
|
|
|
JOBS="-j4"
|
|
|
|
|
|
|
|
EXECDIR=`pwd`
|
|
|
|
BASEDIR=$(cd "$EXECDIR/.."; pwd)
|
|
|
|
BUILDDIR=$(cd "$EXECDIR"; pwd)
|
|
|
|
|
|
|
|
echo $BUILDDIR
|
2014-12-31 18:20:28 +00:00
|
|
|
|
2015-09-23 19:25:14 +00:00
|
|
|
if [[ ! -d "$BASEDIR"/mxe ]] ; then
|
2015-09-22 04:38:26 +00:00
|
|
|
echo "Please start this from the right directory "
|
|
|
|
echo "usually a winbuild directory parallel to the mxe directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Building in $BUILDDIR ..."
|
2014-12-31 18:20:28 +00:00
|
|
|
|
2015-09-23 19:25:14 +00:00
|
|
|
export PATH="$BASEDIR"/mxe/usr/bin:$PATH:"$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/qt5/bin/
|
2017-01-29 20:45:02 +00:00
|
|
|
export CXXFLAGS=-std=c++11
|
2014-12-31 18:20:28 +00:00
|
|
|
|
2015-09-23 19:25:14 +00:00
|
|
|
if [[ "$1" == "debug" ]] ; then
|
|
|
|
RELEASE="Debug"
|
|
|
|
shift
|
|
|
|
else
|
|
|
|
RELEASE="Release"
|
|
|
|
fi
|
2014-12-31 18:20:28 +00:00
|
|
|
|
2015-09-22 04:38:26 +00:00
|
|
|
# grantlee
|
|
|
|
|
2015-09-23 19:25:14 +00:00
|
|
|
cd "$BUILDDIR"
|
2015-09-22 04:38:26 +00:00
|
|
|
if [[ ! -d grantlee || -f build.grantlee ]] ; then
|
|
|
|
rm -f build.grantlee
|
|
|
|
mkdir -p grantlee
|
|
|
|
cd grantlee
|
2015-09-23 19:25:14 +00:00
|
|
|
cmake -DCMAKE_TOOLCHAIN_FILE="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \
|
|
|
|
-DCMAKE_BUILD_TYPE=$RELEASE \
|
2015-09-22 04:38:26 +00:00
|
|
|
-DBUILD_TESTS=OFF \
|
2015-09-23 19:25:14 +00:00
|
|
|
"$BASEDIR"/grantlee
|
2014-12-31 18:20:28 +00:00
|
|
|
|
2015-09-22 04:38:26 +00:00
|
|
|
make $JOBS
|
|
|
|
make install
|
|
|
|
fi
|
2014-12-31 18:20:28 +00:00
|
|
|
|
|
|
|
|
2015-09-22 04:38:26 +00:00
|
|
|
# libssh2:
|
|
|
|
|
2015-09-23 19:25:14 +00:00
|
|
|
cd "$BUILDDIR"
|
2015-09-22 04:38:26 +00:00
|
|
|
if [[ ! -d libssh2 || -f build.libssh2 ]] ; then
|
|
|
|
rm -f build.libssh2
|
|
|
|
mkdir -p libssh2
|
|
|
|
cd libssh2
|
|
|
|
|
2015-09-23 19:25:14 +00:00
|
|
|
cmake -DCMAKE_TOOLCHAIN_FILE="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \
|
|
|
|
-DCMAKE_BUILD_TYPE=$RELEASE \
|
2015-09-22 04:38:26 +00:00
|
|
|
-DBUILD_EXAMPLES=OFF \
|
|
|
|
-DBUILD_TESTING=OFF \
|
|
|
|
-DBUILD_SHARED_LIBS=ON \
|
2015-09-23 19:25:14 +00:00
|
|
|
"$BASEDIR"/libssh2
|
2015-09-22 04:38:26 +00:00
|
|
|
make $JOBS
|
|
|
|
make install
|
|
|
|
# don't install your dlls in bin, please
|
2015-09-23 19:25:14 +00:00
|
|
|
cp "$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/bin/libssh2.dll "$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/lib
|
2015-09-22 04:38:26 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# libcurl
|
|
|
|
|
2015-09-23 19:25:14 +00:00
|
|
|
cd "$BUILDDIR"
|
2015-09-22 04:38:26 +00:00
|
|
|
if [[ ! -d libcurl || -f build.libcurl ]] ; then
|
|
|
|
rm -f build.libcurl
|
|
|
|
mkdir -p libcurl
|
|
|
|
cd libcurl
|
|
|
|
../../libcurl/configure --host=i686-w64-mingw32.shared \
|
2015-09-23 19:25:14 +00:00
|
|
|
--prefix="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/ \
|
2015-09-22 04:38:26 +00:00
|
|
|
--disable-ftp \
|
|
|
|
--disable-ldap \
|
|
|
|
--disable-ldaps \
|
|
|
|
--disable-rtsp \
|
|
|
|
--enable-proxy \
|
|
|
|
--enable-dict \
|
|
|
|
--disable-telnet \
|
|
|
|
--disable-tftp \
|
|
|
|
--disable-pop3 \
|
|
|
|
--disable-imap \
|
|
|
|
--disable-smb \
|
|
|
|
--disable-smtp \
|
|
|
|
--disable-gopher \
|
|
|
|
--disable-manual \
|
2015-09-23 19:25:14 +00:00
|
|
|
--with-libssh2="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/
|
2015-09-22 04:38:26 +00:00
|
|
|
|
|
|
|
# now remove building the executable
|
|
|
|
sed -i 's/SUBDIRS = lib src include/SUBDIRS = lib include/' Makefile
|
|
|
|
|
|
|
|
make $JOBS
|
|
|
|
make install
|
|
|
|
fi
|
|
|
|
|
2014-12-31 18:20:28 +00:00
|
|
|
|
|
|
|
# libgit2:
|
|
|
|
|
2015-09-23 19:25:14 +00:00
|
|
|
cd "$BUILDDIR"
|
2015-09-22 04:38:26 +00:00
|
|
|
if [[ ! -d libgit2 || -f build.libgit2 ]] ; then
|
|
|
|
rm -f build.libgit2
|
|
|
|
mkdir -p libgit2
|
|
|
|
cd libgit2
|
2015-09-23 19:25:14 +00:00
|
|
|
cmake -DCMAKE_TOOLCHAIN_FILE="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \
|
2015-09-22 04:38:26 +00:00
|
|
|
-DBUILD_CLAR=OFF -DTHREADSAFE=ON \
|
2015-09-23 19:25:14 +00:00
|
|
|
-DCMAKE_BUILD_TYPE=$RELEASE \
|
|
|
|
-DDLLTOOL="$BASEDIR"/mxe/usr/bin/i686-w64-mingw32.shared-dlltool \
|
|
|
|
"$BASEDIR"/libgit2
|
2015-09-22 04:38:26 +00:00
|
|
|
make $JOBS
|
|
|
|
make install
|
|
|
|
fi
|
|
|
|
|
|
|
|
# libdivecomputer
|
|
|
|
#
|
|
|
|
# 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
|
2015-09-23 19:25:14 +00:00
|
|
|
# the original source directory... so the "$BASEDIR"/libdivecomputer is
|
2015-09-22 04:38:26 +00:00
|
|
|
# a local clone of the "real" libdivecomputer directory
|
2014-12-31 18:20:28 +00:00
|
|
|
|
2015-09-23 19:25:14 +00:00
|
|
|
cd "$BUILDDIR"
|
2015-09-22 04:38:26 +00:00
|
|
|
if [[ ! -d libdivecomputer || -f build.libdivecomputer ]] ; then
|
2017-01-29 20:45:02 +00:00
|
|
|
rm -f build.libdivecomputer
|
2015-09-23 19:25:14 +00:00
|
|
|
cd "$BASEDIR"/libdivecomputer
|
2015-09-22 04:38:26 +00:00
|
|
|
git pull
|
2015-09-23 19:25:14 +00:00
|
|
|
cd "$BUILDDIR"
|
2015-09-22 04:38:26 +00:00
|
|
|
mkdir -p libdivecomputer
|
|
|
|
cd libdivecomputer
|
2014-12-31 18:20:28 +00:00
|
|
|
|
2015-09-23 19:25:14 +00:00
|
|
|
"$BASEDIR"/libdivecomputer/configure --host=i686-w64-mingw32.shared \
|
2015-10-26 21:27:16 +00:00
|
|
|
--enable-shared \
|
2015-09-23 19:25:14 +00:00
|
|
|
--prefix="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared
|
2015-09-22 04:38:26 +00:00
|
|
|
make $JOBS
|
|
|
|
make install
|
|
|
|
else
|
|
|
|
echo ""
|
|
|
|
echo ""
|
|
|
|
echo "WARNING!!!!"
|
|
|
|
echo ""
|
|
|
|
echo "libdivecoputer not rebuilt!!"
|
|
|
|
echo ""
|
|
|
|
echo ""
|
|
|
|
fi
|
2014-12-31 18:20:28 +00:00
|
|
|
|
2015-09-22 04:38:26 +00:00
|
|
|
# marble:
|
2014-12-31 18:20:28 +00:00
|
|
|
|
2015-09-23 19:25:14 +00:00
|
|
|
cd "$BUILDDIR"
|
2015-09-22 04:38:26 +00:00
|
|
|
if [[ ! -d marble || -f build.marble ]] ; then
|
2017-01-29 20:45:02 +00:00
|
|
|
rm -f build.marble
|
2015-09-22 04:38:26 +00:00
|
|
|
mkdir -p marble
|
|
|
|
cd marble
|
2015-09-23 19:25:14 +00:00
|
|
|
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 \
|
2015-09-22 04:38:26 +00:00
|
|
|
-DQTONLY=ON -DQT5BUILD=ON \
|
|
|
|
-DBUILD_MARBLE_APPS=OFF -DBUILD_MARBLE_EXAMPLES=OFF \
|
|
|
|
-DBUILD_MARBLE_TESTS=OFF -DBUILD_MARBLE_TOOLS=OFF \
|
|
|
|
-DBUILD_TESTING=OFF -DWITH_DESIGNER_PLUGIN=OFF \
|
|
|
|
-DBUILD_WITH_DBUS=OFF \
|
2015-09-23 19:25:14 +00:00
|
|
|
-DCMAKE_BUILD_TYPE=$RELEASE \
|
|
|
|
"$BASEDIR"/marble-source
|
2015-09-22 04:38:26 +00:00
|
|
|
make $JOBS
|
|
|
|
make install
|
|
|
|
# what the heck is marble doing?
|
2015-09-23 19:25:14 +00:00
|
|
|
mv "$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/libssrfmarblewidget.dll "$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/lib
|
2014-12-31 18:20:28 +00:00
|
|
|
fi
|
2015-09-22 04:38:26 +00:00
|
|
|
|
2014-12-31 18:20:28 +00:00
|
|
|
###############
|
2015-09-22 04:38:26 +00:00
|
|
|
# finally, Subsurface
|
|
|
|
|
2015-09-23 19:25:14 +00:00
|
|
|
cd "$BUILDDIR"
|
2015-12-16 16:14:59 +00:00
|
|
|
echo "Starting Subsurface Build"
|
2015-09-23 19:25:14 +00:00
|
|
|
|
|
|
|
# things go weird if we don't create a new build directory... Subsurface
|
|
|
|
# suddenly gets linked against Qt5Guid.a etc...
|
|
|
|
rm -rf subsurface
|
2015-09-22 16:28:36 +00:00
|
|
|
|
|
|
|
# first copy the Qt plugins in place
|
2015-09-22 04:38:26 +00:00
|
|
|
mkdir -p subsurface/staging/plugins
|
|
|
|
cd subsurface/staging/plugins
|
2015-09-23 19:25:14 +00:00
|
|
|
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/platforms .
|
|
|
|
cp -a "$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/qt5/plugins/printsupport .
|
2015-09-22 04:38:26 +00:00
|
|
|
|
2015-09-22 16:28:36 +00:00
|
|
|
# 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
|
2015-09-23 19:25:14 +00:00
|
|
|
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
|
2015-09-22 16:28:36 +00:00
|
|
|
|
2015-09-23 19:25:14 +00:00
|
|
|
cd "$BUILDDIR"/subsurface
|
2014-12-31 18:20:28 +00:00
|
|
|
|
2015-12-16 16:14:59 +00:00
|
|
|
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_BUILD_TYPE=$RELEASE \
|
|
|
|
-DQT_TRANSLATION_DIR="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/qt5/translations \
|
|
|
|
-DMAKENSIS=i686-w64-mingw32.shared-makensis \
|
|
|
|
-DLIBDIVECOMPUTER_INCLUDE_DIR="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/include \
|
|
|
|
-DLIBDIVECOMPUTER_LIBRARIES="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/lib/libdivecomputer.dll.a \
|
|
|
|
-DMARBLE_INCLUDE_DIR="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/include \
|
|
|
|
-DMARBLE_LIBRARIES="$BASEDIR"/mxe/usr/i686-w64-mingw32.shared/lib/libssrfmarblewidget.dll \
|
2017-01-02 13:21:30 +00:00
|
|
|
-DMAKE_TESTS=OFF \
|
2015-12-16 16:14:59 +00:00
|
|
|
"$BASEDIR"/subsurface
|
2015-09-22 04:38:26 +00:00
|
|
|
|
2015-09-23 19:25:14 +00:00
|
|
|
make $JOBS "$@"
|