summaryrefslogtreecommitdiffstats
path: root/packaging/windows/mxe-based-build.sh
blob: 0eb634a986d86f970a5ae0cef7370f7eb8e53471 (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
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/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
#
# 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)

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 \
	-DBUILD_CLAR=OFF \
	$BASEDIR/../subsurface/libgit2
make -j12

# fake install
if [ ! -h include ] ; then
	ln -s $BASEDIR/../subsurface/libgit2/include .
fi
if [ ! -h build ] ; then
	ln -s . build
fi
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
make -j12
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 \
 	-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

# fake install
if [ ! -d include ] ; then
	mkdir include
	cd include
        for i in $(find $BASEDIR/../subsurface/marble-source -name \*.h); do ln -s $i .; done
	ln -s . marble
	cd ..
fi
if [ ! -d lib ] ; then
	mkdir lib
fi
cp src/lib/marble/libssrfmarblewidget.dll lib
cd ..

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

export objdump=$BASEDIR/mxe/usr/bin/i686-w64-mingw32.shared-objdump

i686-w64-mingw32.shared-qmake-qt5 \
	LIBMARBLEDEVEL=../marble \
	LIBGIT2DEVEL=../libgit2 CONFIG+=libgit21-api \
	LIBDCDEVEL=../libdivecomputer \
	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


make -j12 $@