Add base tcc build script
parent
9210ca0593
commit
fdb5b16fee
|
@ -0,0 +1,39 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
# Configs
|
||||
if [ -z "$CC" ]
|
||||
then
|
||||
CC="gcc"
|
||||
fi
|
||||
|
||||
# URL
|
||||
TCC_URL='https://download.savannah.gnu.org/releases/tinycc/tcc-0.9.27.tar.bz2'
|
||||
TCC_SHA256='de23af78fca90ce32dff2dd45b3432b2334740bb9bb7b05bf60fdbfc396ceb9c'
|
||||
TCC_FILE='tcc.tar.bz2'
|
||||
|
||||
# Download
|
||||
cd "$(dirname "$0")" &&
|
||||
mkdir -p 'files/raw' &&
|
||||
cd 'files/raw' &&
|
||||
(
|
||||
if [ ! -f "$TCC_FILE" ]; then
|
||||
wget -O "$TCC_FILE" "$TCC_URL"
|
||||
else
|
||||
echo Use cache
|
||||
fi
|
||||
) &&
|
||||
( TMP="$(sha256sum "$TCC_FILE")" &&
|
||||
if [ "${TMP:0:64}" != "$TCC_SHA256" ]
|
||||
then
|
||||
rm -rf "$TCC_FILE" &&
|
||||
echo 'Hash miss matches!' &&
|
||||
exit 1
|
||||
fi ) &&
|
||||
|
||||
# Build tcc
|
||||
ls | grep -v "$TCC_FILE" | xargs rm -rf &&
|
||||
tar -xf "$TCC_FILE" &&
|
||||
cd tcc-* &&
|
||||
echo '#define TCC_VERSION "0.9.27"' > config.h &&
|
||||
echo '#undef TCC_IS_NATIVE' >> tcc.h &&
|
||||
"$CC" -static -o ../tcc -DCONFIG_TCCBOOT tcc.c
|
|
@ -0,0 +1 @@
|
|||
/raw
|
Loading…
Reference in New Issue