]> sigrok.org Git - sigrok-util.git/blob - cross-compile/macosx/sigrok-native-macosx
357c0798526dbbc15216a2b34c4ab92b58ee0876
[sigrok-util.git] / cross-compile / macosx / sigrok-native-macosx
1 #!/bin/sh
2 ##
3 ## This file is part of the sigrok-util project.
4 ##
5 ## Copyright (C) 2015 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, see <http://www.gnu.org/licenses/>.
19 ##
20
21 set -e
22
23 # The path where the compiled packages will be installed.
24 PREFIX=$HOME/sr_macosx
25
26 # The path where to download files to and where to build packages.
27 BUILDDIR=./build
28
29 # The path where the libsigrok Python bindings will be installed.
30 PYPATH=$PREFIX/lib/python2.7/site-packages
31
32 # Edit this to control verbose build output.
33 # V="V=1 VERBOSE=1"
34
35 # Edit this to enable/disable/modify parallel compiles.
36 PARALLEL="-j "`sysctl -n hw.ncpu`
37
38 # Uncomment the following lines to build with clang and run scan-build.
39 # export CC=llvm-gcc
40 # export CXX=llvm-g++
41 # SB="scan-build -k -v"
42
43 # Uncomment the following lines to build with gcc/g++.
44 export CC=gcc
45 export CXX=g++
46
47 # Path to Qt5 binaries (needed for cmake to find the Qt5 libs).
48 export PATH=`brew list qt5 | grep bin | head -n 1 | xargs dirname`":$PATH"
49
50 # Path to Python 2/3 pkg-config files.
51 # In Homebrew, pkg-config files of "keg-only" formulas (Python is one of them)
52 # aren't installed into /usr/local/lib/pkgconfig (we manually reference them).
53 PY2=`brew list python | grep pkgconfig | head -n 1 | xargs dirname`
54 PY3=`brew list python3 | grep pkgconfig | head -n 1 | xargs dirname`
55
56 # You usually don't need to change anything below this line.
57
58 # -----------------------------------------------------------------------------
59
60 P="$PREFIX/lib/pkgconfig:$PY2:$PY3"
61 C="$C --prefix=$PREFIX"
62
63 # Remove build directory contents (if any) and create a new build dir.
64 rm -rf $BUILDDIR
65 mkdir $BUILDDIR
66 cd $BUILDDIR
67
68 GIT_CLONE="git clone --depth=1"
69
70 # -----------------------------------------------------------------------------
71
72 # libserialport
73 $GIT_CLONE git://sigrok.org/libserialport
74 cd libserialport
75 ./autogen.sh
76 mkdir build
77 cd build
78 ../configure $C
79 $SB make $PARALLEL $V
80 make install $V
81 cd ../..
82
83 # libsigrok
84 mkdir -p $PYPATH
85 $GIT_CLONE git://sigrok.org/libsigrok
86 cd libsigrok
87 ./autogen.sh
88 mkdir build
89 cd build
90 PKG_CONFIG_PATH=$P ../configure $C
91 $SB make $PARALLEL $V
92 PYTHONPATH=$PYPATH $SB make install $V
93 $SB make check $V
94 cd ../..
95
96 # libsigrokdecode
97 $GIT_CLONE git://sigrok.org/libsigrokdecode
98 cd libsigrokdecode
99 ./autogen.sh
100 mkdir build
101 cd build
102 PKG_CONFIG_PATH=$P ../configure $C
103 $SB make $PARALLEL $V
104 make install $V
105 $SB make check $V
106 cd ../..
107
108 # sigrok-firmware
109 $GIT_CLONE git://sigrok.org/sigrok-firmware
110 cd sigrok-firmware
111 ./autogen.sh
112 mkdir build
113 cd build
114 # Nothing gets cross-compiled here, we just need 'make install' basically.
115 ../configure $C
116 make install $V
117 cd ../..
118
119 # sigrok-firmware-fx2lafw
120 $GIT_CLONE git://sigrok.org/sigrok-firmware-fx2lafw
121 cd sigrok-firmware-fx2lafw
122 ./autogen.sh
123 mkdir build
124 cd build
125 # We're building the fx2lafw firmware on the host, no need to cross-compile.
126 ../configure $C
127 make $PARALLEL $V
128 make install $V
129 cd ../..
130
131 # sigrok-cli
132 $GIT_CLONE git://sigrok.org/sigrok-cli
133 cd sigrok-cli
134 ./autogen.sh
135 mkdir build
136 cd build
137 PKG_CONFIG_PATH=$P ../configure $C
138 $SB make $PARALLEL $V
139 make install $V
140 cd ../..
141
142 # PulseView
143 $GIT_CLONE git://sigrok.org/pulseview
144 cd pulseview
145 mkdir build
146 cd build
147 PKG_CONFIG_PATH=$P $SB cmake -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX -DDISABLE_WERROR=y -DENABLE_TESTS=y ..
148 $SB make $PARALLEL $V
149 make install $V
150 $SB make test $V
151 cd ../..
152