]> sigrok.org Git - sigrok-util.git/blame - cross-compile/msys2/sigrok-native-msys2
mxe/msys2: Use -DCMAKE_BUILD_TYPE in favor of a patch.
[sigrok-util.git] / cross-compile / msys2 / sigrok-native-msys2
CommitLineData
18b280b7
UH
1#!/bin/sh
2##
3## This file is part of the sigrok-util project.
4##
5## Copyright (C) 2016 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
b65a0b06 18## along with this program; if not, see <http://www.gnu.org/licenses/>.
18b280b7
UH
19##
20
21set -e
22
23# Build target: "i686" (32bit) or "x86_64" (64bit).
24TARGET="i686"
25
26# The path where the compiled packages will be installed.
27PREFIX=$HOME/sr_msys2
28
29# The path where to download files to and where to build packages.
30BUILDDIR=./build
31
32# The path where the libsigrok Python bindings will be installed.
33PYPATH=$PREFIX/lib/python2.7/site-packages
34
35# Edit this to control verbose build output.
36# V="V=1 VERBOSE=1"
37
38# Edit this to enable/disable/modify parallel compiles.
39PARALLEL="-j 2"
40
41# You usually don't need to change anything below this line.
42
43# -----------------------------------------------------------------------------
44
45VER_SIGROK_FIRMWARE_FX2LAFW=0.1.3
46
47# -----------------------------------------------------------------------------
48
682d505b
C
49if [ $DEBUG = 1 ]; then
50 BUILD_TYPE="Debug"
51else
52 BUILD_TYPE="Release"
53fi
54
18b280b7
UH
55P="$PREFIX/lib/pkgconfig"
56C="$C --prefix=$PREFIX"
57L="--disable-shared --enable-static"
58
59# Path to Qt binaries (needed for cmake to find the Qt libs).
60PATH="/mingw32/qt5-static/bin:$PATH"
61
62W="mingw-w64-$TARGET"
63
64WGET="wget -c --quiet"
65GIT_CLONE="git clone --depth=1"
66
9bcef9f4
UH
67REPO_BASE="git://sigrok.org"
68
18b280b7
UH
69# Remove build directory contents (if any) and create a new build dir.
70rm -rf $BUILDDIR
71mkdir $BUILDDIR
72cd $BUILDDIR
73
74# -----------------------------------------------------------------------------
75
76if [ "x$1" = "xprepare" ]; then
77 # Update package list, install/update all requirements.
78 pacman -Sy
79 pacman -S \
fc936858
UH
80 autoconf automake autoconf-archive libtool make pkg-config wget patch \
81 $W-toolchain $W-glib2 $W-glibmm $W-libusb $W-libfdi $W-check $W-boost \
18b280b7 82 $W-libzip $W-doxygen $W-python3 $W-python3-numpy $W-python3-gobject \
fc936858 83 $W-python3-setuptools $W-swig $W-qt5-static $W-cmake $W-nsis
18b280b7
UH
84 exit
85fi
86
87# -----------------------------------------------------------------------------
88
89# libusb
90$GIT_CLONE git://github.com/dickens/libusb -b event-abstraction-v4
91cd libusb
92./bootstrap.sh
93./configure $C $L
94make -j1 $V
95make install $V
96cd ..
97
98# libserialport
9bcef9f4 99$GIT_CLONE $REPO_BASE/libserialport
18b280b7
UH
100cd libserialport
101./autogen.sh
102mkdir build
103cd build
104../configure $C $L
105$SB make $PARALLEL $V
106make install $V
107cd ../..
108
109# libsigrok
110mkdir -p $PYPATH
9bcef9f4 111$GIT_CLONE $REPO_BASE/libsigrok
18b280b7
UH
112cd libsigrok
113./autogen.sh
114mkdir build
115cd build
a4846659 116PKG_CONFIG_PATH=$P PYTHON=python3 ../configure $C $L --disable-python
18b280b7
UH
117$SB make $PARALLEL $V
118PYTHONPATH=$PYPATH $SB make install $V
119# $SB make check $V # TODO
120cd ../..
121
122# libsigrokdecode
9bcef9f4 123$GIT_CLONE $REPO_BASE/libsigrokdecode
18b280b7
UH
124cd libsigrokdecode
125./autogen.sh
126mkdir build
127cd build
128PKG_CONFIG_PATH=$P ../configure $C $L
129$SB make $PARALLEL $V
130make install $V
131# $SB make check $V # TODO
132cd ../..
133
134# sigrok-firmware
9bcef9f4 135$GIT_CLONE $REPO_BASE/sigrok-firmware
18b280b7
UH
136cd sigrok-firmware
137./autogen.sh
138mkdir build
139cd build
140# Nothing gets cross-compiled here, we just need 'make install' basically.
141../configure $C
142make install $V
143cd ../..
144
145# sigrok-firmware-fx2lafw
146$WGET http://sigrok.org/download/binary/sigrok-firmware-fx2lafw/sigrok-firmware-fx2lafw-bin-$VER_SIGROK_FIRMWARE_FX2LAFW.tar.gz
147tar xfz sigrok-firmware-fx2lafw-bin-$VER_SIGROK_FIRMWARE_FX2LAFW.tar.gz
148cd sigrok-firmware-fx2lafw-bin-$VER_SIGROK_FIRMWARE_FX2LAFW
149cp *.fw $PREFIX/share/sigrok-firmware/
150cd ..
151
152# TODO: Doesn't build, libsigrokdecode linking errors.
153# # sigrok-cli
9bcef9f4 154# $GIT_CLONE $REPO_BASE/sigrok-cli
18b280b7
UH
155# cd sigrok-cli
156# ./autogen.sh
157# mkdir build
158# cd build
159# PKG_CONFIG_PATH=$P ../configure $C $L
160# $SB make $PARALLEL $V
161# make install $V
162# # makensis -DHOME=$HOME contrib/sigrok-cli_cross.nsi # TODO
163# cd ../..
164
165# TODO: Doesn't build, various linking errors.
166# PulseView
9bcef9f4 167$GIT_CLONE $REPO_BASE/pulseview
18b280b7
UH
168cd pulseview
169mkdir build
170cd build
682d505b
C
171PKG_CONFIG_PATH=$P $SB cmake \
172 -G "Unix Makefiles" \
173 -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX \
174 -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
175 -DDISABLE_WERROR=y \
176 -DENABLE_TESTS=n
177 ..
18b280b7
UH
178$SB make $PARALLEL $V
179make install $V
180# $SB make test $V # TODO
181# makensis -DHOME=$HOME contrib/pulseview_cross.nsi # TODO
182cd ../..