Skip to content

Instantly share code, notes, and snippets.

@elkuno213
Created April 6, 2024 14:00
Show Gist options
  • Save elkuno213/96573409aee8d12951337621ef07b027 to your computer and use it in GitHub Desktop.
Save elkuno213/96573409aee8d12951337621ef07b027 to your computer and use it in GitHub Desktop.
Install LLVM on Ubuntu
#!/bin/sh
# Print usage information
print_usage() {
echo "Usage: $0 [llvm-version]"
echo "Installs LLVM with the specified version."
echo "If no version is provided, it defaults to version 16."
}
# Check for the number of arguments
if [ $# -eq 0 ]; then
print_usage
LLVM_VERSION="16" # Default value
else
LLVM_VERSION="$1"
fi
# Default LLVM version
echo "Installing LLVM version ${LLVM_VERSION}..."
# Install LLVM
apt-get update
apt-get install -y --no-install-recommends \
lsb-release \
wget \
software-properties-common \
gnupg
wget --no-check-certificate https://apt.llvm.org/llvm.sh -O /tmp/llvm.sh
chmod +x /tmp/llvm.sh
/tmp/llvm.sh ${LLVM_VERSION} all
rm -rf /tmp/llvm.sh
# Clean
apt-get autoremove -y
apt-get clean -y
rm -rf /var/lib/apt/lists/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment