uxn-utils/cli/lz/build.sh

68 lines
1.3 KiB
Bash
Raw Normal View History

2023-11-14 23:12:28 -05:00
#!/bin/sh -e
2023-11-15 15:06:28 -05:00
RELEASE_flags="-DNDEBUG -O2 -g0 -s"
DEBUG_flags="-std=c89 -D_POSIX_C_SOURCE=199309L -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined"
2023-11-14 23:12:28 -05:00
LIN="uxncli $HOME/roms/uxnlin.rom"
ASM="uxncli $HOME/roms/drifblim.rom"
if [[ "$*" == *"--lint"* ]]
then
2023-11-15 19:14:41 -05:00
clang-format -i ulzdec.c
2023-11-16 14:02:10 -05:00
clang-format -i ulzenc.c
2023-11-16 23:47:50 -05:00
$LIN decoder.tal
2023-11-18 14:16:27 -05:00
$LIN encoder.tal
2023-11-14 23:12:28 -05:00
fi
2023-11-15 17:46:18 -05:00
# Building
2023-11-14 23:30:09 -05:00
2023-11-16 23:35:52 -05:00
cc ulzdec.c $DEBUG_flags -o ulzdec
cc ulzenc.c $DEBUG_flags -o ulzenc
2023-11-15 17:46:18 -05:00
$ASM ulzdec.tal ulzdec.rom
2023-11-18 14:16:27 -05:00
$ASM ulzenc.tal ulzenc.rom
if [[ "$*" == *"--install"* ]]
then
cp ulzenc ~/bin
cp ulzdec ~/bin
cp ulzdec.rom ~/roms
cp ulzenc.rom ~/roms
fi
2023-11-14 23:12:28 -05:00
2023-11-15 17:46:18 -05:00
# Make compressed file
2023-11-14 23:30:09 -05:00
2023-11-19 12:52:22 -05:00
echo ""
echo "Encoder(C89):"
2023-11-16 23:35:52 -05:00
./ulzenc example.txt a.ulz
2023-11-19 12:52:22 -05:00
echo "Decoder(C89):"
2023-11-16 23:35:52 -05:00
./ulzdec a.ulz b.bin
2023-11-19 12:52:22 -05:00
echo "Result(C89):"
2023-11-16 23:35:52 -05:00
cat b.bin
2023-11-15 17:46:18 -05:00
echo ""
2023-11-16 14:02:10 -05:00
2023-11-19 12:52:22 -05:00
rm ./a.ulz
rm ./b.bin
2023-11-18 14:16:27 -05:00
2023-11-19 12:52:22 -05:00
echo ""
echo "Encoder(Uxn):"
2023-11-18 14:16:27 -05:00
uxncli ulzenc.rom example.txt a.ulz
2023-11-19 12:52:22 -05:00
echo "Decoder(Uxn):"
uxncli ulzdec.rom a.ulz b.bin
echo "Result(Uxn):"
cat b.bin
echo ""
2023-11-18 14:16:27 -05:00
2023-11-19 14:15:59 -05:00
echo ""
echo "Image Encoding"
./ulzenc ako10x10.chr ako10x10.chr.ulz
uxncli ulzenc.rom ako10x10.chr ako10x10.chr.ulz
2023-11-15 17:46:18 -05:00
rm ./ulzdec
2023-11-15 23:30:28 -05:00
rm ./ulzenc
2023-11-15 19:14:41 -05:00
rm ./a.ulz
rm ./b.bin
2023-11-15 17:46:18 -05:00
rm ./ulzdec.rom
2023-11-19 14:15:59 -05:00
rm ./ulzenc.rom
2023-11-19 14:17:08 -05:00
rm ./ako10x10.chr.ulz
2023-11-16 23:35:52 -05:00
rm *.sym