# For a very brief period, there was mpg123 1.11.0 with the split of libmpg123
# for 32 bit file offsets and and libmpg123_64 for 64 bit offsets.
# 1.12.0 introduces a dualmode library instead, replacing the split ones and
# being binary compatible with all earlier libmpg123 versions (be it for 32 or 64 bit offsets).
# So only when updating from 1.11.0, we might need to recast users of libmpg123_64 .
local OLD_SPELL_VERSION=""
local MAJOR=""
local MINOR=""
if [[ ${SMGL_COMPAT_ARCHS[0]} == 32 ]] && spell_ok  $SPELL; then
  OLD_SPELL_VERSION="$(installed_version $SPELL)"
  MAJOR=$(echo $OLD_SPELL_VERSION | cut -d . -f 1)
  MINOR=$(echo $OLD_SPELL_VERSION | cut -d . -f 2)
  if [[ $MAJOR -eq 1 ]] && [[ $MINOR -eq 11 ]]; then
    message "This is a possibly incompatible update of libmpg123..."
    message "Figuring out what spells need to be recast, this may take a while."
    for each in $(show_up_depends $SPELL); do
      if gaze install $each | xargs readelf -d 2> /dev/null |
         grep -q "NEEDED.*libmpg123_64.so.0"; then
           up_trigger $each cast_self
      fi
    done
  fi
fi

if [[ -e "$INSTALL_ROOT/usr/lib/libmpg123.la" ]]; then
  . $GRIMOIRE/la_remove_up_trigger.function
  la_remove_up_trigger 0
fi
