Skip to content
Snippets Groups Projects

feat: install iwyu in spack

Merged Wouter Deconinck requested to merge spack-iwyu into master
Files
3
@@ -72,28 +72,39 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
@@ -72,28 +72,39 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt/lists,sharing=locked <<EOF
--mount=type=cache,target=/var/lib/apt/lists,sharing=locked <<EOF
. /etc/os-release
. /etc/os-release
mkdir -p /etc/apt/source.list.d
mkdir -p /etc/apt/source.list.d
if [ "${ID}" = "ubuntu" ] ; then
# GCC version and repository
echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/ppa/ubuntu/${VERSION_CODENAME} main" > /etc/apt/source.list.d/ubuntu-toolchain.list
case ${ID} in
if [ "${VERSION_ID}" = "20.04" ] ; then GCC="-10" CLANG="-12" ; fi
debian)
if [ "${VERSION_ID}" = "22.04" ] ; then GCC="-12" CLANG="-14" ; fi
case ${VERSION_CODENAME} in
curl -s https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
bookworm) GCC="-12" ;;
echo "deb http://apt.llvm.org/${VERSION_CODENAME} llvm-toolchain-${VERSION_CODENAME}${CLANG} main" > /etc/apt/source.list.d/llvm.list
trixie) GCC="-13" ;;
apt-get -yqq update
*) echo "Unsupported VERSION_CODENAME=${VERSION_CODENAME}" ; exit 1 ;;
apt-get -yqq install gcc${GCC} g++${GCC} gfortran${GCC}
esac ;;
apt-get -yqq install clang${CLANG} clang-tidy${CLANG} clang-format${CLANG}
ubuntu)
apt-get -yqq install iwyu
echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/ppa/ubuntu/${VERSION_CODENAME} main" > /etc/apt/source.list.d/ubuntu-toolchain.list
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc${GCC} 100
case ${VERSION_CODENAME} in
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++${GCC} 100
focal) GCC="-10" ;;
update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran${GCC} 100
jammy) GCC="-12" ;;
update-alternatives --install /usr/bin/clang clang /usr/bin/clang${CLANG} 100
*) echo "Unsupported VERSION_CODENAME=${VERSION_CODENAME}" ; exit 1 ;;
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++${CLANG} 100
esac ;;
else
*) echo "Unsupported ID=${ID}" ; exit 1 ;;
apt-get -yqq update
esac
apt-get -yqq install gcc g++ gfortran
# Clang version and repository
apt-get -yqq install clang clang-tidy clang-format
CLANG="-14"
apt-get -yqq install iwyu
curl -s https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
fi
echo "deb http://apt.llvm.org/${VERSION_CODENAME} llvm-toolchain-${VERSION_CODENAME}${CLANG} main" > /etc/apt/source.list.d/llvm.list
 
# Install packages
 
apt-get -yqq update
 
apt-get -yqq install gcc${GCC} g++${GCC} gfortran${GCC}
 
apt-get -yqq install clang${CLANG} clang-tidy${CLANG} clang-format${CLANG} libclang${CLANG}-dev
apt-get -yqq autoremove
apt-get -yqq autoremove
 
# Ensure alternatives without version tags
 
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc${GCC} 100
 
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++${GCC} 100
 
update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran${GCC} 100
 
update-alternatives --install /usr/bin/clang clang /usr/bin/clang${CLANG} 100
 
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++${CLANG} 100
 
# Check versions
gcc --version
gcc --version
clang --version
clang --version
EOF
EOF
Loading