Создал(а) 'ce-generate-config.sh'

This commit is contained in:
a1batross 2023-05-06 20:11:49 +02:00
parent 2b3bd5d6b2
commit 67553f3cd3

68
ce-generate-config.sh Normal file
View File

@ -0,0 +1,68 @@
#!/bin/bash
set -e
C_CONFIG="etc/config/c++.defaults.properties"
FORT_CONFIG="etc/config/fortran.defaults.properties"
# reset our changes
sudo -Hu compiler-explorer git checkout $C_CONFIG $FORT_CONFIG
ce_compilers="elcc11911"
fe_compilers="elfortran11911"
cs_compilers=""
fs_compilers=""
maxver=0
for i in /opt/mcst/*; do
name="$(echo $i | rev | cut -d/ -f1 | rev)"
if [[ $name != lcc-1* ]]; then
echo "Ignoring $name, doesn't look like compiler..."
continue
fi
if [ ! -d /opt/mcst/$name ]; then
echo "Ignoring $name, not a directory..."
fi
version=$(echo $name | grep -oE "1\.[0-9]+\.[0-9]+")
dotless_ver=$(echo $version | tr -d '.')
if [[ $name == *e2k-* ]]; then
echo "Found elbrus cross $name"
compiler="e"
if [[ $dotless_ver -gt $f_default ]]; then
maxver=$dotless_ver
fi
elif [[ $name == *e90-r1000* ]]; then
echo "Found sparc cross $name"
compiler="s"
else
echo "Ignoring $name, unknown architecture..."
continue
fi
echo "compiler.${compiler}lcc${dotless_ver}.semver=${version}" >> $C_CONFIG
echo "compiler.${compiler}lcc${dotless_ver}.exe=/opt/mcst/${name}/bin/lcc" >> $C_CONFIG
echo "compiler.${compiler}lfortran${dotless_ver}.semver=${version}" >> $FORT_CONFIG
echo "compiler.${compiler}lfortran${dotless_ver}.exe=/opt/mcst/${name}/bin/lfortran" >> $FORT_CONFIG
if [[ $compiler == e ]]; then
ce_compilers="elcc${dotless_ver}:${ce_compilers}"
fe_compilers="elfortran${dotless_ver}:${fe_compilers}"
elif [[ $compiler == s ]]; then
cs_compilers="slcc${dotless_ver}:${cs_compilers}"
fs_compilers="slfortran${dotless_ver}:${fs_compilers}"
fi
done
echo "defaultCompiler=elcc$maxver" >> $C_CONFIG
echo "defaultCompiler=elfortran$maxver" >> $FORT_CONFIG
echo "group.slcc.compilers=${cs_compilers}" >> $C_CONFIG
echo "group.elcc.compilers=${ce_compilers}" >> $C_CONFIG
echo "group.slfortran.compilers=${fs_compilers}" >> $FORT_CONFIG
echo "group.elfortran.compilers=${fe_compilers}" >> $FORT_CONFIG