This commit is contained in:
endernon 2024-12-08 20:19:16 +00:00
parent 24d5acedae
commit 5c550c8b26

View file

@ -1,3 +1,5 @@
#!/bin/bash
# create the build dir if it doesn't already exist
mkdir -p ./build
@ -7,6 +9,30 @@ cp -r {assets,pack.png,pack.mcmeta} ./build
# change working dir into the build dir
cd build
# detect arch for downloading OxiPng
frfrarch=$(uname -m)
echo SYSTEM ARCHITECTURE IS $frarch
# get and use oxipng if it is available for your architecture
if [[ $frfrarch == "x86_64" ]]; then
echo "downloading oxipng x64"
wget -O oxipng.tar.gz https://github.com/shssoichiro/oxipng/releases/download/v9.1.3/oxipng-9.1.3-x86_64-unknown-linux-musl.tar.gz
elif [[ $frfrarch == "aarch64" ]]; then
echo "downloading oxipng arm64"
wget -O oxipng.tar.gz https://github.com/shssoichiro/oxipng/releases/download/v9.1.3/oxipng-9.1.3-aarch64-unknown-linux-musl.tar.gz
else
echo unknown architecture, oxipng wont be used
fi
# banger size reduction on files in build dir yep
if [[ -e oxipng.tar.gz ]]; then
tar -xvzf oxipng.tar.gz
rm oxipng.tar.gz
mv ./oxipng* ./oxipngdir
mv ./oxipngdir/oxipng ./oxipng
chmod +x oxipng
oxipng -o max --strip all --alpha **/*.png
fi
# remove all the gimp files (those don't do anything in the final build)
find . -name "*.xcf" -type f -delete