Skip to content

Instantly share code, notes, and snippets.

@sbeyer
Created February 22, 2015 12:28
Show Gist options
  • Save sbeyer/d938fe616220885b034a to your computer and use it in GitHub Desktop.
Save sbeyer/d938fe616220885b034a to your computer and use it in GitHub Desktop.
Install Debian alternatives for clang/llvm 3.7 stuff
#!/bin/sh
#
# Debian defaults clang/llvm to use 3.5 although 3.7 is available.
# For example, llvm-symbolizer is used by default, e.g.,
# if you use the address sanitizing feature of clang.
# The problem is that even if you use clang-3.7, it looks for
# llvm-symbolizer instead of llvm-symbolizer-3.7.
# A bug in packaging? Maybe. I don't know. I don't care.
# This simple script generates corresponding alternatives.
CLANG_VERSION=3.7
for file in /usr/bin/*-$CLANG_VERSION
do
newfile="$(echo "$file" | sed 's/-'$CLANG_VERSION'$//')"
update-alternatives --install "$newfile" "$(basename "$newfile")" "$file" 1
done
@sbeyer
Copy link
Author

sbeyer commented Feb 22, 2015

I know that the script generates an alternative for any binary with -3.7 suffix in /usr/bin and not only clang. But... well... It suffices for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment