             SPELL=llvm
case "$SLOT" in
            ('')    SLOT=0 ;&
             (0) VERSION=23.1.1
     SPIRV_VERSION=23.1.1
        SPIRV_HASH=sha512:fe2de5bfaffa95d20b81a15a11e6fdf6f7f190eebb4d6991cc36cd4670235d427e764437adbb5e572e5522cdfe8f0281a38e2fa088d9cadfc01f92cc844bba69
                 ;;
            (22) VERSION=22.1.8
     SPIRV_VERSION=22.1.6
        SPIRV_HASH=sha512:da0326c93a3988c11a32a298e82b07b33978e2d5ae080d65a243a8125017d63824d1d42d759232f7bf138663eba25e57e45b2d4b2e9f77c01f1e21b80353f461
                 ;;
            (21) VERSION=21.1.8
     SPIRV_VERSION=21.1.10
        SPIRV_HASH=sha512:6be1130d714c41ebd03896a0b33df1f5663b05a97e6af599a2d22b6a005232a6e039d0106007dc9a5f1a05887f11b8d9d97b1650499078d2841f3d0edf3a4d5f
                 ;;
            (20) VERSION=20.1.8
     SPIRV_VERSION=19.1.3
        SPIRV_HASH=sha512:8370ca2192e7df3aff2e2336155d3ab5519103cc31f84a1d199b34d78ad77397be0e3944d2d5eb815497fb297dcb1b4ca063d2f667dfe8e0a75c896389a9ad0b
                 ;;
            (16) VERSION=16.0.6
                 ;;
            (15) VERSION=15.0.7
        PATCHLEVEL=1
                 ;;
esac
# slot 0 is the system llvm and owns /usr; every other slot is a major
# of its own and installs under /opt, which is where the versioned
# spells these slots were made from always meant to go
if [[ $SLOT == 0 ]]; then
       LLVM_PREFIX=/usr
else
       LLVM_PREFIX=/opt/llvm$SLOT
fi
# 15 and 16 are the standalone llvm of their day: one tarball, built in
# a tree of its own, with cmake and polly unpacked beside it.  20 is
# released as a set of tarballs to be laid out as a project tree, and
# from 21 it is that tree in one tarball
case $SLOT in
       (15|16) LLVM_LAYOUT=standalone ;;
          (20) LLVM_LAYOUT=split ;;
            *) LLVM_LAYOUT=project ;;
esac
SPELL_BUILD_SYSTEM=cmake
        GITHUB_URI="https://github.com/llvm/llvm-project/releases/download/llvmorg-$VERSION"
if [[ $LLVM_LAYOUT == project ]]; then
  SOURCE_DIRECTORY="${BUILD_DIRECTORY}/${SPELL}-project-${VERSION}.src"
            SOURCE="${SPELL}-project-${VERSION}.src.tar.xz"
     SOURCE_URL[0]="${GITHUB_URI}/${SOURCE}"
           SOURCE2=$SOURCE.sig
    SOURCE2_URL[0]="${SOURCE_URL[0]}.sig"
        SOURCE_GPG=llvm.gpg:$SOURCE2:UPSTREAM_KEY
    SOURCE2_IGNORE=signature
if [[ "$LLVM_WITH_SPIRV" == y ]]; then
     SOURCE33_HASH="$SPIRV_HASH"
          SOURCE33="SPIRV-LLVM-Translator-$SPIRV_VERSION.tar.gz"
   SOURCE33_URL[0]="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/v$SPIRV_VERSION/$SOURCE33"
fi

elif [[ $LLVM_LAYOUT == standalone ]]; then
  SOURCE_DIRECTORY="${BUILD_DIRECTORY}/llvm-${VERSION}.src"
            SOURCE="llvm-${VERSION}.src.tar.xz"
     SOURCE_URL[0]="${GITHUB_URI}/${SOURCE}"
          SOURCE21="cmake-${VERSION}.src.tar.xz"
   SOURCE21_URL[0]="${GITHUB_URI}/${SOURCE21}"
