Small improvement to Linux build script.

This commit is contained in:
LoRd_MuldeR 2022-12-04 19:40:02 +01:00
parent 4983652ddf
commit f229c7ccfb

View File

@ -2,21 +2,47 @@
set -e set -e
cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.."
readonly mode="${1,,}"
if [[ "${mode}" != "gnu" && "${mode}" != "musl" ]]; then
echo "Error: Parameter must be either \"gnu\" or \"musl\" !!!"
exit 1
fi
rm -rf "out" rm -rf "out"
mkdir -pv "out/include" mkdir -pv "out/include"
cp -rfv "libhashset/include/"*.h "out/include" cp -rfv "libhashset/include/"*.h "out/include"
for target in i686 x86_64 arm64; do case "${mode}" in
compiler="/usr/local/musl/${target}/bin/musl-gcc" gnu)
target="$("${compiler}" -dumpmachine)" for target in i686 x86_64 aarch64; do
echo -e "--------------------------------\n${target}\n--------------------------------" compiler="${target}-linux-gnu-gcc"
make CC="${compiler}" clean target="$("${compiler}" -dumpmachine)"
make CC="${compiler}" echo -e "--------------------------------\n${target}\n--------------------------------"
mkdir -pv "out/lib/${target}" "out/bin/${target}" make CC="${compiler}" clean
cp -rv "libhashset/lib/"* "out/lib/${target}" make CC="${compiler}"
for i in example test; do mkdir -pv "out/lib/${target}" "out/bin/${target}"
for j in hash-set hash-map; do cp -rv "libhashset/lib/"* "out/lib/${target}"
cp -fv "${i}/${j}/bin/${i}-${j}" "out/bin/${target}" for i in example test; do
for j in hash-set hash-map; do
cp -fv "${i}/${j}/bin/${i}-${j}" "out/bin/${target}"
done
done
done done
done ;;
done musl)
for target in i686 x86_64 arm64; do
compiler="/usr/local/musl/${target}/bin/musl-gcc"
target="$("${compiler}" -dumpmachine | sed 's/-gnu/-musl/i')"
echo -e "--------------------------------\n${target}\n--------------------------------"
make CC="${compiler}" clean
make CC="${compiler}"
mkdir -pv "out/lib/${target}" "out/bin/${target}"
cp -rv "libhashset/lib/"* "out/lib/${target}"
for i in example test; do
for j in hash-set hash-map; do
cp -fv "${i}/${j}/bin/${i}-${j}" "out/bin/${target}"
done
done
done
;;
esac