]> git.lyx.org Git - lyx.git/blob - development/cmake/scripts/xmingw
add script to cross-compile for Windows
[lyx.git] / development / cmake / scripts / xmingw
1
2 #!/bin/sh
3 #
4 # Installed MinGW needed.
5 # Ubuntu : sudo apt-get install gcc-mingw-w64-i686
6
7
8
9 if [ -z $1 ]
10 then
11     echo "Usage: xmingw <path to LyX sources>"
12     exit 1
13 fi
14
15
16 lyxsrcdir=$1
17 builddir=$PWD
18
19 date=`date --utc '+%Y.%m.%d-%H.%M'`
20 versionname=LyX$ver-$date
21
22
23 echo ---------------------------------------------------------
24 echo ---------- Building $versionname
25 echo ---------------------------------------------------------
26
27 # ---------------------------------------------------------
28 #
29 # helper function to check return code
30 #
31 checkExitCode() {
32     exitcode=$?
33     if [ $exitcode -ne 0 ]; then
34         echo Command failed
35         exit 1
36     fi
37 }
38
39 dep=$lyxsrcdir/../lyx-dependencies
40 mkdir -p $dep
41
42
43 server=http://sourceforge.net/projects/kst/files/3rdparty
44
45 if [ "$2" = "x64" ]; then
46     mingw=x86_64-w64-mingw32
47     win=win64
48     branch=LyX$ver-master-win64
49 else
50     win=win32
51     mingw=i686-w64-mingw32
52     branch=LyX$ver-master-win32
53 fi
54
55 qtver=5.5.1
56 qtver=Qt-$qtver-$mingw
57 compiler=$mingw
58 LTS=14.04
59
60 echo Checking mingw installation ...
61 $compiler-gcc -dumpversion
62 checkExitCode
63
64
65 # ---------------------------------------------------------
66 #
67 # download and unpack Qt
68 #
69 if [ ! -d $dep/$qtver ]; then
70     qttar=$qtver-Ubuntu64-$LTS$tarver.tar
71     wget $server/$qttar.xz
72     checkExitCode
73     xz -d $qttar.xz
74     cd $dep
75     tar xf $builddir/$qttar
76     checkExitCode
77     echo -e "[Paths]\nPrefix = $dep/$qtver" > $dep/$qtver/bin/qt.conf
78     cd $builddir
79 fi
80 export PATH=$dep/$qtver/bin:$PATH
81 echo Checking Qt installation ...
82 which qmake
83 checkExitCode
84
85
86
87 # ---------------------------------------------------------
88 #
89 # build LyX
90 #
91
92 #mergefile=-DLYX_MERGE_FILE
93 #pch=-DLYX_PCH=1
94
95 $cmakebin $lyxsrcdir \
96     -DLYX_CPACK=1 \
97     -DLYX_PROGRAM_SUFFIX="" \
98     -DLYX_CONSOLE=FORCE \
99     -DLYX_XMINGW=$compiler \
100     -DLYX_USE_QT=QT5 \
101     -DLYX_QUIET=1 \
102     -DLYX_ENABLE_CXX11=1 \
103     -DLYX_HUNSPELL=1 \
104     -DLYX_3RDPARTY_BUILD=1 \
105     $pch $mergefile
106
107 checkExitCode
108
109
110 #processors=2
111 make -j $processors
112 checkExitCode
113
114
115
116
117 # ---------------------------------------------------------
118 #
119 # deploy
120 #
121 make package
122 checkExitCode
123