if [[ "$LLVM_WITH_POLLY" == y ]]; then
          SOURCE11="polly-${VERSION}.src.tar.xz"
   SOURCE11_URL[0]="${GITHUB_URI}/${SOURCE11}"
fi
# these two were taken on trust of their hash long before the spells
# were merged, and there is no reason to take them any other way now
case $SLOT in
  (16)
       SOURCE_HASH=sha512:8d4cdadc9a1ad249fbf9248c8e56f3bcafab73a473a0b0ca73499ed8825c62e27668aac4f1d03341631e5ad93701621e834e9e196ca32eac3ef805cf1c860083
     SOURCE11_HASH=sha512:791473c145930fcd1541002c5385c2fbc1b6dbecc60ca19b69f81d4df27a324609d1b0fc2723893147886eab988b4bf88e9c0ca815b1aa5b0a10d899cf32bc7e
     SOURCE21_HASH=sha512:52ecd941d2d85a5b668caa5d0d40480cb6a97b3bf1174e634c2a93e9ef6d03670ca7e96abb0a60cb33ba537b93d5788754dab1f2f45c1f623f788162717d088b
                 ;;
  (15)
       SOURCE_HASH=sha256:4ad8b2cc8003c86d0078d15d987d84e3a739f24aae9033865c027abae93ee7a4
     SOURCE11_HASH=sha256:1053610cace401c0b4e6d430d441277b0283dd4112581e2acc90e174d3192819
     SOURCE21_HASH=sha256:8986f29b634fdaa9862eedda78513969fe9788301c9f2d938f4c10a3e7a3e7ea
                 ;;
esac

else
  SOURCE_DIRECTORY="${BUILD_DIRECTORY}/llvm-project"
            SOURCE="llvm-${VERSION}.src.tar.xz"
           SOURCE2=$SOURCE.sig
     SOURCE_URL[0]="${GITHUB_URI}/${SOURCE}"
    SOURCE2_URL[0]="${SOURCE_URL[0]}.sig"
        SOURCE_GPG=llvm.gpg:$SOURCE2:UPSTREAM_KEY
    SOURCE2_IGNORE=signature
           SOURCE3="cmake-${VERSION}.src.tar.xz"
    SOURCE3_URL[0]="${GITHUB_URI}/${SOURCE3}"
           SOURCE4="$SOURCE3.sig"
    SOURCE4_URL[0]="${SOURCE3_URL[0]}.sig"
       SOURCE3_GPG="llvm.gpg:$SOURCE4:UPSTREAM_KEY"
    SOURCE4_IGNORE=signature
if [[ "$LLVM_WITH_BOLT" == y ]]; then
           SOURCE5="bolt-${VERSION}.src.tar.xz"
    SOURCE5_URL[0]="${GITHUB_URI}/${SOURCE5}"
           SOURCE6="$SOURCE5.sig"
    SOURCE6_URL[0]="${SOURCE5_URL[0]}.sig"
       SOURCE5_GPG="llvm.gpg:$SOURCE6:UPSTREAM_KEY"
    SOURCE6_IGNORE="signature"
fi
if [[ "$LLVM_WITH_CLANG" == y ]]; then
           SOURCE7="clang-${VERSION}.src.tar.xz"
    SOURCE7_URL[0]="${GITHUB_URI}/${SOURCE7}"
           SOURCE8="$SOURCE7.sig"
    SOURCE8_URL[0]="${SOURCE7_URL[0]}.sig"
       SOURCE7_GPG="llvm.gpg:$SOURCE8:UPSTREAM_KEY"
    SOURCE8_IGNORE="signature"
           SOURCE9="clang-tools-extra-${VERSION}.src.tar.xz"
    SOURCE9_URL[0]="${GITHUB_URI}/${SOURCE9}"
          SOURCE10="$SOURCE9.sig"
   SOURCE10_URL[0]="${SOURCE9_URL[0]}.sig"
       SOURCE9_GPG="llvm.gpg:$SOURCE10:UPSTREAM_KEY"
   SOURCE10_IGNORE=signature
