]>
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 | ||
91d4c754 UH |
35 | # We need to find tools in the toolchain and in the install directory. |
36 | export PATH=$PREFIX/bin:$MXE/usr/bin:$PATH | |
37 | ||
38 | P="$PREFIX/lib/pkgconfig" | |
39 | P2="$MXE/usr/i686-pc-mingw32/lib/pkgconfig" | |
40 | C="--host=i686-pc-mingw32 --prefix=$PREFIX" | |
41 | CM="-DCMAKE_TOOLCHAIN_FILE=$MXE/usr/i686-pc-mingw32/share/cmake/mxe-conf.cmake" | |
42 | L="--disable-shared --enable-static" | |
43 | ||
44 | # Remove build directory contents (if any) and create a new build dir. | |
45 | rm -rf $BUILDDIR | |
46 | mkdir $BUILDDIR | |
47 | cd $BUILDDIR | |
48 | ||
49 | # ----------------------------------------------------------------------------- | |
50 | ||
91d4c754 UH |
51 | # Python3 |
52 | # Cross-compiling Python is highly non-trivial, so we avoid it for now. | |
53 | # The download below is a repackaged tarball of the official Python 3.2.3 MSI | |
54 | # installer for Windows: http://python.org/ftp/python/3.2.3/python-3.2.3.msi | |
55 | # The MSI file has been installed on a Windows box and then the c:\Python32 | |
56 | # files have been stored in the Python32.tar.gz tarball. | |
57 | mkdir -p $PREFIX | |
58 | wget http://www.sigrok.org/tmp/Python32.tar.gz -O $PREFIX/Python32.tar.gz | |
59 | tar xzf $PREFIX/Python32.tar.gz -C $PREFIX | |
60 | ||
61 | # Create a dummy python3-config that points to Python32 above. | |
62 | mkdir -p $PREFIX/bin | |
63 | cat >$PREFIX/bin/python3-config <<EOF | |
64 | #!/usr/bin/python3 | |
65 | import sys | |
66 | import getopt | |
67 | valid_opts = ['includes', 'cflags', 'libs', 'ldflags'] | |
68 | opts, args = getopt.getopt(sys.argv[1:], '', valid_opts) | |
69 | opt_flags = [flag for (flag, val) in opts] | |
70 | for opt in opt_flags: | |
71 | if opt in ('--includes', '--cflags'): | |
72 | print('-I$PREFIX/Python32/include') | |
73 | elif opt in ('--libs', '--ldflags'): | |
74 | print('-L$PREFIX/Python32/libs -lpython32') | |
75 | EOF | |
76 | chmod 755 $PREFIX/bin/python3-config | |
77 | ||
78 | # libsigrok | |
79 | git clone git://sigrok.org/libsigrok | |
80 | cd libsigrok | |
81 | ./autogen.sh | |
eb5279c7 | 82 | PKG_CONFIG_PATH_i686_pc_mingw32=$P ./configure $C $L && make install |
91d4c754 UH |
83 | cd .. |
84 | ||
85 | # libsigrokdecode | |
86 | git clone git://sigrok.org/libsigrokdecode | |
87 | cd libsigrokdecode | |
88 | ./autogen.sh | |
89 | PYTHON3_CONFIG=$PREFIX/bin/python3-config PKG_CONFIG_PATH_i686_pc_mingw32=$P ./configure $C $L && make install | |
90 | cd .. | |
91 | ||
92 | # sigrok-cli | |
93 | git clone git://sigrok.org/sigrok-cli | |
94 | cd sigrok-cli | |
95 | ./autogen.sh | |
96 | PKG_CONFIG_PATH_i686_pc_mingw32=$P:$P2 ./configure $C && make install | |
97 | cd .. | |
98 | ||
99 | ## TODO: Doesn't fully work, yet. | |
100 | ## # sigrok-qt | |
101 | ## git clone git://sigrok.org/sigrok-qt | |
102 | ## cd sigrok-qt | |
103 | ## PKG_CONFIG_PATH_i686_pc_mingw32=$P:$P2 qmake -spec win32-g++ | |
104 | ## make | |
105 | ## # TODO: make install | |
106 | ## cd .. | |
107 | ||
cf28c06c UH |
108 | # # sigrok-gtk |
109 | # git clone git://sigrok.org/sigrok-gtk | |
110 | # cd sigrok-gtk | |
111 | # ./autogen.sh | |
112 | # PKG_CONFIG_PATH_i686_pc_mingw32=$P:$P2 ./configure $C && make install | |
113 | # cd .. | |
91d4c754 UH |
114 | |
115 | # PulseView | |
116 | git clone git://sigrok.org/pulseview | |
117 | cd pulseview | |
99344584 UH |
118 | # Temporary workaround: append (not prepend) "-llzma -llcms2" to the linker. |
119 | sed -i '224a \\tlist(APPEND PULSEVIEW_LINK_LIBS "-llzma -llcms2") # Quick hack' CMakeLists.txt | |
cf28c06c | 120 | PKG_CONFIG_PATH_i686_pc_mingw32=$P:$P2 cmake $CM -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX -DDISABLE_WERROR=y . && make install VERBOSE=1 |
91d4c754 UH |
121 | cd .. |
122 |