2022-12-04 17:02:16 +01:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.."
|
|
|
|
|
2022-12-04 19:40:02 +01:00
|
|
|
readonly mode="${1,,}"
|
|
|
|
if [[ "${mode}" != "gnu" && "${mode}" != "musl" ]]; then
|
|
|
|
echo "Error: Parameter must be either \"gnu\" or \"musl\" !!!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-12-04 17:02:16 +01:00
|
|
|
rm -rf "out"
|
|
|
|
mkdir -pv "out/include"
|
|
|
|
cp -rfv "libhashset/include/"*.h "out/include"
|
|
|
|
|
2022-12-04 19:40:02 +01:00
|
|
|
case "${mode}" in
|
|
|
|
gnu)
|
|
|
|
for target in i686 x86_64 aarch64; do
|
|
|
|
compiler="${target}-linux-gnu-gcc"
|
|
|
|
target="$("${compiler}" -dumpmachine)"
|
|
|
|
echo -e "--------------------------------\n${target}\n--------------------------------"
|
2022-12-05 00:19:42 +01:00
|
|
|
make CC="${compiler}" STRIP=1
|
2022-12-04 19:40:02 +01:00
|
|
|
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
|
|
|
|
;;
|
|
|
|
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--------------------------------"
|
2022-12-05 00:19:42 +01:00
|
|
|
make CC="${compiler}" STATIC=1 STRIP=1
|
2022-12-04 19:40:02 +01:00
|
|
|
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
|
2022-12-04 17:02:16 +01:00
|
|
|
done
|
2022-12-04 19:40:02 +01:00
|
|
|
;;
|
|
|
|
esac
|