fi
if [[ "$LLVM_WITH_LLD" == y ]]; then
          SOURCE11="lld-${VERSION}.src.tar.xz"
   SOURCE11_URL[0]="${GITHUB_URI}/${SOURCE11}"
          SOURCE12="$SOURCE11.sig"
   SOURCE12_URL[0]="${SOURCE11_URL[0]}.sig"
      SOURCE11_GPG="llvm.gpg:$SOURCE12:UPSTREAM_KEY"
   SOURCE12_IGNORE="signature"
fi
if [[ "$LLVM_WITH_LLDB" == y ]]; then
          SOURCE13="lldb-${VERSION}.src.tar.xz"
   SOURCE13_URL[0]="${GITHUB_URI}/${SOURCE13}"
          SOURCE14="$SOURCE13.sig"
   SOURCE14_URL[0]="${SOURCE13_URL[0]}.sig"
      SOURCE13_GPG="llvm.gpg:$SOURCE14:UPSTREAM_KEY"
   SOURCE14_IGNORE="signature"
fi
if [[ "$LLVM_WITH_MLIR" == y ]]; then
          SOURCE15="mlir-${VERSION}.src.tar.xz"
   SOURCE15_URL[0]="${GITHUB_URI}/${SOURCE15}"
          SOURCE16="$SOURCE15.sig"
   SOURCE16_URL[0]="${SOURCE15_URL[0]}.sig"
      SOURCE15_GPG="llvm.gpg:$SOURCE16:UPSTREAM_KEY"
   SOURCE16_IGNORE="signature"
fi
if [[ "$LLVM_WITH_POLLY" == y ]]; then
          SOURCE17="polly-${VERSION}.src.tar.xz"
   SOURCE17_URL[0]="${GITHUB_URI}/${SOURCE17}"
          SOURCE18="$SOURCE17.sig"
   SOURCE18_URL[0]="${SOURCE17_URL[0]}.sig"
      SOURCE17_GPG="llvm.gpg:$SOURCE18:UPSTREAM_KEY"
   SOURCE18_IGNORE="signature"
fi
if [[ -n "$LLVM_RUNTIMES" ]] ;then
           SOURCE19="runtimes-${VERSION}.src.tar.xz"
    SOURCE19_URL[0]="${GITHUB_URI}/${SOURCE19}"
           SOURCE20="$SOURCE19.sig"
    SOURCE20_URL[0]="${SOURCE19_URL[0]}.sig"
       SOURCE19_GPG="llvm.gpg:$SOURCE20:UPSTREAM_KEY"
    SOURCE20_IGNORE="signature"
fi
if list_find "$LLVM_RUNTIMES" "compiler-rt" ;then
           SOURCE21="compiler-rt-${VERSION}.src.tar.xz"
    SOURCE21_URL[0]="${GITHUB_URI}/${SOURCE21}"
           SOURCE22="$SOURCE21.sig"
    SOURCE22_URL[0]="${SOURCE21_URL[0]}.sig"
       SOURCE21_GPG="llvm.gpg:$SOURCE22:UPSTREAM_KEY"
    SOURCE22_IGNORE="signature"
fi
if list_find "$LLVM_RUNTIMES" "libcxx" ;then
          SOURCE23="libcxx-${VERSION}.src.tar.xz"
   SOURCE23_URL[0]="${GITHUB_URI}/${SOURCE23}"
          SOURCE24="$SOURCE23.sig"
   SOURCE24_URL[0]="${SOURCE23_URL[0]}.sig"
      SOURCE23_GPG="llvm.gpg:$SOURCE24:UPSTREAM_KEY"
   SOURCE24_IGNORE="signature"
