SF_MIRROR=switch.dl.sourceforge.net
WGET="wget --quiet"
+GIT_CLONE="git clone --depth=1"
# -----------------------------------------------------------------------------
# We need to find tools in the toolchain.
export PATH=$MXE/usr/bin:$PATH
+TOOLCHAIN_TRIPLET="i686-pc-mingw32.static"
+
P="$PREFIX/lib/pkgconfig"
-P2="$MXE/usr/i686-pc-mingw32/lib/pkgconfig"
-C="--host=i686-pc-mingw32 --prefix=$PREFIX"
-CM="-DCMAKE_TOOLCHAIN_FILE=$MXE/usr/i686-pc-mingw32/share/cmake/mxe-conf.cmake"
+P2="$MXE/usr/$TOOLCHAIN_TRIPLET/lib/pkgconfig"
+C="--host=$TOOLCHAIN_TRIPLET --prefix=$PREFIX"
+CM="-DCMAKE_TOOLCHAIN_FILE=$MXE/usr/$TOOLCHAIN_TRIPLET/share/cmake/mxe-conf.cmake"
L="--disable-shared --enable-static"
+DDK="$MXE/usr/$TOOLCHAIN_TRIPLET/include/ddk"
# Remove build directory contents (if any) and create a new build dir.
rm -rf $BUILDDIR
cp -f zadig.exe zadig_xp.exe $PREFIX
# libserialport
-git clone git://sigrok.org/libserialport
+$GIT_CLONE git://sigrok.org/libserialport
cd libserialport
./autogen.sh
-PKG_CONFIG_PATH_i686_pc_mingw32=$P ./configure $C $L
+PKG_CONFIG_PATH_i686_pc_mingw32_static=$P CFLAGS="-I$DDK" ./configure $C $L
make $PARALLEL V=1
make install
cd ..
# libsigrok
-git clone git://sigrok.org/libsigrok
+$GIT_CLONE git://sigrok.org/libsigrok
cd libsigrok
patch -p1 < ../../libsigrok_firmwaredir.patch
./autogen.sh
-PKG_CONFIG_PATH_i686_pc_mingw32=$P ./configure $C $L
+PKG_CONFIG_PATH_i686_pc_mingw32_static=$P ./configure $C $L
make $PARALLEL V=1
make install
cd ..
# libsigrokdecode
-git clone git://sigrok.org/libsigrokdecode
+$GIT_CLONE git://sigrok.org/libsigrokdecode
cd libsigrokdecode
./autogen.sh
patch -p1 < ../../srd_decodersdir.patch
-PKG_CONFIG_PATH_i686_pc_mingw32=$P ./configure $C $L
+PKG_CONFIG_PATH_i686_pc_mingw32_static=$P ./configure $C $L
make $PARALLEL V=1
make install
cd ..
# sigrok-firmware
-git clone git://sigrok.org/sigrok-firmware
+$GIT_CLONE git://sigrok.org/sigrok-firmware
cd sigrok-firmware
./autogen.sh
# Nothing gets cross-compiled here, we just need 'make install' basically.
cd ..
# sigrok-firmware-fx2lafw
-git clone git://sigrok.org/sigrok-firmware-fx2lafw
+$GIT_CLONE git://sigrok.org/sigrok-firmware-fx2lafw
cd sigrok-firmware-fx2lafw
./autogen.sh
# We're building the fx2lafw firmware on the host, no need to cross-compile.
cd ..
# sigrok-dumps
-git clone git://sigrok.org/sigrok-dumps
+$GIT_CLONE git://sigrok.org/sigrok-dumps
cd sigrok-dumps
make install DESTDIR=$PREFIX/share/sigrok-dumps
cd ..
# sigrok-cli
-git clone git://sigrok.org/sigrok-cli
+$GIT_CLONE git://sigrok.org/sigrok-cli
cd sigrok-cli
./autogen.sh
-PKG_CONFIG_PATH_i686_pc_mingw32=$P:$P2 ./configure $C
+PKG_CONFIG_PATH_i686_pc_mingw32_static=$P:$P2 ./configure $C
make $PARALLEL V=1
make install
makensis -DHOME=$HOME contrib/sigrok-cli_cross.nsi
cd ..
# PulseView
-git clone git://sigrok.org/pulseview
+$GIT_CLONE git://sigrok.org/pulseview
cd pulseview
-PKG_CONFIG_PATH_i686_pc_mingw32=$P:$P2 cmake $CM -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX -DDISABLE_WERROR=y .
+PKG_CONFIG_PATH_i686_pc_mingw32_static=$P:$P2 cmake $CM -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX -DDISABLE_WERROR=y .
make $PARALLEL VERBOSE=1
make install
makensis -DHOME=$HOME contrib/pulseview_cross.nsi