#!/bin/sh
# This file is automatically generated by fs-package

set -e

echo "Build dependencies"
echo -------------------------------------------------------------------------\
-------

. fsdeps/env.sh
. fsdeps/system.sh

echo FSDEPS_PREFIX=$FSDEPS_PREFIX
echo LIBRARY_PATH=$LIBRARY_PATH
echo PKG_CONFIG_PATH=$PKG_CONFIG_PATH

if [ $SYSTEM_OS = "macOS" ]; then
echo MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET
fi

if [ -f fsdeps/build.sh ]; then
sh fsdeps/build.sh
elif [ -f ./deps.sh ]; then
sh ./deps.sh
fi

if [ $SYSTEM_OS = "Windows" ]; then
if [ -d $FSDEPS_PREFIX/bin ]; then
FIND_DLLS="`find $FSDEPS_PREFIX/bin -maxdepth 1 -mindepth 1 -name '*.dll'`"
if [ "$FIND_DLLS" != "" ]; then
# Copy DLL files to root directory for running executables during development
echo "cp $FSDEPS_PREFIX/bin/*.dll ."
cp $FSDEPS_PREFIX/bin/*.dll .
else
echo "No DLL files to copy from $FSDEPS_PREFIX/bin"
fi
fi
fi

echo -------------------------------------------------------------------------\
-------
echo "Built fsdeps for ${SYSTEM_OS}_${SYSTEM_ARCH}"