fi
if list_find "$LLVM_RUNTIMES" "libcxxabi" ;then
          SOURCE25="libcxxabi-${VERSION}.src.tar.xz"
   SOURCE25_URL[0]="${GITHUB_URI}/${SOURCE25}"
          SOURCE26="$SOURCE25.sig"
   SOURCE26_URL[0]="${SOURCE25_URL[0]}.sig"
      SOURCE25_GPG="llvm.gpg:$SOURCE26:UPSTREAM_KEY"
   SOURCE26_IGNORE="signature"
fi
if list_find "$LLVM_RUNTIMES" "libunwind" ;then
          SOURCE27="libunwind-${VERSION}.src.tar.xz"
   SOURCE27_URL[0]="${GITHUB_URI}/${SOURCE27}"
          SOURCE28="$SOURCE27.sig"
   SOURCE28_URL[0]="${SOURCE27_URL[0]}.sig"
      SOURCE27_GPG="llvm.gpg:$SOURCE28:UPSTREAM_KEY"
   SOURCE28_IGNORE="signature"
fi
if list_find "$LLVM_RUNTIMES" "openmp" ;then
          SOURCE29="openmp-${VERSION}.src.tar.xz"
   SOURCE29_URL[0]="${GITHUB_URI}/${SOURCE29}"
          SOURCE30="$SOURCE29.sig"
   SOURCE30_URL[0]="${SOURCE29_URL[0]}.sig"
      SOURCE29_GPG="llvm.gpg:$SOURCE30:UPSTREAM_KEY"
   SOURCE30_IGNORE="signature"
fi
if [[ "$LLVM_WITH_LIBCLC" == y ]]; then
          SOURCE31="libclc-${VERSION}.src.tar.xz"
   SOURCE31_URL[0]="${GITHUB_URI}/${SOURCE31}"
          SOURCE32="$SOURCE31.sig"
   SOURCE32_URL[0]="${SOURCE31_URL[0]}.sig"
      SOURCE31_GPG="llvm.gpg:$SOURCE32:UPSTREAM_KEY"
   SOURCE32_IGNORE="signature"
fi
if [[ "$LLVM_WITH_SPIRV" == y ]]; then
          SOURCE33="SPIRV-LLVM-Translator-$SPIRV_VERSION.tar.gz"
   SOURCE33_URL[0]="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/v$SPIRV_VERSION/$SOURCE33"
     SOURCE33_HASH="$SPIRV_HASH"
fi
if [[ "$LLVM_WITH_FLANG" == y ]]; then
          SOURCE34="flang-${VERSION}.src.tar.xz"
   SOURCE34_URL[0]="${GITHUB_URI}/${SOURCE34}"
          SOURCE35="$SOURCE34.sig"
   SOURCE35_URL[0]="${SOURCE34_URL[0]}.sig"
      SOURCE34_GPG="llvm.gpg:$SOURCE35:UPSTREAM_KEY"
   SOURCE35_IGNORE="signature"
fi
fi
          WEB_SITE="https://llvm.org"
        LICENSE[0]=APACHE
           ENTERED=20081115
             SHORT="A novel compiler infrastructure, version ${VERSION%%.*}.x"
             TMPFS=off # Well, needs about 5G space, plus actual RAM for compiling.
    STAGED_INSTALL=off # chmod issues with castfs
cat << EOF
The LLVM Project is a collection of modular and reusable compiler and toolchain
technologies. Despite its name, LLVM has little to do with traditional virtual
machines. The name "LLVM" itself is not an acronym; it is the full name of the
project.

LLVM began as a research project at the University of Illinois, with the goal
of providing a modern, SSA-based compilation strategy capable of supporting
both static and dynamic compilation of arbitrary programming languages. Since
then, LLVM has grown to be an umbrella project consisting of a number of
subprojects, many of which are being used in production by a wide variety of
commercial and open source projects as well as being widely used in academic
research.
EOF
