summaryrefslogtreecommitdiffstats
path: root/packaging/windows/mxe-based-build.sh
blob: 9e6542f69390fc0e0595c209e296f10ffc65b1b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/bin/bash

# build Subsurface for Win32
#
# 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
# 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/win32                  <- build directory
#                /libxml2
#                /libxslt
#                /libzip
#                /libgit2
#                /marble
#                /subsurface
#                /install-root     <- target for our temporary installs
#
# then start this script from ~/src/win/win32
#
#  cd ~/src/win/win32
#  bash ../../subsurface/packaging/windows/mxe-based-build.sh installer
#
# this should create the latest daily installer

if [[ ! -d libgit2 || ! -d marble || ! -d subsurface ]] ; then
	echo "Please start this from the right directory"
	exit 1
fi

BASEDIR=$(cd "`dirname $0`/.."; pwd)
INSTALL_ROOT=$(pwd)/install-root

echo "Building in $BASEDIR ..."

export PATH=$BASEDIR/mxe/usr/bin:$PATH:$BASEDIR/mxe/usr/i686-w64-mingw32.shared/qt5/bin/

####################
if false; then
####################

# libxml2

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 ..

# 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 ..

# 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 ..

# 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 ..

# 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 \
	-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


###############
fi
###############

# subsurface:

cd subsurface || exit 1

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 ../..
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 $@