2017-11-19 05:20:30 +01:00
|
|
|
function check_download()
|
|
|
|
{
|
|
|
|
if [ -f $DL/$FNAME ]; then
|
2018-01-02 13:26:29 +01:00
|
|
|
CHECK=$(shasum -a 256 $DL/$FNAME |awk '{printf $1};')
|
2017-11-19 05:20:30 +01:00
|
|
|
if [ "$CHECK" == "$CSUM" ]; then
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
echo "Checksum mismatch for $FNAME. Was $CHECK, expected $CSUM"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "$FNAME not found."
|
|
|
|
fi
|
|
|
|
|
|
|
|
return -1
|
|
|
|
}
|
|
|
|
|
|
|
|
function download()
|
|
|
|
{
|
|
|
|
check_download && return 0
|
|
|
|
|
|
|
|
rm -f $DL/$FNAME
|
|
|
|
if [ -n "$URL" ]; then
|
|
|
|
wget $URL -O $DL/$FNAME
|
|
|
|
else
|
|
|
|
echo URL must be specified
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
check_download || return -1
|
|
|
|
}
|
2018-03-27 14:02:41 +02:00
|
|
|
|
|
|
|
function apply_patches()
|
|
|
|
{
|
|
|
|
DEP_NAME=$1
|
|
|
|
|
|
|
|
# change directory since git apply got confused when
|
|
|
|
# applying patches to files which are not found in index
|
|
|
|
DIR=$(pwd)
|
|
|
|
pushd ${DIR}
|
|
|
|
cd /tmp
|
|
|
|
# apply pre-generated patches
|
|
|
|
for file in $O3/core/deps/${DEP_NAME}/patches/*.patch; do
|
|
|
|
echo Applying patch: $file
|
|
|
|
git apply --directory ${DIR} --unsafe-path $file
|
|
|
|
done
|
|
|
|
popd
|
|
|
|
}
|
2021-10-19 13:52:19 +02:00
|
|
|
|
|
|
|
function lto_flags()
|
|
|
|
{
|
|
|
|
local seed=$1
|
2021-10-20 17:37:03 +02:00
|
|
|
if [ "$TARGET" == "linux" ]; then
|
2021-10-19 13:52:19 +02:00
|
|
|
echo -n " -flto=4 -Wl,--no-as-needed "
|
|
|
|
if [ -n "$seed" ]; then
|
|
|
|
echo -n " -frandom-seed=$seed "
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|