-#!/bin/bash
+#!/bin/sh
##
## This file is part of the sigrok-util project.
##
# The path where the libsigrok Python bindings will be installed.
PYPATH=$PREFIX/lib/python2.7/site-packages
+# JDK include path. Usually found automatically, except on FreeBSD.
+if [ `uname` = "FreeBSD" ]; then
+ JDK="--with-jni-include-path=/usr/local/openjdk7/include"
+fi
+
+# Edit this to control verbose build output.
+# V="V=1 VERBOSE=1"
+
# Edit this to enable/disable/modify parallel compiles.
PARALLEL="-j 2"
mkdir build
cd build
../configure $C
-$SB make $PARALLEL
-make install
+$SB make $PARALLEL $V
+make install $V
cd ../..
# libsigrok
./autogen.sh
mkdir build
cd build
-PKG_CONFIG_PATH=$P ../configure $C
-$SB make $PARALLEL
-PYTHONPATH=$PYPATH $SB make install
-$SB make check
+PKG_CONFIG_PATH=$P ../configure $C $JDK
+$SB make $PARALLEL $V
+PYTHONPATH=$PYPATH $SB make install $V
+$SB make check $V
cd ../..
# libsigrokdecode
mkdir build
cd build
PKG_CONFIG_PATH=$P ../configure $C
-$SB make $PARALLEL
-make install
-$SB make check
+$SB make $PARALLEL $V
+make install $V
+$SB make check $V
cd ../..
# sigrok-firmware
cd build
# Nothing gets cross-compiled here, we just need 'make install' basically.
../configure $C
-make install
+make install $V
cd ../..
# sigrok-firmware-fx2lafw
cd build
# We're building the fx2lafw firmware on the host, no need to cross-compile.
../configure $C
-make $PARALLEL
-make install
+make $PARALLEL $V
+make install $V
cd ../..
# sigrok-cli
./autogen.sh
mkdir build
cd build
-PKG_CONFIG_PATH=$P ../configure $C
-$SB make $PARALLEL
-make install
+if [ `uname` = "FreeBSD" ]; then
+ # Temporary fix for: http://sigrok.org/bugzilla/show_bug.cgi?id=552
+ PKG_CONFIG_PATH=$P ../configure $C LDFLAGS=-lusb
+else
+ PKG_CONFIG_PATH=$P ../configure $C
+fi
+$SB make $PARALLEL $V
+make install $V
cd ../..
# PulseView
mkdir build
cd build
PKG_CONFIG_PATH=$P $SB cmake -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX -DDISABLE_WERROR=y -DENABLE_TESTS=y ..
-$SB make $PARALLEL
-make install
-$SB make test
+$SB make $PARALLEL $V
+make install $V
+$SB make test $V
cd ../..
-