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