Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- divert_path() { echo $1.real; } ### customizable
- divert() { dpkg-divert --divert $(divert_path $1) --rename $1; }
- GNUHOST=$(dpkg-architecture -qDEB_HOST_GNU_TYPE)
- VERSIONS=(4.6 4.7 4.8 4.9 5)
- USE_VERSION=5
- BINPATH=/usr/bin
- BIN=(g++ gcc gcc-ar gcc-nm gcc-ranlib gcov gcov-tool)
- BIN_HACK=(g++ gcc)
- for b in ${BIN[@]}; do
- TARGETS=()
- TARGETS=(${TARGETS[@]} ${b})
- for v in ${VERSIONS[@]}; do
- TARGETS=(${TARGETS[@]} ${b}-${v})
- done; unset v
- TARGETS=(${TARGETS[@]} ${GNUHOST}-${b})
- for v in ${VERSIONS[@]}; do
- TARGETS=(${TARGETS[@]} ${GNUHOST}-${b}-${v})
- done; unset v
- for t in ${TARGETS[@]}; do
- divert ${BINPATH}/${t}
- test "$t" = "$b" && continue
- ln -s ${b} ${BINPATH}/${t}
- done; unset t
- done; unset b
- for b in ${BIN[@]}; do
- cat > ${BINPATH}/${b} <<EOF
- #!/bin/sh
- exec $(divert_path ${b}-${USE_VERSION}) "\$@"
- EOF
- chmod 755 ${BINPATH}/${b}
- done; unset b
- for bh in ${BIN_HACK[@]}; do
- cat > ${BINPATH}/${bh} <<EOF
- #!/bin/sh
- exec $(divert_path ${bh}-${USE_VERSION}) "\$@" -march=native -mtune=native -Ofast
- EOF
- chmod 755 ${BINPATH}/${bh}
- done; unset bh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement