diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-09-21 21:38:26 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-09-21 21:39:41 -0700 |
commit | 5982092858b2f5bd084a83e269f5185c1920a9bf (patch) | |
tree | 744e0f826a46be1573eaea92d52032439b1a3df8 /packaging | |
parent | 692ef8f1419bea819ad1ea2728ba88b9a0605fe9 (diff) | |
download | subsurface-5982092858b2f5bd084a83e269f5185c1920a9bf.tar.gz |
Update MXE cross build script
Instructions how to use it are in the script.
As of today this doesn't create working binaries - this worked perfectly
fine back when MXE was still based on Qt5.4
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'packaging')
-rwxr-xr-x | packaging/windows/mxe-based-build.sh | 353 |
1 files changed, 249 insertions, 104 deletions
diff --git a/packaging/windows/mxe-based-build.sh b/packaging/windows/mxe-based-build.sh index 9e6542f69..e7e5b9aa0 100755 --- a/packaging/windows/mxe-based-build.sh +++ b/packaging/windows/mxe-based-build.sh @@ -2,30 +2,52 @@ # build Subsurface for Win32 # -# this file assumes that you have installed mxe on your system +# this file assumes that you have installed MXE on your system # and installed a number of dependencies as well -# it also makes some assumption about the filesystem layout based +# +# cd ~/src/win +# git clone https://github.com/mxe/mxe +# cd mxe +# make libxml2 libxslt libusb1 qt5 +# +# after qtbase has finished building you need to edit +# ~/src/win/mxe/usr/i686-w64-mingw32.shared/qt5/mkspecs/qconfig.pri +# and add the following line at the top: +# MINGW_IN_SHELL = 1 +# (of course without the leading '#') +# then you can enable the QtWebKit build by editing +# ~/src/win/mxe/src/qtwebkit.mk and changing the "disabled" define to read +# +# define $(PKG)_BUILD_SHARED +# # looks for build tools with .exe suffix and tries to use win_flex +# $(SED) -i 's,\.exe,,' '$(1)/Tools/qmake/mkspecs/features/functions.prf' +# ... +# +# and remove the empty definition of $(PKG)_BUILD_SHARED below +# +# Do all this in a separate terminal while the build is still running :-) +# After quite a while (depending on your machine anywhere from 15-20 +# minutes to several hours) you should have a working MXE install in +# ~/src/win/mxe +# +# Now this script will come in: +# +# This makes some assumption about the filesystem layout based # on the way things are setup on my system so I can build Ubuntu PPA, # OBS and Windows out of the same sources. # Something like this: # -# ~/src/win/mxe <- current MXE git with Qt5, automake -# /win/libxml2 <- libxml from git -# /win/libxslt <- libxslt from git -# /win/libzip-0.11.2 <- libzip sources from their latest distribution tar ball -# /subsurface <- current subsurface git -# /subsurface/libdivecomputer <- appropriate libdc branch -# /subsurface/marble-source <- appropriate marble branch -# /subsurface/libgit2 <- appropriate libgit2 branch +# ~/src/win/mxe <- current MXE git with Qt5, automake (see above) +# /win/libzip <- libzip sources from their latest distribution tar ball +# /win/grantlee <- Grantlee 5.0.0 sources from git +# /win/libssh2 <- from git - v1.6 seems to work +# /win/libcurl <- from git - 7.42.1 seems to work +# /win/subsurface <- current subsurface git +# /win/libdivecomputer <- appropriate libdc/Subsurface-branch branch +# /win/marble-source <- appropriate marble/Subsurface-branch branch +# /win/libgit2 <- libgit2 0.23.1 or similar # # ~/src/win/win32 <- build directory -# /libxml2 -# /libxslt -# /libzip -# /libgit2 -# /marble -# /subsurface -# /install-root <- target for our temporary installs # # then start this script from ~/src/win/win32 # @@ -33,118 +55,241 @@ # bash ../../subsurface/packaging/windows/mxe-based-build.sh installer # # this should create the latest daily installer +# +# 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 +# +# cd ~/src/win/win32 +# touch build.<component> +# bash ../../subsurface/packaging/windows/mxe-based-build.sh installer +# +# 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! +# -if [[ ! -d libgit2 || ! -d marble || ! -d subsurface ]] ; then - echo "Please start this from the right directory" - exit 1 -fi +exec 1> >(tee ./winbuild.log) 2>&1 +# 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 +JOBS="-j12" BASEDIR=$(cd "`dirname $0`/.."; pwd) -INSTALL_ROOT=$(pwd)/install-root +BUILDDIR=$(cd "`dirname $0`"; pwd) -echo "Building in $BASEDIR ..." +if [[ ! -d $BASEDIR/mxe ]] ; then + 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 ..." export PATH=$BASEDIR/mxe/usr/bin:$PATH:$BASEDIR/mxe/usr/i686-w64-mingw32.shared/qt5/bin/ -#################### -if false; then -#################### -# libxml2 +# grantlee + +cd $BUILDDIR +if [[ ! -d grantlee || -f build.grantlee ]] ; then + rm -f build.grantlee + mkdir -p grantlee + cd grantlee + cmake -DCMAKE_TOOLCHAIN_FILE=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_TESTS=OFF \ + $BASEDIR/grantlee -cd libxml2 || exit 1 -../../libxml2/configure --host=i686-w64-mingw32.shared \ - --without-python \ - --prefix=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/ -make -j12 -make install -cd .. + make $JOBS + make install +fi -# libxslt -cd libxslt || exit 1 -../../libxslt/autogen.sh --host=i686-w64-mingw32.shared \ - --without-python \ - --prefix=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/ -make -j12 -make install -cd .. +# libssh2: + +cd $BUILDDIR +if [[ ! -d libssh2 || -f build.libssh2 ]] ; then + rm -f build.libssh2 + mkdir -p libssh2 + cd libssh2 + + cmake -DCMAKE_TOOLCHAIN_FILE=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF \ + -DBUILD_SHARED_LIBS=ON \ + $BASEDIR/libssh2 + make $JOBS + make install + # 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 +fi + + +# libcurl + +cd $BUILDDIR +if [[ ! -d libcurl || -f build.libcurl ]] ; then + rm -f build.libcurl + mkdir -p libcurl + cd libcurl + ../../libcurl/configure --host=i686-w64-mingw32.shared \ + --prefix=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/ \ + --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 \ + --with-libssh2=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/ + + # now remove building the executable + sed -i 's/SUBDIRS = lib src include/SUBDIRS = lib include/' Makefile + + make $JOBS + make install +fi + # libzip -cd libzip || exit 1 -../../libzip-0.11.2/configure --host=i686-w64-mingw32.shared \ - --enable-static \ - --prefix=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/ -make -j12 -make install -cd .. +cd $BUILDDIR +if [[ ! -d libzip || -f build.libzip ]] ; then + rm -f build.libzip + mkdir -p libzip + cd libzip +# cmake -DCMAKE_TOOLCHAIN_FILE=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \ +# -DCMAKE_BUILD_TYPE=Release \ +# $BASEDIR/libzip + $BASEDIR/libzip/configure --host=i686-w64-mingw32.shared --prefix=$BASEDIR/mxe/usr/i686-w64-mingw32.shared + make $JOBS + make install +fi + # libgit2: -cd libgit2 || exit 1 -cmake -DCMAKE_TOOLCHAIN_FILE=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \ - -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT \ - -DBUILD_CLAR=OFF \ - $BASEDIR/../subsurface/libgit2 -make -j12 -make install -cd .. - -# libdivecomputer (can't figure out how to do out-of tree builds?) - -cd libdivecomputer || exit 1 -git pull -autoreconf --install -./configure --host=i686-w64-mingw32.shared --enable-static --disable-shared --prefix=$INSTALL_ROOT -make -j12 -make install -cd .. +cd $BUILDDIR +if [[ ! -d libgit2 || -f build.libgit2 ]] ; then + rm -f build.libgit2 + mkdir -p libgit2 + cd libgit2 + cmake -DCMAKE_TOOLCHAIN_FILE=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake \ + -DBUILD_CLAR=OFF -DTHREADSAFE=ON \ + -DDLLTOOL=$BASEDIR/mxe/usr/bin/i686-w64-mingw32.shared-dlltool \ + $BASEDIR/libgit2 + 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 +# the original source directory... so the $BASEDIR/libdivecomputer is +# a local clone of the "real" libdivecomputer directory -# marble: +cd $BUILDDIR +if [[ ! -d libdivecomputer || -f build.libdivecomputer ]] ; then + rm build.libdivecomputer + cd $BASEDIR/libdivecomputer + git pull + cd $BUILDDIR + mkdir -p libdivecomputer + cd libdivecomputer -cd marble -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_INSTALL_PREFIX=$INSTALL_ROOT \ - -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 $BASEDIR/../subsurface/marble-source -make -j12 -make install + $BASEDIR/libdivecomputer/configure --host=i686-w64-mingw32.shared \ + --enable-static --disable-shared \ + --prefix=$BASEDIR/mxe/usr/i686-w64-mingw32.shared + make $JOBS + make install +else + echo "" + echo "" + echo "WARNING!!!!" + echo "" + echo "libdivecoputer not rebuilt!!" + echo "" + echo "" +fi +# marble: -############### +cd $BUILDDIR +if [[ ! -d marble || -f build.marble ]] ; then + rm build.marble + mkdir -p marble + cd marble + 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 \ + -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 \ + $BASEDIR/marble-source + make $JOBS + make install + # what the heck is marble doing? + mv $BASEDIR/mxe/usr/i686-w64-mingw32.shared/libssrfmarblewidget.dll $BASEDIR/mxe/usr/i686-w64-mingw32.shared/lib fi + ############### +# finally, Subsurface + +cd $BUILDDIR +mkdir -p 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/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 . + +cd $BUILDDIR/subsurface -# subsurface: +if [[ "$1" == "qmake" ]] ; then + shift + export objdump=$BASEDIR/mxe/usr/bin/i686-w64-mingw32.shared-objdump -cd subsurface || exit 1 + i686-w64-mingw32.shared-qmake-qt5 \ + LIBMARBLEDEVEL=../marble \ + LIBGIT2DEVEL=../libgit2 CONFIG+=libgit21-api \ + CROSS_PATH=$BASEDIR/mxe/usr/i686-w64-mingw32.shared \ + QMAKE_LRELEASE=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/qt5/bin/lrelease \ + SPECIAL_MARBLE_PREFIX=1 \ + MAKENSIS=i686-w64-mingw32.shared-makensis \ + $BASEDIR/../subsurface/subsurface.pro -if [ ! -d staging ] ; then - mkdir -p staging/plugins - cd 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/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 . - cd ../.. +# LIBDCDEVEL=../libdivecomputer \ + +else + 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 \ + -DUSE_LIBGIT23_API=1 \ + -DLIBDIVECOMPUTER_INCLUDE_DIR=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/include \ + -DLIBDIVECOMPUTER_LIBRARIES=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/lib/libdivecomputer.a \ + -DMARBLE_INCLUDE_DIR=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/include \ + -DMARBLE_LIBRARIES=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/lib/libssrfmarblewidget.dll \ + $BASEDIR/subsurface + #sed -i 's@-lssh2@/home/hohndel/src/win/win32/libgit2/libssh2.dll@g' CMakeFiles/subsurface.dir/link.txt fi -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 \ - -DLIBGIT2_INCLUDE_DIR=$(INSTALL_ROOT)/include \ - -DLIBGIT2_LIBRARIES=$(INSTALL_ROOT)/lib/libgit2.a \ - -DLIBDIVECOMPUTER_INCLUDE_DIR=$(INSTALL_ROOT)/include \ - -DLIBDIVECOMPUTER_LIBRARIES=$(INSTALL_ROOT)/lib/libdivecomputer.a \ - -DMARBLE_INCLUDE_DIR=$(INSTALL_ROOT)/include \ - -DMARBLE_LIBRARIES=$(INSTALL_ROOT)/lib/libssrfmarblewidget.dll \ - -DQT_TRANSLATION_DIR=$BASEDIR/mxe/usr/i686-w64-mingw32.shared/qt5/translations \ - -DMAKENSIS=i686-w64-mingw32.shared-makensis \ - $BASEDIR/../subsurface - -make -j12 VERBOSE=1 $@ + +make $JOBS $@ |