]>
Commit | Line | Data |
---|---|---|
91d4c754 UH |
1 | #!/bin/bash |
2 | ## | |
3 | ## This file is part of the sigrok-util project. | |
4 | ## | |
5 | ## Copyright (C) 2013 Uwe Hermann <uwe@hermann-uwe.de> | |
6 | ## | |
7 | ## This program is free software; you can redistribute it and/or modify | |
8 | ## it under the terms of the GNU General Public License as published by | |
9 | ## the Free Software Foundation; either version 2 of the License, or | |
10 | ## (at your option) any later version. | |
11 | ## | |
12 | ## This program is distributed in the hope that it will be useful, | |
13 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | ## GNU General Public License for more details. | |
16 | ## | |
17 | ## You should have received a copy of the GNU General Public License | |
18 | ## along with this program; if not, write to the Free Software | |
19 | ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | ## | |
21 | ||
22 | # The path where your MXE directory is located. | |
23 | MXE=$HOME/mxe-git | |
24 | ||
25 | # The path where the cross-compiled packages will be installed. | |
26 | PREFIX=$HOME/sr_mingw | |
27 | ||
28 | # The path where to download files to and where to build packages. | |
29 | BUILDDIR=./sr_mingw_build | |
30 | ||
31 | # You usually don't need to change anything below this line. | |
32 | ||
33 | # ----------------------------------------------------------------------------- | |
34 | ||
6cc41785 ML |
35 | SF_MIRROR=switch.dl.sourceforge.net |
36 | ||
37 | VER_LIBUSBX=1.0.17 | |
38 | ||
39 | # ----------------------------------------------------------------------------- | |
40 | ||
91d4c754 UH |
41 | # We need to find tools in the toolchain and in the install directory. |
42 | export PATH=$PREFIX/bin:$MXE/usr/bin:$PATH | |
43 | ||
44 | P="$PREFIX/lib/pkgconfig" | |
45 | P2="$MXE/usr/i686-pc-mingw32/lib/pkgconfig" | |
46 | C="--host=i686-pc-mingw32 --prefix=$PREFIX" | |
47 | CM="-DCMAKE_TOOLCHAIN_FILE=$MXE/usr/i686-pc-mingw32/share/cmake/mxe-conf.cmake" | |
48 | L="--disable-shared --enable-static" | |
49 | ||
50 | # Remove build directory contents (if any) and create a new build dir. | |
51 | rm -rf $BUILDDIR | |
52 | mkdir $BUILDDIR | |
53 | cd $BUILDDIR | |
54 | ||
55 | # ----------------------------------------------------------------------------- | |
56 | ||
91d4c754 UH |
57 | # Python3 |
58 | # Cross-compiling Python is highly non-trivial, so we avoid it for now. | |
59 | # The download below is a repackaged tarball of the official Python 3.2.3 MSI | |
60 | # installer for Windows: http://python.org/ftp/python/3.2.3/python-3.2.3.msi | |
61 | # The MSI file has been installed on a Windows box and then the c:\Python32 | |
62 | # files have been stored in the Python32.tar.gz tarball. | |
63 | mkdir -p $PREFIX | |
64 | wget http://www.sigrok.org/tmp/Python32.tar.gz -O $PREFIX/Python32.tar.gz | |
65 | tar xzf $PREFIX/Python32.tar.gz -C $PREFIX | |
66 | ||
67 | # Create a dummy python3-config that points to Python32 above. | |
68 | mkdir -p $PREFIX/bin | |
69 | cat >$PREFIX/bin/python3-config <<EOF | |
70 | #!/usr/bin/python3 | |
71 | import sys | |
72 | import getopt | |
73 | valid_opts = ['includes', 'cflags', 'libs', 'ldflags'] | |
74 | opts, args = getopt.getopt(sys.argv[1:], '', valid_opts) | |
75 | opt_flags = [flag for (flag, val) in opts] | |
76 | for opt in opt_flags: | |
77 | if opt in ('--includes', '--cflags'): | |
78 | print('-I$PREFIX/Python32/include') | |
79 | elif opt in ('--libs', '--ldflags'): | |
80 | print('-L$PREFIX/Python32/libs -lpython32') | |
81 | EOF | |
82 | chmod 755 $PREFIX/bin/python3-config | |
83 | ||
6ba97136 UH |
84 | # Download the Python 3.2.3 MSI installer (needed for NSIS runs). |
85 | wget -c http://python.org/ftp/python/3.2.3/python-3.2.3.msi \ | |
86 | -O $PREFIX/python-3.2.3.msi | |
87 | ||
6cc41785 ML |
88 | # libusbx |
89 | wget http://$SF_MIRROR/project/libusbx/releases/$VER_LIBUSBX/source/libusbx-$VER_LIBUSBX.tar.bz2 | |
90 | tar xfj libusbx-$VER_LIBUSBX.tar.bz2 | |
91 | cd libusbx-$VER_LIBUSBX | |
92 | PKG_CONFIG_PATH_i686_pc_mingw32=$P ./configure $C $L && make install | |
93 | cd .. | |
94 | ||
43ffde97 UH |
95 | # libserialport |
96 | git clone git://sigrok.org/libserialport | |
97 | cd libserialport | |
98 | ./autogen.sh | |
99 | PKG_CONFIG_PATH_i686_pc_mingw32=$P ./configure $C $L && make install | |
100 | cd .. | |
101 | ||
91d4c754 UH |
102 | # libsigrok |
103 | git clone git://sigrok.org/libsigrok | |
104 | cd libsigrok | |
105 | ./autogen.sh | |
eb5279c7 | 106 | PKG_CONFIG_PATH_i686_pc_mingw32=$P ./configure $C $L && make install |
91d4c754 UH |
107 | cd .. |
108 | ||
109 | # libsigrokdecode | |
110 | git clone git://sigrok.org/libsigrokdecode | |
111 | cd libsigrokdecode | |
112 | ./autogen.sh | |
113 | PYTHON3_CONFIG=$PREFIX/bin/python3-config PKG_CONFIG_PATH_i686_pc_mingw32=$P ./configure $C $L && make install | |
114 | cd .. | |
115 | ||
116 | # sigrok-cli | |
117 | git clone git://sigrok.org/sigrok-cli | |
118 | cd sigrok-cli | |
119 | ./autogen.sh | |
120 | PKG_CONFIG_PATH_i686_pc_mingw32=$P:$P2 ./configure $C && make install | |
57d08419 | 121 | makensis -DHOME=$HOME contrib/sigrok-cli_cross.nsi |
91d4c754 UH |
122 | cd .. |
123 | ||
91d4c754 UH |
124 | # PulseView |
125 | git clone git://sigrok.org/pulseview | |
126 | cd pulseview | |
cb1a1fd5 | 127 | patch -p1 < ../../pulseview.patch |
cf28c06c | 128 | PKG_CONFIG_PATH_i686_pc_mingw32=$P:$P2 cmake $CM -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX -DDISABLE_WERROR=y . && make install VERBOSE=1 |
57d08419 | 129 | makensis -DHOME=$HOME contrib/pulseview_cross.nsi |
91d4c754 UH |
130 | cd .. |
131 |