taro/build.sh

58 lines
1.3 KiB
Bash
Executable file

#!/bin/sh
# check we have all dependencies
echo "Checking dependencies..."
if ! which uxnasm || ! which uxnemu || ! which crystal || ! which mseq ; then
echo "dependencies are not met - we need:"
echo "- uxnasm"
echo "- uxnemu"
echo "- crystal"
echo "- mblaze"
exit 1
fi
# build config into crystal constants
echo "Generating config.cr"
. ./config
cat << END > config.cr
MBOX_ROOT = "${MBOX_ROOT}"
TARO_LIB = "${TARO_LIB}"
TARO_DOWNLOADS = "${TARO_DOWNLOADS}"
UXN_EMU = "${UXN_EMU}"
TARO_ENV = "${TARO_ENV}"
READER_PROG = "${READER_PROG}"
COMPOSE_PROG = "${COMPOSE_PROG}"
END
# build
echo "Building taro-ls"
uxnasm taro-ls.tal taro-ls
echo "Building taro-ctl"
crystal build --release --no-debug -s taro-ctl.cr
# setup TARO_LIB
if [ "${TARO_LIB}" != "${PWD}" ]; then
mkdir -p "${TARO_LIB}"
for x in taro-ls taro-reader lesskey .theme font.icn taro-ctl taro.svg; do
if [ -e ${x} ]; then
cp ${x} "${TARO_LIB}"
fi
done
echo "TARO_LIB is in ${TARO_LIB}; you can either"
echo "- add it to your PATH"
echo "- or copy taro-ctl into your PATH"
fi
cp "$(which uxnemu)" "${TARO_LIB}/${UXN_EMU}"
# optionally, fill out desktopfile with proper variables and install it
if [ "$1" = "desktopfile" ]; then
sed -e "s#TARO_LIB#${TARO_LIB}#g" -e "s#UXN_EMU#${UXN_EMU}#g" taro.desktop > ~/.local/share/applications/taro.desktop
fi