if [[ $PY3K == y ]]; then
  make install DESTDIR="$INSTALL_ROOT"
else
  make altinstall DESTDIR="$INSTALL_ROOT"
fi &&


# gettext
for script in pygettext msgfmt; do
  install -vm 755 "$SOURCE_DIRECTORY/Tools/i18n/${script}.py" \
                  "$INSTALL_ROOT/usr/bin/${script}3.py"
done &&

# help some stupid installer scripts
local PV=`echo ${VERSION}|cut -d . -f 1,2` &&

# Add python3 pkgconfig aliases
ln -sf "$TRACK_ROOT"/usr/lib/pkgconfig/python-${PV}.pc \
   "$INSTALL_ROOT"/usr/lib/pkgconfig/python3.pc &&
ln -sf "$TRACK_ROOT"/usr/lib/pkgconfig/python-${PV}-embed.pc \
   "$INSTALL_ROOT"/usr/lib/pkgconfig/python3-embed.pc &&

# Ensure existence of /usr/bin/python3 and /usr/bin/python3-config 
# symlinks, as they are not created with altinstall.
# See https://mail.python.org/pipermail/python-dev/2011-March/108971.html
# and the surrounding thread for fun.
# Sometimes you got python3.5m-config, but not python3.5-config.
if test -e "$INSTALL_ROOT/usr/bin/python${PV}m-config"; then
  ln -sf python${PV}m-config "$INSTALL_ROOT/usr/bin/python$PV-config" 
fi &&
ln -sf python$PV "$INSTALL_ROOT/usr/bin/python3" &&
ln -sf python$PV-config "$INSTALL_ROOT/usr/bin/python3-config" &&
if [[ -e ${TRACK_ROOT}/usr/include/python${PV}m ]]; then
  ln -sf ${TRACK_ROOT}/usr/include/python${PV}m ${INSTALL_ROOT}/usr/include/python${PV}
fi &&
# this is the primary/only version of python
if [[ $PY3K == y ]] && [[ $SYMLINK == y ]];then
 ln -sf ${TRACK_ROOT}/usr/bin/python3 ${INSTALL_ROOT}/usr/bin/python &&
 ln -sf ${TRACK_ROOT}/usr/bin/python3-config ${INSTALL_ROOT}/usr/bin/python-config &&
 ln -sf "$TRACK_ROOT"/usr/lib/pkgconfig/python-${PV}.pc \
    "$INSTALL_ROOT"/usr/lib/pkgconfig/python.pc &&
 ln -sf "$TRACK_ROOT"/usr/lib/pkgconfig/python-${PV}-embed.pc \
    "$INSTALL_ROOT"/usr/lib/pkgconfig/python-embed.pc
fi
